#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*/ init_arr(float *, int *);
int /*<<< orphan*/ printf(char *, long, int, float);
int /*<<< orphan*/ test(int);
int main(void) {
  int j;
  long i;
  float arr[2];
  init_arr(arr, &j);
  test(j);
  for (i = 0; i < j; i++) {
    printf("%ld %d: %.6e\n", i, j, arr[i]);
  }
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x18(%rbp),%rdi
lea    -0x8(%rbp),%rsi
call   1030 <init_arr@plt>
mov    -0x8(%rbp),%edi
call   1050 <test@plt>
movq   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x8(%rbp),%rcx
cmp    %rcx,%rax
jge    119b <main+0x6b>
mov    -0x10(%rbp),%rsi
mov    -0x8(%rbp),%edx
mov    -0x10(%rbp),%rax
movss  -0x18(%rbp,%rax,4),%xmm0
lea    0xe7b(%rip),%rdi
call   1040 <printf@plt>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    115c <main+0x2c>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
lea    0x10(%rsp),%rdi
lea    0xc(%rsp),%rsi
call   1030 <init_arr@plt>
mov    0xc(%rsp),%edi
call   1050 <test@plt>
mov    0xc(%rsp),%edx
test   %edx,%edx
jle    117f <main+0x4f>
xor    %ebx,%ebx
lea    0xea0(%rip),%r14
movss  0x10(%rsp,%rbx,4),%xmm0
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
add    $0x1,%rbx
movslq 0xc(%rsp),%rdx
cmp    %rdx,%rbx
jl     1160 <main+0x30>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [14 x i8] c"%ld %d: %.6e\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [2 x float]
%3 = bitcast i32* %1 to i8*
%4 = bitcast [2 x float]* %2 to i8*
%5 = getelementptr inbounds [2 x float], [2 x float]* %2, i64 0, i64 0
%6 = call i32 @init_arr(float* %5, i32* %1)
%7 = load i32, i32* %1
%8 = call i32 @test(i32 %7)
%9 = load i32, i32* %1
%10 = icmp sgt i32 %9, 0
br i1 %10, label %11, label %21
11: ; preds = %0, %11
%12 = phi i32 [ %18, %11 ], [ %9, %0 ]
%13 = phi i64 [ %17, %11 ], [ 0, %0 ]
%14 = getelementptr inbounds [2 x float], [2 x float]* %2, i64 0, i64 %13
%15 = load float, float* %14
%16 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i64 %13, i32 %12, float %15)
%17 = add nuw nsw i64 %13, 1
%18 = load i32, i32* %1
%19 = sext i32 %18 to i64
%20 = icmp slt i64 %17, %19
br i1 %20, label %11, label %21
21: ; preds = %11, %0
ret i32 0
}