#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, double);
int main(void) {
  int i;
  double x;
  for (i = 0; i < 10; i++) {
    x = (double)i;
    printf("i = %d, x = %f\n", i, x);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    115c <main+0x4c>
cvtsi2sdl -0x8(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    -0x8(%rbp),%esi
movsd  -0x10(%rbp),%xmm0
lea    0xeb7(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1126 <main+0x16>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xf30(%rip),%rbx
xorps  %xmm0,%xmm0
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <printf@plt>
movsd  0xed3(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x1,%esi
call   1030 <printf@plt>
movsd  0xec6(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x2,%esi
call   1030 <printf@plt>
movsd  0xeb9(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x3,%esi
call   1030 <printf@plt>
movsd  0xeac(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x4,%esi
call   1030 <printf@plt>
movsd  0xe9f(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x5,%esi
call   1030 <printf@plt>
movsd  0xe92(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x6,%esi
call   1030 <printf@plt>
movsd  0xe85(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x7,%esi
call   1030 <printf@plt>
movsd  0xe78(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x8,%esi
call   1030 <printf@plt>
movsd  0xe6b(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x9,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [16 x i8] c"i = %d, x = %f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca double
store i32 0, i32* %1
store i32 0, i32* %2
br label %4
4: ; preds = %13, %0
%5 = load i32, i32* %2
%6 = icmp slt i32 %5, 10
br i1 %6, label %7, label %16
7: ; preds = %4
%8 = load i32, i32* %2
%9 = sitofp i32 %8 to double
store double %9, double* %3
%10 = load i32, i32* %2
%11 = load double, double* %3
%12 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %10, double %11)
br label %13
13: ; preds = %7
%14 = load i32, i32* %2
%15 = add nsw i32 %14, 1
store i32 %15, i32* %2
br label %4
16: ; preds = %4
ret i32 0
}

LLVM IR (-O2):
@.str = [16 x i8] c"i = %d, x = %f\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 0, double 0.000000e+00)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 1, double 1.000000e+00)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 2, double 2.000000e+00)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 3, double 3.000000e+00)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 4, double 4.000000e+00)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 5, double 5.000000e+00)
%7 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 6, double 6.000000e+00)
%8 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 7, double 7.000000e+00)
%9 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 8, double 8.000000e+00)
%10 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 9, double 9.000000e+00)
ret i32 0
}