#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 _ada_use_c2phc(int, int *, int *, double *);
int store_dobldobl_gamma(int n, double *re_gamma, double *im_gamma) {
  int fail, i;
  int *b;
  double r[4];
  for (i = 0; i < n; i++) {
    r[0] = re_gamma[2 * i];
    r[1] = re_gamma[2 * i + 1];
    r[2] = im_gamma[2 * i];
    r[3] = im_gamma[2 * i + 1];
    fail = _ada_use_c2phc(634, &i, b, r);
  }
  return fail;
}


x86 assembly (clang, -O0):
<store_dobldobl_gamma>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11bf <store_dobldobl_gamma+0xaf>
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%ecx
shl    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%ecx
shl    $0x1,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x20(%rbp),%ecx
shl    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x20(%rbp),%ecx
shl    $0x1,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x28(%rbp),%rdx
lea    -0x50(%rbp),%rcx
mov    $0x27a,%edi
lea    -0x20(%rbp),%rsi
call   1030 <_ada_use_c2phc@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    112a <store_dobldobl_gamma+0x1a>
mov    -0x1c(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<store_dobldobl_gamma>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x30,%rsp
movl   $0x0,0xc(%rsp)
test   %edi,%edi
jle    1179 <store_dobldobl_gamma+0x69>
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %edi,%ebp
xor    %ecx,%ecx
lea    0xc(%rsp),%r15
lea    0x10(%rsp),%r12
nopl   0x0(%rax)
add    %ecx,%ecx
movslq %ecx,%rax
movups (%rbx,%rax,8),%xmm0
movaps %xmm0,0x10(%rsp)
movups (%r14,%rax,8),%xmm0
movaps %xmm0,0x20(%rsp)
mov    $0x27a,%edi
mov    %r15,%rsi
mov    %r12,%rcx
call   1030 <_ada_use_c2phc@plt>
mov    0xc(%rsp),%ecx
add    $0x1,%ecx
mov    %ecx,0xc(%rsp)
cmp    %ebp,%ecx
jl     1140 <store_dobldobl_gamma+0x30>
jmp    1179 <store_dobldobl_gamma+0x69>
add    $0x30,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @store_dobldobl_gamma(i32 %0, double* %1, double* %2) {
%4 = alloca i32
%5 = alloca double*
%6 = alloca double*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32*
%10 = alloca [4 x double]
store i32 %0, i32* %4
store double* %1, double** %5
store double* %2, double** %6
store i32 0, i32* %8
br label %11
11: ; preds = %49, %3
%12 = load i32, i32* %8
%13 = load i32, i32* %4
%14 = icmp slt i32 %12, %13
br i1 %14, label %15, label %52
15: ; preds = %11
%16 = load double*, double** %5
%17 = load i32, i32* %8
%18 = mul nsw i32 2, %17
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds double, double* %16, i64 %19
%21 = load double, double* %20
%22 = getelementptr inbounds [4 x double], [4 x double]* %10, i64 0, i64 0
store double %21, double* %22
%23 = load double*, double** %5
%24 = load i32, i32* %8
%25 = mul nsw i32 2, %24
%26 = add nsw i32 %25, 1
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds double, double* %23, i64 %27
%29 = load double, double* %28
%30 = getelementptr inbounds [4 x double], [4 x double]* %10, i64 0, i64 1
store double %29, double* %30
%31 = load double*, double** %6
%32 = load i32, i32* %8
%33 = mul nsw i32 2, %32
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds double, double* %31, i64 %34
%36 = load double, double* %35
%37 = getelementptr inbounds [4 x double], [4 x double]* %10, i64 0, i64 2
store double %36, double* %37
%38 = load double*, double** %6
%39 = load i32, i32* %8
%40 = mul nsw i32 2, %39
%41 = add nsw i32 %40, 1
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds double, double* %38, i64 %42
%44 = load double, double* %43
%45 = getelementptr inbounds [4 x double], [4 x double]* %10, i64 0, i64 3
store double %44, double* %45
%46 = load i32*, i32** %9
%47 = getelementptr inbounds [4 x double], [4 x double]* %10, i64 0, i64 0
%48 = call i32 @_ada_use_c2phc(i32 634, i32* %8, i32* %46, double* %47)
store i32 %48, i32* %7
br label %49
49: ; preds = %15
%50 = load i32, i32* %8
%51 = add nsw i32 %50, 1
store i32 %51, i32* %8
br label %11
52: ; preds = %11
%53 = load i32, i32* %7
ret i32 %53
}

LLVM IR (-O2):
define i32 @store_dobldobl_gamma(i32 %0, double* nocapture %1, double* nocapture %2) {
%4 = alloca i32
%5 = alloca [4 x double]
%6 = bitcast i32* %4 to i8*
%7 = bitcast [4 x double]* %5 to i8*
store i32 0, i32* %4
%8 = icmp sgt i32 %0, 0
br i1 %8, label %9, label %28
9: ; preds = %3
%10 = getelementptr inbounds [4 x double], [4 x double]* %5, i64 0, i64 0
%11 = getelementptr inbounds [4 x double], [4 x double]* %5, i64 0, i64 2
%12 = bitcast [4 x double]* %5 to <2 x double>*
%13 = bitcast double* %11 to <2 x double>*
br label %14
14: ; preds = %9, %14
%15 = phi i32 [ 0, %9 ], [ %26, %14 ]
%16 = shl nsw i32 %15, 1
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds double, double* %1, i64 %17
%19 = bitcast double* %18 to <2 x double>*
%20 = load <2 x double>, <2 x double>* %19
store <2 x double> %20, <2 x double>* %12
%21 = getelementptr inbounds double, double* %2, i64 %17
%22 = bitcast double* %21 to <2 x double>*
%23 = load <2 x double>, <2 x double>* %22
store <2 x double> %23, <2 x double>* %13
%24 = call i32 @_ada_use_c2phc(i32 634, i32* %4, i32* undef, double* %10)
%25 = load i32, i32* %4
%26 = add nsw i32 %25, 1
store i32 %26, i32* %4
%27 = icmp slt i32 %26, %0
br i1 %27, label %14, label %28
28: ; preds = %14, %3
%29 = phi i32 [ undef, %3 ], [ %24, %14 ]
ret i32 %29
}