#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int rand();
int main(void) {
  printf("Start of test\n");
  long double a = 0;
  int i = rand();
  for (int c = 0; c < 10000; c++) {
    a = i * i;
    printf("%f", a);
  }
  printf("End of test\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
fldz
fstpt  -0x20(%rbp)
mov    $0x0,%al
call   1040 <rand@plt>
mov    %eax,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
cmpl   $0x2710,-0x28(%rbp)
jge    1193 <main+0x73>
mov    -0x24(%rbp),%eax
imul   %eax,%eax
mov    %eax,-0x2c(%rbp)
fildl  -0x2c(%rbp)
fstpt  -0x20(%rbp)
fldt   -0x20(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
lea    0xe91(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1153 <main+0x33>
lea    0xe78(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
sub    $0x28,%rsp
lea    0xec6(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1050 <rand@plt>
imul   %eax,%eax
mov    %eax,0x18(%rsp)
mov    $0x2710,%ebp
fildl  0x18(%rsp)
fstpt  0x1c(%rsp)
lea    0xe9c(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
fldt   0x1c(%rsp)
fstpt  (%rsp)
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0xffffffff,%ebp
jne    1170 <main+0x40>
lea    0xe84(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [15 x i8] c"Start of test\0A\00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [13 x i8] c"End of test\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca x86_fp80
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
store x86_fp80 0xK00000000000000000000, x86_fp80* %2
%6 = call i32 (...) @rand()
store i32 %6, i32* %3
store i32 0, i32* %4
br label %7
7: ; preds = %17, %0
%8 = load i32, i32* %4
%9 = icmp slt i32 %8, 10000
br i1 %9, label %10, label %20
10: ; preds = %7
%11 = load i32, i32* %3
%12 = load i32, i32* %3
%13 = mul nsw i32 %11, %12
%14 = sitofp i32 %13 to x86_fp80
store x86_fp80 %14, x86_fp80* %2
%15 = load x86_fp80, x86_fp80* %2
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), x86_fp80 %15)
br label %17
17: ; preds = %10
%18 = load i32, i32* %4
%19 = add nsw i32 %18, 1
store i32 %19, i32* %4
br label %7
20: ; preds = %7
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%f\00"
@str = [14 x i8] c"Start of test\00"
@str.3 = [12 x i8] c"End of test\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (...) @rand()
%3 = mul nsw i32 %2, %2
%4 = sitofp i32 %3 to x86_fp80
br label %7
5: ; preds = %7
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.3, i64 0, i64 0))
ret i32 0
7: ; preds = %0, %7
%8 = phi i32 [ 0, %0 ], [ %10, %7 ]
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), x86_fp80 %4)
%10 = add nuw nsw i32 %8, 1
%11 = icmp eq i32 %10, 10000
br i1 %11, label %5, label %7
}