#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 *, ...);
void test_doublearr(int len) {
  double arr[len];
  unsigned int *iarr = (unsigned int *)&arr;
  int i;
  arr[0] = 2.5;
  for (i = 1; i < len; i++) {
    arr[i] = (arr[i - 1] * arr[i - 1] + arr[0]) / 1.25 - 0.19;
  }
  printf("arr: ");
  for (i = 0; i < len; i++) {
    printf("%08X", *iarr++);
    printf("%08X ", *iarr++);
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<test_doublearr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,%ecx
mov    %rsp,%rax
mov    %rax,-0x10(%rbp)
lea    0xf(,%rcx,8),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rax
sub    %rdx,%rax
mov    %rax,-0x30(%rbp)
mov    %rax,%rsp
mov    %rcx,-0x18(%rbp)
mov    %rax,%rcx
mov    %rcx,-0x20(%rbp)
movsd  0xead(%rip),%xmm0
movsd  %xmm0,(%rax)
movl   $0x1,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11c5 <test_doublearr+0xb5>
mov    -0x30(%rbp),%rax
mov    -0x24(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x24(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
movsd  (%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xe72(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0xe5e(%rip),%xmm1
subsd  %xmm1,%xmm0
movslq -0x24(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    115e <test_doublearr+0x4e>
lea    0xe4c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1232 <test_doublearr+0x122>
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0x4,%rcx
mov    %rcx,-0x20(%rbp)
mov    (%rax),%esi
lea    0xe20(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0x4,%rcx
mov    %rcx,-0x20(%rbp)
mov    (%rax),%esi
lea    0xe06(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11da <test_doublearr+0xca>
lea    0xdf0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_doublearr>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %edi,%r14d
mov    %edi,%r15d
mov    %rsp,%rax
lea    0xf(,%r15,8),%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rax,%r13
sub    %rcx,%r13
mov    %r13,%rsp
neg    %rcx
movabs $0x4004000000000000,%rdx
mov    %rdx,(%rax,%rcx,1)
cmp    $0x2,%edi
jl     1218 <test_doublearr+0xf8>
lea    -0x1(%r15),%rcx
cmp    $0x2,%r14d
jne    117f <test_doublearr+0x5f>
mov    $0x1,%eax
movsd  0xe83(%rip),%xmm0
jmp    11f0 <test_doublearr+0xd0>
mov    %rcx,%rdx
and    $0xfffffffffffffffe,%rdx
neg    %rdx
mov    $0x1,%eax
movsd  0xe6a(%rip),%xmm1
movsd  0xe6a(%rip),%xmm2
movsd  0xe6a(%rip),%xmm3
movapd %xmm1,%xmm0
nopw   0x0(%rax,%rax,1)
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
divsd  %xmm2,%xmm0
addsd  %xmm3,%xmm0
movsd  %xmm0,0x0(%r13,%rax,8)
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
divsd  %xmm2,%xmm0
addsd  %xmm3,%xmm0
movsd  %xmm0,0x8(%r13,%rax,8)
lea    (%rdx,%rax,1),%rsi
add    $0x2,%rsi
add    $0x2,%rax
cmp    $0x1,%rsi
jne    11b0 <test_doublearr+0x90>
test   $0x1,%cl
je     1218 <test_doublearr+0xf8>
mulsd  %xmm0,%xmm0
addsd  0xdff(%rip),%xmm0
divsd  0xdff(%rip),%xmm0
addsd  0xdff(%rip),%xmm0
movsd  %xmm0,0x0(%r13,%rax,8)
lea    0xdf9(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
test   %r14d,%r14d
jle    1297 <test_doublearr+0x177>
lea    0xdec(%rip),%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x4(%r13),%esi
lea    0xddd(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    $0x1,%r14d
je     1297 <test_doublearr+0x177>
mov    $0x1,%ebx
lea    0xdbf(%rip),%r14
lea    0xdbd(%rip),%r12
cs nopw 0x0(%rax,%rax,1)
mov    0x0(%r13,%rbx,8),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x4(%r13,%rbx,8),%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %ebx,%r15d
jne    1270 <test_doublearr+0x150>
mov    $0xa,%edi
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"arr: \00"
@.str.1 = [5 x i8] c"%08X\00"
@.str.2 = [6 x i8] c"%08X \00"
@.str.3 = [2 x i8] c"\0A\00"
define void @test_doublearr(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i32*
%6 = alloca i32
store i32 %0, i32* %2
%7 = load i32, i32* %2
%8 = zext i32 %7 to i64
%9 = call i8* @llvm.stacksave()
store i8* %9, i8** %3
%10 = alloca double, i64 %8
store i64 %8, i64* %4
%11 = bitcast double* %10 to i32*
store i32* %11, i32** %5
%12 = getelementptr inbounds double, double* %10, i64 0
store double 2.500000e+00, double* %12
store i32 1, i32* %6
br label %13
13: ; preds = %36, %1
%14 = load i32, i32* %6
%15 = load i32, i32* %2
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %39
17: ; preds = %13
%18 = load i32, i32* %6
%19 = sub nsw i32 %18, 1
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds double, double* %10, i64 %20
%22 = load double, double* %21
%23 = load i32, i32* %6
%24 = sub nsw i32 %23, 1
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds double, double* %10, i64 %25
%27 = load double, double* %26
%28 = getelementptr inbounds double, double* %10, i64 0
%29 = load double, double* %28
%30 = call double @llvm.fmuladd.f64(double %22, double %27, double %29)
%31 = fdiv double %30, 1.250000e+00
%32 = fsub double %31, 1.900000e-01
%33 = load i32, i32* %6
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds double, double* %10, i64 %34
store double %32, double* %35
br label %36
36: ; preds = %17
%37 = load i32, i32* %6
%38 = add nsw i32 %37, 1
store i32 %38, i32* %6
br label %13
39: ; preds = %13
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %6
br label %41
41: ; preds = %54, %39
%42 = load i32, i32* %6
%43 = load i32, i32* %2
%44 = icmp slt i32 %42, %43
br i1 %44, label %45, label %57
45: ; preds = %41
%46 = load i32*, i32** %5
%47 = getelementptr inbounds i32, i32* %46, i32 1
store i32* %47, i32** %5
%48 = load i32, i32* %46
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %48)
%50 = load i32*, i32** %5
%51 = getelementptr inbounds i32, i32* %50, i32 1
store i32* %51, i32** %5
%52 = load i32, i32* %50
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %52)
br label %54
54: ; preds = %45
%55 = load i32, i32* %6
%56 = add nsw i32 %55, 1
store i32 %56, i32* %6
br label %41
57: ; preds = %41
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%59 = load i8*, i8** %3
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"arr: \00"
@.str.1 = [5 x i8] c"%08X\00"
@.str.2 = [6 x i8] c"%08X \00"
define void @test_doublearr(i32 %0) {
%2 = zext i32 %0 to i64
%3 = alloca double, i64 %2
%4 = bitcast double* %3 to i32*
store double 2.500000e+00, double* %3
%5 = icmp sgt i32 %0, 1
br i1 %5, label %6, label %37
6: ; preds = %1
%7 = add nsw i64 %2, -1
%8 = and i64 %7, 1
%9 = icmp eq i32 %0, 2
br i1 %9, label %28, label %10
10: ; preds = %6
%11 = and i64 %7, -2
br label %12
12: ; preds = %12, %10
%13 = phi double [ 2.500000e+00, %10 ], [ %23, %12 ]
%14 = phi i64 [ 1, %10 ], [ %25, %12 ]
%15 = phi i64 [ 0, %10 ], [ %26, %12 ]
%16 = tail call double @llvm.fmuladd.f64(double %13, double %13, double 2.500000e+00)
%17 = fdiv double %16, 1.250000e+00
%18 = fadd double %17, -1.900000e-01
%19 = getelementptr inbounds double, double* %3, i64 %14
store double %18, double* %19
%20 = add nuw nsw i64 %14, 1
%21 = tail call double @llvm.fmuladd.f64(double %18, double %18, double 2.500000e+00)
%22 = fdiv double %21, 1.250000e+00
%23 = fadd double %22, -1.900000e-01
%24 = getelementptr inbounds double, double* %3, i64 %20
store double %23, double* %24
%25 = add nuw nsw i64 %14, 2
%26 = add i64 %15, 2
%27 = icmp eq i64 %26, %11
br i1 %27, label %28, label %12
28: ; preds = %12, %6
%29 = phi double [ 2.500000e+00, %6 ], [ %23, %12 ]
%30 = phi i64 [ 1, %6 ], [ %25, %12 ]
%31 = icmp eq i64 %8, 0
br i1 %31, label %37, label %32
32: ; preds = %28
%33 = tail call double @llvm.fmuladd.f64(double %29, double %29, double 2.500000e+00)
%34 = fdiv double %33, 1.250000e+00
%35 = fadd double %34, -1.900000e-01
%36 = getelementptr inbounds double, double* %3, i64 %30
store double %35, double* %36
br label %37
37: ; preds = %32, %28, %1
%38 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%39 = icmp sgt i32 %0, 0
br i1 %39, label %40, label %60
40: ; preds = %37
%41 = getelementptr inbounds i32, i32* %4, i64 1
%42 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 0)
%43 = load i32, i32* %41
%44 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %43)
%45 = icmp eq i32 %0, 1
br i1 %45, label %60, label %46
46: ; preds = %40
%47 = getelementptr inbounds double, double* %3, i64 1
%48 = bitcast double* %47 to i32*
br label %49
49: ; preds = %46, %49
%50 = phi i32 [ 1, %46 ], [ %58, %49 ]
%51 = phi i32* [ %48, %46 ], [ %55, %49 ]
%52 = load i32, i32* %51
%53 = getelementptr inbounds i32, i32* %51, i64 1
%54 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %52)
%55 = getelementptr inbounds i32, i32* %51, i64 2
%56 = load i32, i32* %53
%57 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %56)
%58 = add nuw nsw i32 %50, 1
%59 = icmp eq i32 %58, %0
br i1 %59, label %60, label %49
60: ; preds = %49, %40, %37
%61 = tail call i32 @putchar(i32 10)
ret void
}