#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 */
typedef int /*<<< orphan*/ time_t;
struct tm {
  int dummy;
};

/* Variables and functions */
char *asctime(struct tm *);
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ sqrt(double);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main() {
  unsigned long int i;
  double x;
  double z;
  time_t time_raw_format;
  struct tm *loctim;
  for (i = 1; i < 100000000; i++) {
    x = (double)3.0 * i;
    z = (double)sqrt(x);
    x = (double)x / i;
    time(&time_raw_format);
  }
  loctim = localtime(&time_raw_format);
  printf("i=%d x=%f z=%f\n", i, x, z);
  printf("time=%s\n", asctime(loctim));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x1,-0x10(%rbp)
cmpq   $0x5f5e100,-0x10(%rbp)
05
jae    1211 <main+0xc1>
movq   -0x10(%rbp),%xmm0
movaps 0xe7f(%rip),%xmm1
movaps %xmm1,-0x50(%rbp)
punpckldq %xmm1,%xmm0
movapd 0xe7f(%rip),%xmm1
movaps %xmm1,-0x40(%rbp)
subpd  %xmm1,%xmm0
movaps %xmm0,%xmm1
unpckhpd %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  0xe74(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1070 <sqrt@plt>
movaps -0x50(%rbp),%xmm3
movaps -0x40(%rbp),%xmm2
cvtsi2sd %rax,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
movq   -0x10(%rbp),%xmm1
punpckldq %xmm3,%xmm1
subpd  %xmm2,%xmm1
movaps %xmm1,%xmm2
unpckhpd %xmm1,%xmm1
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
lea    -0x24(%rbp),%rdi
call   1060 <time@plt>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1167 <main+0x17>
lea    -0x24(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rsi
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
lea    0xdf5(%rip),%rdi
mov    $0x2,%al
call   1050 <printf@plt>
mov    -0x30(%rbp),%rdi
call   1040 <asctime@plt>
mov    %rax,%rsi
lea    0xdeb(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x40,%rsp
mov    $0x1,%ebx
lea    0xc(%rsp),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movq   %rbx,%xmm0
punpckldq 0xe83(%rip),%xmm0
subpd  0xe8b(%rip),%xmm0
movapd %xmm0,%xmm1
unpckhpd %xmm0,%xmm1
addsd  %xmm0,%xmm1
movapd %xmm1,0x30(%rsp)
movapd %xmm1,%xmm0
mulsd  0xe7d(%rip),%xmm0
movapd %xmm0,0x10(%rsp)
call   1070 <sqrt@plt>
mov    %rax,%r15
mov    %r14,%rdi
call   1060 <time@plt>
add    $0x1,%rbx
cmp    $0x5f5e100,%rbx
jne    1170 <main+0x20>
xorps  %xmm0,%xmm0
cvtsi2sd %r15,%xmm0
movsd  %xmm0,0x28(%rsp)
movapd 0x10(%rsp),%xmm0
divsd  0x30(%rsp),%xmm0
movapd %xmm0,0x10(%rsp)
lea    0xc(%rsp),%rdi
call   1030 <localtime@plt>
mov    %rax,%rbx
lea    0xe2e(%rip),%rdi
mov    $0x5f5e100,%esi
movaps 0x10(%rsp),%xmm0
movsd  0x28(%rsp),%xmm1
mov    $0x2,%al
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1040 <asctime@plt>
lea    0xe18(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
@.str = [16 x i8] c"i=%d x=%f z=%f\0A\00"
@.str.1 = [9 x i8] c"time=%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca double
%4 = alloca double
%5 = alloca i32
%6 = alloca %struct.tm*
store i32 0, i32* %1
store i64 1, i64* %2
br label %7
7: ; preds = %22, %0
%8 = load i64, i64* %2
%9 = icmp ult i64 %8, 100000000
br i1 %9, label %10, label %25
10: ; preds = %7
%11 = load i64, i64* %2
%12 = uitofp i64 %11 to double
%13 = fmul double 3.000000e+00, %12
store double %13, double* %3
%14 = load double, double* %3
%15 = call i64 @sqrt(double %14)
%16 = sitofp i64 %15 to double
store double %16, double* %4
%17 = load double, double* %3
%18 = load i64, i64* %2
%19 = uitofp i64 %18 to double
%20 = fdiv double %17, %19
store double %20, double* %3
%21 = call i32 @time(i32* %5)
br label %22
22: ; preds = %10
%23 = load i64, i64* %2
%24 = add i64 %23, 1
store i64 %24, i64* %2
br label %7
25: ; preds = %7
%26 = call %struct.tm* @localtime(i32* %5)
store %struct.tm* %26, %struct.tm** %6
%27 = load i64, i64* %2
%28 = load double, double* %3
%29 = load double, double* %4
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i64 %27, double %28, double %29)
%31 = load %struct.tm*, %struct.tm** %6
%32 = call i8* @asctime(%struct.tm* %31)
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* %32)
ret i32 0
}

LLVM IR (-O2):
%struct.tm = type { i32 }
@.str = [16 x i8] c"i=%d x=%f z=%f\0A\00"
@.str.1 = [9 x i8] c"time=%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
br label %3
3: ; preds = %0, %3
%4 = phi i64 [ 1, %0 ], [ %9, %3 ]
%5 = uitofp i64 %4 to double
%6 = fmul double %5, 3.000000e+00
%7 = call i64 @sqrt(double %6)
%8 = call i32 @time(i32* %1)
%9 = add nuw nsw i64 %4, 1
%10 = icmp eq i64 %9, 100000000
br i1 %10, label %11, label %3
11: ; preds = %3
%12 = sitofp i64 %7 to double
%13 = fdiv double %6, %5
%14 = call %struct.tm* @localtime(i32* %1)
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i64 100000000, double %13, double %12)
%16 = call i8* @asctime(%struct.tm* %14)
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* %16)
ret i32 0
}