GLProgramming.com

home :: about :: development guides :: irc :: forums :: search :: paste :: links :: contribute :: code dump

-> Click here to learn how to get live help <-


New Paste :: Recent Pastes:: No Line Numbers


A Paste by dranith
1
 
#include <time.h>
#include <stdlib.h>
#include <stdio.h>

///////////////////////////////////////////////////////////////////////

int main() 
{       
    srand( (unsigned)time( 0 ) );
    // Forces floatvar not to be optimized out
    float floatvar = (float)rand()/(float)RAND_MAX;
    int    intvar = floatvar;
    // Forces intvar not to be optimized out
    printf( "%d\n", intvar );
    return 0;
}


;    COMDAT _main
_TEXT    SEGMENT
tv79 = -4                        ; size = 4
_main    PROC NEAR                    ; COMDAT

; 19   : {       

    push    ecx

; 20   :     srand( (unsigned)time( 0 ) );

    push    0
    call    _time
    push    eax
    call    _srand

; 21   :     float floatvar = (float)rand()/(float)RAND_MAX;

    call    _rand

; 22   :     int    intvar = floatvar;

    mov    DWORD PTR tv79[esp+12], eax
    fild    DWORD PTR tv79[esp+12]
    fmul    DWORD PTR __real@38000100
    call    __ftol2

; 23   :     printf( "%d", intvar );

    push    eax
    push    OFFSET FLAT:??_C@_02DPKJAMEF@?$CFd?$AA@
    call    _printf

; 24   :     return 0;

    xor    eax, eax

; 25   : }

    add    esp, 20                    ; 00000014H
    ret    0
_main    ENDP
_TEXT    ENDS
END