// File: /workspace/github_c_makefile_star2_O0/shaswata56[P]BenchUtil/BenchmarkFLOPS32.c
// Function: initFLOPS32
void initFLOPS32 (const int POOL) {

    time_t	now; time(&now);
    pthread_t memThreads[POOL];
    unsigned long long flopsLog[POOL][6];
    unsigned long long flops[6], tFlops[POOL], maxflops = 0, temp = 0, singleCoreMax = 0;

    for (int i = 0 ; i < 1; i++) {
        if (i == 0)
            for (int r = 0; r < POOL; r++) {
                tFlops[r] = 0;
                flopsLog[r][i] = 0;
                pthread_create(&memThreads[r], NULL, calculateFLOPS32, &tFlops[r]);
            }
        sleep(60);
        for (int r = 0; r < POOL; r++)
            flopsLog[r][i] = tFlops[r];
    }

    for (int i = 0; i < POOL; i++)
        pthread_cancel(memThreads[i]);

    FILE *fptr;
    fptr = fopen("flopsBench.txt", "a");
    fprintf(fptr, "\n%s", ctime(&now));
    fprintf(fptr, "Benchmarking for 32 Bit Floating point operations per second\n");

    for (int i = 0; i < 1; i++) {
        flops[i] = 0;
        printf("%d| ", i + 1);
        fprintf(fptr, "%d| ", i + 1);
        for (int r = 0; r < POOL; r++) {
            temp = (i == 0) ? (flopsLog[r][i] / 60) : (flopsLog[r][i] - flopsLog[r][i - 1]) / 60;
            flops[i] += temp;
            singleCoreMax = (temp > singleCoreMax) ? temp : singleCoreMax;
            printf("Tr %d: %llu ", r + 1, temp);
            fprintf(fptr, "Tr %d: %llu ", r + 1, temp);
        }
        printf("FLOPS = %llu\n", flops[i]);
        fprintf(fptr, "FLOPS = %llu\n", flops[i]);
        maxflops = (flops[i] > maxflops) ? flops[i] : maxflops;
    }
    printf("Maximum CPU Throughput: %lf Gigaflops.\n", maxflops / 1000000000.0f);
    printf("Maximum Single Core Throughput: %lf Gigaflops.\n", singleCoreMax / 1000000000.0f);
    fprintf(fptr, "Maximum CPU Throughput: %lf Gigaflops.\n", maxflops / 1000000000.0f);
    fprintf(fptr, "Maximum Single Core Throughput: %lf Gigaflops.\n", singleCoreMax / 1000000000.0f);
    fclose(fptr);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x120, %rsp            # imm = 0x120
movl %edi, -0x4(%rbp)
leaq -0x10(%rbp), %rdi
callq 0x1070
movl -0x4(%rbp), %eax
movq %rsp, %rcx
movq %rcx, -0x18(%rbp)
leaq 0xf(,%rax,8), %rdx
andq $-0x10, %rdx
movq %rsp, %rcx
subq %rdx, %rcx
movq %rcx, -0xb8(%rbp)
movq %rcx, %rsp
movq %rax, -0x20(%rbp)
movl -0x4(%rbp), %eax
movq %rax, %rcx
shlq $0x4, %rcx
leaq (%rcx,%rcx,2), %rdx
movq %rsp, %rcx
subq %rdx, %rcx
movq %rcx, -0xb0(%rbp)
movq %rcx, %rsp
movq %rax, -0x28(%rbp)
movl -0x4(%rbp), %eax
leaq 0xf(,%rax,8), %rdx
andq $-0x10, %rdx
movq %rsp, %rcx
subq %rdx, %rcx
movq %rcx, -0xa8(%rbp)
movq %rcx, %rsp
movq %rax, -0x68(%rbp)
movq $0x0, -0x70(%rbp)
movq $0x0, -0x78(%rbp)
movq $0x0, -0x80(%rbp)
movl $0x0, -0x84(%rbp)
cmpl $0x1, -0x84(%rbp)
jge 0x1426
cmpl $0x0, -0x84(%rbp)
jne 0x13ae
movl $0x0, -0x88(%rbp)
movl -0x88(%rbp), %eax
cmpl -0x4(%rbp), %eax
jge 0x13ac
movq -0xa8(%rbp), %rcx
movq -0xb8(%rbp), %rdi
movq -0xb0(%rbp), %rax
movslq -0x88(%rbp), %rdx
movq $0x0, (%rcx,%rdx,8)
movslq -0x88(%rbp), %rdx
imulq $0x30, %rdx, %rdx
addq %rdx, %rax
movslq -0x84(%rbp), %rdx
movq $0x0, (%rax,%rdx,8)
movslq -0x88(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rdi
movslq -0x88(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rcx
xorl %eax, %eax
movl %eax, %esi
leaq 0x56d(%rip), %rdx       # 0x1900
callq 0x1080
movl -0x88(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x88(%rbp)
jmp 0x131c
jmp 0x13ae
movl $0x3c, %edi
callq 0x10d0
movl $0x0, -0x8c(%rbp)
movl -0x8c(%rbp), %eax
cmpl -0x4(%rbp), %eax
jge 0x1410
movq -0xb0(%rbp), %rax
movq -0xa8(%rbp), %rcx
movslq -0x8c(%rbp), %rdx
movq (%rcx,%rdx,8), %rdx
movslq -0x8c(%rbp), %rcx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movslq -0x84(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movl -0x8c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8c(%rbp)
jmp 0x13c2
jmp 0x1412
movl -0x84(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x84(%rbp)
jmp 0x12f8
movl $0x0, -0x90(%rbp)
movl -0x90(%rbp), %eax
cmpl -0x4(%rbp), %eax
jge 0x1463
movq -0xb8(%rbp), %rax
movslq -0x90(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x10c0
movl -0x90(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x90(%rbp)
jmp 0x1430
leaq 0xc6a(%rip), %rdi       # 0x20d4
leaq 0xc72(%rip), %rsi       # 0x20e3
callq 0x1090
movq %rax, -0x98(%rbp)
movq -0x98(%rbp), %rax
movq %rax, -0xc0(%rbp)
leaq -0x10(%rbp), %rdi
callq 0x1040
movq -0xc0(%rbp), %rdi
movq %rax, %rdx
leaq 0xc40(%rip), %rsi       # 0x20e5
movb $0x0, %al
callq 0x1060
movq -0x98(%rbp), %rdi
leaq 0xbdc(%rip), %rsi       # 0x2096
movb $0x0, %al
callq 0x1060
movl $0x0, -0x9c(%rbp)
cmpl $0x1, -0x9c(%rbp)
jge 0x16ee
movslq -0x9c(%rbp), %rax
movq $0x0, -0x60(%rbp,%rax,8)
movl -0x9c(%rbp), %esi
addl $0x1, %esi
leaq 0xbf1(%rip), %rdi       # 0x20e9
movb $0x0, %al
callq 0x1050
movq -0x98(%rbp), %rdi
movl -0x9c(%rbp), %edx
addl $0x1, %edx
leaq 0xbd3(%rip), %rsi       # 0x20e9
movb $0x0, %al
callq 0x1060
movl $0x0, -0xa0(%rbp)
movl -0xa0(%rbp), %eax
cmpl -0x4(%rbp), %eax
jge 0x1662
cmpl $0x0, -0x9c(%rbp)
jne 0x1572
movq -0xb0(%rbp), %rax
movslq -0xa0(%rbp), %rcx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movslq -0x9c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movl $0x3c, %ecx
xorl %edx, %edx
divq %rcx
movq %rax, -0xc8(%rbp)
jmp 0x15c4
movq -0xb0(%rbp), %rcx
movslq -0xa0(%rbp), %rax
imulq $0x30, %rax, %rdx
movq %rcx, %rax
addq %rdx, %rax
movslq -0x9c(%rbp), %rdx
movq (%rax,%rdx,8), %rax
movslq -0xa0(%rbp), %rdx
imulq $0x30, %rdx, %rdx
addq %rdx, %rcx
movl -0x9c(%rbp), %edx
subl $0x1, %edx
movslq %edx, %rdx
subq (%rcx,%rdx,8), %rax
movl $0x3c, %ecx
xorl %edx, %edx
divq %rcx
movq %rax, -0xc8(%rbp)
movq -0xc8(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x78(%rbp), %rcx
movslq -0x9c(%rbp), %rax
addq -0x60(%rbp,%rax,8), %rcx
movq %rcx, -0x60(%rbp,%rax,8)
movq -0x78(%rbp), %rax
cmpq -0x80(%rbp), %rax
jbe 0x15fb
movq -0x78(%rbp), %rax
movq %rax, -0xd0(%rbp)
jmp 0x1606
movq -0x80(%rbp), %rax
movq %rax, -0xd0(%rbp)
movq -0xd0(%rbp), %rax
movq %rax, -0x80(%rbp)
movl -0xa0(%rbp), %esi
addl $0x1, %esi
movq -0x78(%rbp), %rdx
leaq 0xac9(%rip), %rdi       # 0x20ee
movb $0x0, %al
callq 0x1050
movq -0x98(%rbp), %rdi
movl -0xa0(%rbp), %edx
addl $0x1, %edx
movq -0x78(%rbp), %rcx
leaq 0xaa7(%rip), %rsi       # 0x20ee
movb $0x0, %al
callq 0x1060
movl -0xa0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xa0(%rbp)
jmp 0x1527
movslq -0x9c(%rbp), %rax
movq -0x60(%rbp,%rax,8), %rsi
leaq 0xa86(%rip), %rdi       # 0x20fb
movb $0x0, %al
callq 0x1050
movq -0x98(%rbp), %rdi
movslq -0x9c(%rbp), %rax
movq -0x60(%rbp,%rax,8), %rdx
leaq 0xa65(%rip), %rsi       # 0x20fb
movb $0x0, %al
callq 0x1060
movslq -0x9c(%rbp), %rax
movq -0x60(%rbp,%rax,8), %rax
cmpq -0x70(%rbp), %rax
jbe 0x16c4
movslq -0x9c(%rbp), %rax
movq -0x60(%rbp,%rax,8), %rax
movq %rax, -0xd8(%rbp)
jmp 0x16cf
movq -0x70(%rbp), %rax
movq %rax, -0xd8(%rbp)
movq -0xd8(%rbp), %rax
movq %rax, -0x70(%rbp)
movl -0x9c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x9c(%rbp)
jmp 0x14cb
movq -0x70(%rbp), %rax
movq %rax, %rdx
shrq %rdx
movl %eax, %ecx
andl $0x1, %ecx
orq %rdx, %rcx
cvtsi2ss %rcx, %xmm0
addss %xmm0, %xmm0
cvtsi2ss %rax, %xmm1
movss %xmm1, -0xe0(%rbp)
testq %rax, %rax
movss %xmm0, -0xdc(%rbp)
js 0x1733
movss -0xe0(%rbp), %xmm0
movss %xmm0, -0xdc(%rbp)
movss -0xdc(%rbp), %xmm0
movss 0x8c1(%rip), %xmm1      # 0x2004
movss %xmm1, -0xfc(%rbp)
divss %xmm1, %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x9af(%rip), %rdi       # 0x2109
movq %rdi, -0xf8(%rbp)
movb $0x1, %al
movb %al, -0xe9(%rbp)
callq 0x1050
movq -0x80(%rbp), %rax
movq %rax, %rdx
shrq %rdx
movl %eax, %ecx
andl $0x1, %ecx
orq %rdx, %rcx
cvtsi2ss %rcx, %xmm0
addss %xmm0, %xmm0
cvtsi2ss %rax, %xmm1
movss %xmm1, -0xe8(%rbp)
testq %rax, %rax
movss %xmm0, -0xe4(%rbp)
js 0x17b3
movss -0xe8(%rbp), %xmm0
movss %xmm0, -0xe4(%rbp)
movb -0xe9(%rbp), %al
movss -0xfc(%rbp), %xmm1
movss -0xe4(%rbp), %xmm0
divss %xmm1, %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x959(%rip), %rdi       # 0x2131
callq 0x1050
movq -0x98(%rbp), %rax
movq %rax, -0x110(%rbp)
movq -0x70(%rbp), %rax
movq %rax, %rdx
shrq %rdx
movl %eax, %ecx
andl $0x1, %ecx
orq %rdx, %rcx
cvtsi2ss %rcx, %xmm0
addss %xmm0, %xmm0
cvtsi2ss %rax, %xmm1
movss %xmm1, -0x104(%rbp)
testq %rax, %rax
movss %xmm0, -0x100(%rbp)
js 0x1830
movss -0x104(%rbp), %xmm0
movss %xmm0, -0x100(%rbp)
movb -0xe9(%rbp), %al
movq -0xf8(%rbp), %rsi
movq -0x110(%rbp), %rdi
movss -0xfc(%rbp), %xmm1
movss -0x100(%rbp), %xmm0
divss %xmm1, %xmm0
cvtss2sd %xmm0, %xmm0
callq 0x1060
movq -0x98(%rbp), %rax
movq %rax, -0x120(%rbp)
movq -0x80(%rbp), %rax
movq %rax, %rdx
shrq %rdx
movl %eax, %ecx
andl $0x1, %ecx
orq %rdx, %rcx
cvtsi2ss %rcx, %xmm0
addss %xmm0, %xmm0
cvtsi2ss %rax, %xmm1
movss %xmm1, -0x118(%rbp)
testq %rax, %rax
movss %xmm0, -0x114(%rbp)
js 0x18b4
movss -0x118(%rbp), %xmm0
movss %xmm0, -0x114(%rbp)
movq -0x120(%rbp), %rdi
movss -0x114(%rbp), %xmm0
movss 0x739(%rip), %xmm1      # 0x2004
divss %xmm1, %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x857(%rip), %rsi       # 0x2131
movb $0x1, %al
callq 0x1060
movq -0x98(%rbp), %rdi
callq 0x1030
movq -0x18(%rbp), %rax
movq %rax, %rsp
movq %rbp, %rsp
popq %rbp
retq
nopl (%rax)