void init_array(int n, double *A_re, double *A_im) {
  int NumPoints, i;
  NumPoints = 0;
  for (i = 0; i < n; i++) {
    if (i == 1) {
      A_re[i] = 1.0;
      A_im[i] = 0.0;
    } else {
      A_re[i] = 0.0;
      A_im[i] = 0.0;
    }
  }
}


x86 assembly (clang, -O0):
<init_array>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1190 <init_array+0x90>
cmpl   $0x1,-0x20(%rbp)
jne    115d <init_array+0x5d>
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsd  0xebd(%rip),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
jmp    117d <init_array+0x7d>
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
jmp    1182 <init_array+0x82>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    111d <init_array+0x1d>
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_array>:
test   %edi,%edi
jle    12df <init_array+0x1df>
movq   $0x0,(%rsi)
movq   $0x0,(%rdx)
cmp    $0x1,%edi
je     12df <init_array+0x1df>
movabs $0x3ff0000000000000,%rax
mov    %rax,0x8(%rsi)
movq   $0x0,0x8(%rdx)
cmp    $0x2,%edi
je     12df <init_array+0x1df>
mov    %edi,%r9d
lea    -0x2(%r9),%r8
mov    $0x2,%ecx
cmp    $0x4,%r8
jb     1255 <init_array+0x155>
lea    0x10(%rsi),%rax
lea    (%rdx,%r9,8),%rdi
cmp    %rdi,%rax
jae    1172 <init_array+0x72>
lea    (%rsi,%r9,8),%rax
lea    0x10(%rdx),%rdi
cmp    %rax,%rdi
jb     1255 <init_array+0x155>
mov    %r8,%rcx
and    $0xfffffffffffffffc,%rcx
lea    -0x4(%rcx),%rax
mov    %rax,%rdi
shr    $0x2,%rdi
add    $0x1,%rdi
mov    %edi,%r10d
and    $0x3,%r10d
cmp    $0xc,%rax
jae    1199 <init_array+0x99>
xor    %eax,%eax
jmp    1210 <init_array+0x110>
and    $0xfffffffffffffffc,%rdi
xor    %eax,%eax
xorps  %xmm0,%xmm0
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movups %xmm0,0x10(%rsi,%rax,8)
movups %xmm0,0x20(%rsi,%rax,8)
movups %xmm0,0x10(%rdx,%rax,8)
movups %xmm0,0x20(%rdx,%rax,8)
movups %xmm0,0x30(%rsi,%rax,8)
movups %xmm0,0x40(%rsi,%rax,8)
movups %xmm0,0x30(%rdx,%rax,8)
movups %xmm0,0x40(%rdx,%rax,8)
movups %xmm0,0x50(%rsi,%rax,8)
movups %xmm0,0x60(%rsi,%rax,8)
movups %xmm0,0x50(%rdx,%rax,8)
movups %xmm0,0x60(%rdx,%rax,8)
movups %xmm0,0x70(%rsi,%rax,8)
movups %xmm0,0x80(%rsi,%rax,8)
movups %xmm0,0x70(%rdx,%rax,8)
movups %xmm0,0x80(%rdx,%rax,8)
add    $0x10,%rax
add    $0xfffffffffffffffc,%rdi
jne    11b0 <init_array+0xb0>
test   %r10,%r10
je     1248 <init_array+0x148>
xorps  %xmm0,%xmm0
nopl   0x0(%rax,%rax,1)
lea    0x0(,%rax,8),%rdi
or     $0x10,%rdi
movups %xmm0,(%rsi,%rdi,1)
movups %xmm0,0x10(%rsi,%rdi,1)
movups %xmm0,(%rdx,%rdi,1)
movups %xmm0,0x10(%rdx,%rdi,1)
add    $0x4,%rax
add    $0xffffffffffffffff,%r10
jne    1220 <init_array+0x120>
cmp    %rcx,%r8
je     12df <init_array+0x1df>
or     $0x2,%rcx
mov    %r9d,%edi
sub    %ecx,%edi
mov    %rcx,%rax
not    %rax
add    %r9,%rax
and    $0x3,%rdi
je     128a <init_array+0x18a>
nopl   0x0(%rax)
movq   $0x0,(%rsi,%rcx,8)
movq   $0x0,(%rdx,%rcx,8)
add    $0x1,%rcx
add    $0xffffffffffffffff,%rdi
jne    1270 <init_array+0x170>
cmp    $0x3,%rax
jb     12df <init_array+0x1df>
movq   $0x0,(%rsi,%rcx,8)
movq   $0x0,(%rdx,%rcx,8)
movq   $0x0,0x8(%rsi,%rcx,8)
movq   $0x0,0x8(%rdx,%rcx,8)
movq   $0x0,0x10(%rsi,%rcx,8)
movq   $0x0,0x10(%rdx,%rcx,8)
movq   $0x0,0x18(%rsi,%rcx,8)
movq   $0x0,0x18(%rdx,%rcx,8)
add    $0x4,%rcx
cmp    %rcx,%r9
jne    1290 <init_array+0x190>
ret

LLVM IR (-O0):
define void @init_array(i32 %0, double* %1, double* %2) {
%4 = alloca i32
%5 = alloca double*
%6 = alloca double*
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %4
store double* %1, double** %5
store double* %2, double** %6
store i32 0, i32* %7
store i32 0, i32* %8
br label %9
9: ; preds = %35, %3
%10 = load i32, i32* %8
%11 = load i32, i32* %4
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %38
13: ; preds = %9
%14 = load i32, i32* %8
%15 = icmp eq i32 %14, 1
br i1 %15, label %16, label %25
16: ; preds = %13
%17 = load double*, double** %5
%18 = load i32, i32* %8
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds double, double* %17, i64 %19
store double 1.000000e+00, double* %20
%21 = load double*, double** %6
%22 = load i32, i32* %8
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds double, double* %21, i64 %23
store double 0.000000e+00, double* %24
br label %34
25: ; preds = %13
%26 = load double*, double** %5
%27 = load i32, i32* %8
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds double, double* %26, i64 %28
store double 0.000000e+00, double* %29
%30 = load double*, double** %6
%31 = load i32, i32* %8
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds double, double* %30, i64 %32
store double 0.000000e+00, double* %33
br label %34
34: ; preds = %25, %16
br label %35
35: ; preds = %34
%36 = load i32, i32* %8
%37 = add nsw i32 %36, 1
store i32 %37, i32* %8
br label %9
38: ; preds = %9
ret void
}

LLVM IR (-O2):
define void @init_array(i32 %0, double* nocapture writeonly %1, double* nocapture writeonly %2) {
%4 = icmp sgt i32 %0, 0
br i1 %4, label %5, label %128
5: ; preds = %3
%6 = zext i32 %0 to i64
store double 0.000000e+00, double* %1
store double 0.000000e+00, double* %2
%7 = icmp eq i32 %0, 1
br i1 %7, label %128, label %8
8: ; preds = %5
%9 = getelementptr inbounds double, double* %2, i64 1
%10 = getelementptr inbounds double, double* %1, i64 1
store double 1.000000e+00, double* %10
store double 0.000000e+00, double* %9
%11 = icmp eq i32 %0, 2
br i1 %11, label %128, label %12
12: ; preds = %8
%13 = add nsw i64 %6, -2
%14 = icmp ult i64 %13, 4
br i1 %14, label %95, label %15
15: ; preds = %12
%16 = getelementptr double, double* %1, i64 2
%17 = getelementptr double, double* %1, i64 %6
%18 = getelementptr double, double* %2, i64 2
%19 = getelementptr double, double* %2, i64 %6
%20 = icmp ult double* %16, %19
%21 = icmp ult double* %18, %17
%22 = and i1 %20, %21
br i1 %22, label %95, label %23
23: ; preds = %15
%24 = and i64 %13, -4
%25 = or i64 %24, 2
%26 = add nsw i64 %24, -4
%27 = lshr exact i64 %26, 2
%28 = add nuw nsw i64 %27, 1
%29 = and i64 %28, 3
%30 = icmp ult i64 %26, 12
br i1 %30, label %75, label %31
31: ; preds = %23
%32 = and i64 %28, 9223372036854775804
br label %33
33: ; preds = %33, %31
%34 = phi i64 [ 0, %31 ], [ %72, %33 ]
%35 = phi i64 [ 0, %31 ], [ %73, %33 ]
%36 = or i64 %34, 2
%37 = getelementptr inbounds double, double* %1, i64 %36
%38 = bitcast double* %37 to <2 x double>*
store <2 x double> zeroinitializer, <2 x double>* %38
%39 = getelementptr inbounds double, double* %37, i64 2
%40 = bitcast double* %39 to <2 x double>*
store <2 x double> zeroinitializer, <2 x double>* %40
%41 = getelementptr inbounds double, double* %2, i64 %36
%42 = bitcast double* %41 to <2 x double>*
store <2 x double> zeroinitializer, <2 x double>* %42
%43 = getelementptr inbounds double, double* %41, i64 2
%44 = bitcast double* %43 to <2 x double>*
store <2 x double> zeroinitializer, <2 x double>* %44
%45 = or i64 %34, 6
%46 = getelementptr inbounds double, double* %1, i64 %45
%47 = bitcast double* %46 to <2 x double>*
store <2 x double> zeroinitializer, <2 x double>* %47
%48 = getelementptr inbounds double, double* %46, i64 2
%49 = bitcast double* %48 to <2 x double>*
store <2 x double> zeroinitializer, <2 x double>* %49
%50 = getelementptr inbounds double, double* %2, i64 %45
%51 = bitcast double* %50 to <2 x double>*
store <2 x double> zeroinitializer, <2 x double>* %51
%52 = getelementptr inbounds double, double* %50, i64 2
%53 = bitcast double* %52 to <2 x double>*
store <2 x double> zeroinitializer, <2 x double>* %53
%54 = or i64 %34, 10
%55 = getelementptr inbounds double, double* %1, i64 %54
%56 = bitcast double* %55 to <2 x double>*
store <2 x double> zeroinitializer, <2 x double>* %56
%57 = getelementptr inbounds double, double* %55, i64 2
%58 = bitcast double* %57 to <2 x double>*
store <2 x double> zeroinitializer, <2 x double>* %58
%59 = getelementptr inbounds double, double* %2, i64 %54
%60 = bitcast double* %59 to <2 x double>*
store <2 x double> zeroinitializer, <2 x double>* %60
%61 = getelementptr inbounds double, double* %59, i64 2
%62 = bitcast double* %61 to <2 x double>*
store <2 x double> zeroinitializer, <2 x double>* %62
%63 = or i64 %34, 14
%64 = getelementptr inbounds double, double* %1, i64 %63
%65 = bitcast double* %64 to <2 x double>*
store <2 x double> zeroinitializer, <2 x double>* %65
%66 = getelementptr inbounds double, double* %64, i64 2
%67 = bitcast double* %66 to <2 x double>*
store <2 x double> zeroinitializer, <2 x double>* %67
%68 = getelementptr inbounds double, double* %2, i64 %63
%69 = bitcast double* %68 to <2 x double>*
store <2 x double> zeroinitializer, <2 x double>* %69
%70 = getelementptr inbounds double, double* %68, i64 2
%71 = bitcast double* %70 to <2 x double>*
store <2 x double> zeroinitializer, <2 x double>* %71
%72 = add nuw i64 %34, 16
%73 = add nuw i64 %35, 4
%74 = icmp eq i64 %73, %32
br i1 %74, label %75, label %33
75: ; preds = %33, %23
%76 = phi i64 [ 0, %23 ], [ %72, %33 ]
%77 = icmp eq i64 %29, 0
br i1 %77, label %93, label %78
78: ; preds = %75, %78
%79 = phi i64 [ %90, %78 ], [ %76, %75 ]
%80 = phi i64 [ %91, %78 ], [ 0, %75 ]
%81 = or i64 %79, 2
%82 = getelementptr inbounds double, double* %1, i64 %81
%83 = bitcast double* %82 to <2 x double>*
store <2 x double> zeroinitializer, <2 x double>* %83
%84 = getelementptr inbounds double, double* %82, i64 2
%85 = bitcast double* %84 to <2 x double>*
store <2 x double> zeroinitializer, <2 x double>* %85
%86 = getelementptr inbounds double, double* %2, i64 %81
%87 = bitcast double* %86 to <2 x double>*
store <2 x double> zeroinitializer, <2 x double>* %87
%88 = getelementptr inbounds double, double* %86, i64 2
%89 = bitcast double* %88 to <2 x double>*
store <2 x double> zeroinitializer, <2 x double>* %89
%90 = add nuw i64 %79, 4
%91 = add i64 %80, 1
%92 = icmp eq i64 %91, %29
br i1 %92, label %93, label %78
93: ; preds = %78, %75
%94 = icmp eq i64 %13, %24
br i1 %94, label %128, label %95
95: ; preds = %15, %12, %93
%96 = phi i64 [ 2, %15 ], [ 2, %12 ], [ %25, %93 ]
%97 = sub nsw i64 %6, %96
%98 = xor i64 %96, -1
%99 = add nsw i64 %98, %6
%100 = and i64 %97, 3
%101 = icmp eq i64 %100, 0
br i1 %101, label %110, label %102
102: ; preds = %95, %102
%103 = phi i64 [ %107, %102 ], [ %96, %95 ]
%104 = phi i64 [ %108, %102 ], [ 0, %95 ]
%105 = getelementptr inbounds double, double* %1, i64 %103
store double 0.000000e+00, double* %105
%106 = getelementptr inbounds double, double* %2, i64 %103
store double 0.000000e+00, double* %106
%107 = add nuw nsw i64 %103, 1
%108 = add i64 %104, 1
%109 = icmp eq i64 %108, %100
br i1 %109, label %110, label %102
110: ; preds = %102, %95
%111 = phi i64 [ %96, %95 ], [ %107, %102 ]
%112 = icmp ult i64 %99, 3
br i1 %112, label %128, label %113
113: ; preds = %110, %113
%114 = phi i64 [ %126, %113 ], [ %111, %110 ]
%115 = getelementptr inbounds double, double* %1, i64 %114
store double 0.000000e+00, double* %115
%116 = getelementptr inbounds double, double* %2, i64 %114
store double 0.000000e+00, double* %116
%117 = add nuw nsw i64 %114, 1
%118 = getelementptr inbounds double, double* %1, i64 %117
store double 0.000000e+00, double* %118
%119 = getelementptr inbounds double, double* %2, i64 %117
store double 0.000000e+00, double* %119
%120 = add nuw nsw i64 %114, 2
%121 = getelementptr inbounds double, double* %1, i64 %120
store double 0.000000e+00, double* %121
%122 = getelementptr inbounds double, double* %2, i64 %120
store double 0.000000e+00, double* %122
%123 = add nuw nsw i64 %114, 3
%124 = getelementptr inbounds double, double* %1, i64 %123
store double 0.000000e+00, double* %124
%125 = getelementptr inbounds double, double* %2, i64 %123
store double 0.000000e+00, double* %125
%126 = add nuw nsw i64 %114, 4
%127 = icmp eq i64 %126, %6
br i1 %127, label %128, label %113
128: ; preds = %110, %113, %93, %5, %8, %3
ret void
}