#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*/ convert(double *, double *, int);
int /*<<< orphan*/ printf(char *, int, double);
int main() {
  int i;
  double a[4] = {0.0};
  double b[4] = {2.0, 4.0, -3.0, 2};
  convert(a, b, 4);
  for (i = 0; i < 4; i++)
    printf("%d %g\n", i, a[i]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1050 <memset@plt>
mov    0xeaa(%rip),%rax
mov    %rax,-0x50(%rbp)
mov    0xea7(%rip),%rax
mov    %rax,-0x48(%rbp)
mov    0xea4(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0xea1(%rip),%rax
mov    %rax,-0x38(%rbp)
lea    -0x30(%rbp),%rdi
lea    -0x50(%rbp),%rsi
mov    $0x4,%edx
call   1030 <convert@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x4,-0x8(%rbp)
jge    11c5 <main+0x95>
mov    -0x8(%rbp),%esi
movslq -0x8(%rbp),%rax
movsd  -0x30(%rbp,%rax,8),%xmm0
lea    0xe6e(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1194 <main+0x64>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x40,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
movaps 0xed8(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xebc(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
mov    %rsp,%rdi
lea    0x20(%rsp),%rsi
mov    $0x4,%edx
call   1030 <convert@plt>
movsd  (%rsp),%xmm0
lea    0xeb9(%rip),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
call   1040 <printf@plt>
movsd  0x8(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x1,%esi
call   1040 <printf@plt>
movsd  0x10(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x2,%esi
call   1040 <printf@plt>
movsd  0x18(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x3,%esi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.b = [4 x double] [double 2.000000e+00, double 4.000000e+00, double -3.000000e+00, double 2.000000e+00]
@.str = [7 x i8] c"%d %g\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [4 x double]
%4 = alloca [4 x double]
store i32 0, i32* %1
%5 = bitcast [4 x double]* %3 to i8*
%6 = bitcast [4 x double]* %4 to i8*
%7 = getelementptr inbounds [4 x double], [4 x double]* %3, i64 0, i64 0
%8 = getelementptr inbounds [4 x double], [4 x double]* %4, i64 0, i64 0
%9 = call i32 @convert(double* %7, double* %8, i32 4)
store i32 0, i32* %2
br label %10
10: ; preds = %20, %0
%11 = load i32, i32* %2
%12 = icmp slt i32 %11, 4
br i1 %12, label %13, label %23
13: ; preds = %10
%14 = load i32, i32* %2
%15 = load i32, i32* %2
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [4 x double], [4 x double]* %3, i64 0, i64 %16
%18 = load double, double* %17
%19 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %14, double %18)
br label %20
20: ; preds = %13
%21 = load i32, i32* %2
%22 = add nsw i32 %21, 1
store i32 %22, i32* %2
br label %10
23: ; preds = %10
ret i32 0
}

LLVM IR (-O2):
@__const.main.b = [4 x double] [double 2.000000e+00, double 4.000000e+00, double -3.000000e+00, double 2.000000e+00]
@.str = [7 x i8] c"%d %g\0A\00"
define i32 @main() {
%1 = alloca [4 x double]
%2 = alloca [4 x double]
%3 = bitcast [4 x double]* %1 to i8*
%4 = bitcast [4 x double]* %2 to i8*
%5 = getelementptr inbounds [4 x double], [4 x double]* %1, i64 0, i64 0
%6 = getelementptr inbounds [4 x double], [4 x double]* %2, i64 0, i64 0
%7 = call i32 @convert(double* %5, double* %6, i32 4)
%8 = load double, double* %5
%9 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 0, double %8)
%10 = getelementptr inbounds [4 x double], [4 x double]* %1, i64 0, i64 1
%11 = load double, double* %10
%12 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 1, double %11)
%13 = getelementptr inbounds [4 x double], [4 x double]* %1, i64 0, i64 2
%14 = load double, double* %13
%15 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 2, double %14)
%16 = getelementptr inbounds [4 x double], [4 x double]* %1, i64 0, i64 3
%17 = load double, double* %16
%18 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 3, double %17)
ret i32 0
}