#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);
double sin(double);
int main() {
  double nums[10];
  double *num;
  int i;
  for (i = 0; i < 10; ++i) {
    num = &nums[i];
    *num = sin((double)i);
  }
  for (i = 0; i < 10; ++i)
    printf("nums[%d] = %lf\n", i, nums[i]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x6c(%rbp)
cmpl   $0xa,-0x6c(%rbp)
jge    1173 <main+0x53>
movslq -0x6c(%rbp),%rcx
lea    -0x60(%rbp),%rax
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x68(%rbp)
cvtsi2sdl -0x6c(%rbp),%xmm0
call   1040 <sin@plt>
mov    -0x68(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x6c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x6c(%rbp)
jmp    1136 <main+0x16>
movl   $0x0,-0x6c(%rbp)
cmpl   $0xa,-0x6c(%rbp)
jge    11ab <main+0x8b>
mov    -0x6c(%rbp),%esi
movslq -0x6c(%rbp),%rax
movsd  -0x60(%rbp,%rax,8),%xmm0
lea    0xe68(%rip),%rdi
call   1030 <printf@plt>
mov    -0x6c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x6c(%rbp)
jmp    117a <main+0x5a>
xor    %eax,%eax
add    $0x70,%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"nums[%d] = %lf\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x double]
%3 = alloca double*
%4 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %4
br label %5
5: ; preds = %16, %0
%6 = load i32, i32* %4
%7 = icmp slt i32 %6, 10
br i1 %7, label %8, label %19
8: ; preds = %5
%9 = load i32, i32* %4
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds [10 x double], [10 x double]* %2, i64 0, i64 %10
store double* %11, double** %3
%12 = load i32, i32* %4
%13 = sitofp i32 %12 to double
%14 = call double @sin(double %13)
%15 = load double*, double** %3
store double %14, double* %15
br label %16
16: ; preds = %8
%17 = load i32, i32* %4
%18 = add nsw i32 %17, 1
store i32 %18, i32* %4
br label %5
19: ; preds = %5
store i32 0, i32* %4
br label %20
20: ; preds = %30, %19
%21 = load i32, i32* %4
%22 = icmp slt i32 %21, 10
br i1 %22, label %23, label %33
23: ; preds = %20
%24 = load i32, i32* %4
%25 = load i32, i32* %4
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [10 x double], [10 x double]* %2, i64 0, i64 %26
%28 = load double, double* %27
%29 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %24, double %28)
br label %30
30: ; preds = %23
%31 = load i32, i32* %4
%32 = add nsw i32 %31, 1
store i32 %32, i32* %4
br label %20
33: ; preds = %20
ret i32 0
}

LLVM IR (-O2):
@.str = [16 x i8] c"nums[%d] = %lf\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 0x3FEAED548F090CEE)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 2, double 0x3FED18F6EAD1B446)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 3, double 0x3FC210386DB6D55B)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 4, double 0xBFE837B9DDDC1EAE)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 5, double 0xBFEEAF81F5E09933)
%7 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 6, double 0xBFD1E1F18AB0A2C0)
%8 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 7, double 0x3FE50608C26D0A08)
%9 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 8, double 0x3FEFA8D2A028CF7B)
%10 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 9, double 0x3FDA6026360C2F91)
ret i32 0
}