#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 */
double *double_malloc_or_die(int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int);
int /*<<< orphan*/ stderr;
double *get_alphas(int interaction_type, int N, double alpha0) {
  double *alphas = double_malloc_or_die(N + 1);
  int k;
  for (k = 0; k <= N; k++)
    alphas[k] = 0.0;
  switch (interaction_type) {
  case 11:
    break;
  case 22:
    alphas[2] = alpha0;
    break;
  case 33:
    for (k = 1; k <= N; k++)
      alphas[k] = alpha0;
    break;
  case 44:
    alphas[2] = alpha0;
    break;
  case 55:
    alphas[2] = alpha0;
    break;
  default:
    fprintf(stderr, "get_alphas: undefined interaction type %d.\n",
            interaction_type);
    exit(1);
    break;
  }
  return alphas;
}


x86 assembly (clang, -O0):
<get_alphas>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
mov    -0x8(%rbp),%edi
add    $0x1,%edi
call   1030 <double_malloc_or_die@plt>
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     1183 <get_alphas+0x53>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1159 <get_alphas+0x29>
mov    -0x4(%rbp),%eax
add    $0xfffffff5,%eax
mov    %eax,%ecx
mov    %rcx,-0x28(%rbp)
sub    $0x2c,%eax
ja     1222 <get_alphas+0xf2>
mov    -0x28(%rbp),%rax
lea    0xe5d(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
jmp    1244 <get_alphas+0x114>
movsd  -0x10(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x10(%rax)
jmp    1244 <get_alphas+0x114>
movl   $0x1,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     11f7 <get_alphas+0xc7>
movsd  -0x10(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11cb <get_alphas+0x9b>
jmp    1244 <get_alphas+0x114>
movsd  -0x10(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x10(%rax)
jmp    1244 <get_alphas+0x114>
movsd  -0x10(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x10(%rax)
jmp    1244 <get_alphas+0x114>
mov    0x2db7(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%edx
lea    0xe7f(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x18(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_alphas>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x18,%rsp
movaps %xmm0,(%rsp)
mov    %esi,%ebp
mov    %edi,%r14d
lea    0x1(%rbp),%r15d
mov    %r15d,%edi
call   1040 <double_malloc_or_die@plt>
mov    %rax,%rbx
test   %ebp,%ebp
js     117a <get_alphas+0x3a>
mov    %ebp,%eax
lea    0x8(,%rax,8),%rdx
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <memset@plt>
lea    -0xb(%r14),%eax
cmp    $0x2c,%eax
movaps (%rsp),%xmm1
ja     1283 <get_alphas+0x143>
lea    0xe6e(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movsd  %xmm1,0x10(%rbx)
mov    %rbx,%rax
add    $0x18,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
test   %ebp,%ebp
jle    11a0 <get_alphas+0x60>
mov    %r15d,%eax
lea    -0x1(%rax),%rdx
mov    $0x1,%ecx
cmp    $0x4,%rdx
jb     1270 <get_alphas+0x130>
mov    %rdx,%rcx
and    $0xfffffffffffffffc,%rcx
movaps %xmm1,%xmm0
movlhps %xmm1,%xmm0
lea    -0x4(%rcx),%rdi
mov    %rdi,%rsi
shr    $0x2,%rsi
add    $0x1,%rsi
mov    %esi,%ebp
and    $0x3,%ebp
cmp    $0xc,%rdi
jae    11f3 <get_alphas+0xb3>
xor    %edi,%edi
jmp    1232 <get_alphas+0xf2>
and    $0xfffffffffffffffc,%rsi
xor    %edi,%edi
nopl   0x0(%rax)
movups %xmm0,0x8(%rbx,%rdi,8)
movups %xmm0,0x18(%rbx,%rdi,8)
movups %xmm0,0x28(%rbx,%rdi,8)
movups %xmm0,0x38(%rbx,%rdi,8)
movups %xmm0,0x48(%rbx,%rdi,8)
movups %xmm0,0x58(%rbx,%rdi,8)
movups %xmm0,0x68(%rbx,%rdi,8)
movups %xmm0,0x78(%rbx,%rdi,8)
add    $0x10,%rdi
add    $0xfffffffffffffffc,%rsi
jne    1200 <get_alphas+0xc0>
test   %rbp,%rbp
je     125f <get_alphas+0x11f>
nopw   0x0(%rax,%rax,1)
lea    0x0(,%rdi,8),%rsi
or     $0x8,%rsi
movups %xmm0,(%rbx,%rsi,1)
movups %xmm0,0x10(%rbx,%rsi,1)
add    $0x4,%rdi
add    $0xffffffffffffffff,%rbp
jne    1240 <get_alphas+0x100>
cmp    %rcx,%rdx
je     11a0 <get_alphas+0x60>
or     $0x1,%rcx
nopl   0x0(%rax)
movsd  %xmm1,(%rbx,%rcx,8)
add    $0x1,%rcx
cmp    %rcx,%rax
jne    1270 <get_alphas+0x130>
jmp    11a0 <get_alphas+0x60>
mov    0x2d56(%rip),%rax
mov    (%rax),%edi
lea    0xe21(%rip),%rsi
mov    %r14d,%edx
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [44 x i8] c"get_alphas: undefined interaction type %d.\0A\00"
define double* @get_alphas(i32 %0, i32 %1, double %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca double
%7 = alloca double*
%8 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store double %2, double* %6
%9 = load i32, i32* %5
%10 = add nsw i32 %9, 1
%11 = call double* @double_malloc_or_die(i32 %10)
store double* %11, double** %7
store i32 0, i32* %8
br label %12
12: ; preds = %21, %3
%13 = load i32, i32* %8
%14 = load i32, i32* %5
%15 = icmp sle i32 %13, %14
br i1 %15, label %16, label %24
16: ; preds = %12
%17 = load double*, double** %7
%18 = load i32, i32* %8
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds double, double* %17, i64 %19
store double 0.000000e+00, double* %20
br label %21
21: ; preds = %16
%22 = load i32, i32* %8
%23 = add nsw i32 %22, 1
store i32 %23, i32* %8
br label %12
24: ; preds = %12
%25 = load i32, i32* %4
switch i32 %25, label %54 [
i32 11, label %26
i32 22, label %27
i32 33, label %31
i32 44, label %46
i32 55, label %50
]
26: ; preds = %24
br label %59
27: ; preds = %24
%28 = load double, double* %6
%29 = load double*, double** %7
%30 = getelementptr inbounds double, double* %29, i64 2
store double %28, double* %30
br label %59
31: ; preds = %24
store i32 1, i32* %8
br label %32
32: ; preds = %42, %31
%33 = load i32, i32* %8
%34 = load i32, i32* %5
%35 = icmp sle i32 %33, %34
br i1 %35, label %36, label %45
36: ; preds = %32
%37 = load double, double* %6
%38 = load double*, double** %7
%39 = load i32, i32* %8
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds double, double* %38, i64 %40
store double %37, double* %41
br label %42
42: ; preds = %36
%43 = load i32, i32* %8
%44 = add nsw i32 %43, 1
store i32 %44, i32* %8
br label %32
45: ; preds = %32
br label %59
46: ; preds = %24
%47 = load double, double* %6
%48 = load double*, double** %7
%49 = getelementptr inbounds double, double* %48, i64 2
store double %47, double* %49
br label %59
50: ; preds = %24
%51 = load double, double* %6
%52 = load double*, double** %7
%53 = getelementptr inbounds double, double* %52, i64 2
store double %51, double* %53
br label %59
54: ; preds = %24
%55 = load i32, i32* @stderr
%56 = load i32, i32* %4
%57 = call i32 @fprintf(i32 %55, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i32 %56)
%58 = call i32 @exit(i32 1)
unreachable
59: ; preds = %50, %46, %45, %27, %26
%60 = load double*, double** %7
ret double* %60
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [44 x i8] c"get_alphas: undefined interaction type %d.\0A\00"
define double* @get_alphas(i32 %0, i32 %1, double %2) {
%4 = add i32 %1, 1
%5 = tail call double* @double_malloc_or_die(i32 %4)
%6 = icmp slt i32 %1, 0
br i1 %6, label %12, label %7
7: ; preds = %3
%8 = bitcast double* %5 to i8*
%9 = zext i32 %1 to i64
%10 = shl nuw nsw i64 %9, 3
%11 = add nuw nsw i64 %10, 8
br label %12
12: ; preds = %7, %3
switch i32 %0, label %82 [
i32 11, label %88
i32 22, label %86
i32 33, label %13
i32 44, label %86
i32 55, label %86
]
13: ; preds = %12
%14 = icmp slt i32 %1, 1
br i1 %14, label %88, label %15
15: ; preds = %13
%16 = zext i32 %4 to i64
%17 = add nsw i64 %16, -1
%18 = icmp ult i64 %17, 4
br i1 %18, label %75, label %19
19: ; preds = %15
%20 = and i64 %17, -4
%21 = or i64 %20, 1
%22 = insertelement <2 x double> poison, double %2, i64 0
%23 = shufflevector <2 x double> %22, <2 x double> poison, <2 x i32> zeroinitializer
%24 = insertelement <2 x double> poison, double %2, i64 0
%25 = shufflevector <2 x double> %24, <2 x double> poison, <2 x i32> zeroinitializer
%26 = add nsw i64 %20, -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 %59, label %31
31: ; preds = %19
%32 = and i64 %28, 9223372036854775804
br label %33
33: ; preds = %33, %31
%34 = phi i64 [ 0, %31 ], [ %56, %33 ]
%35 = phi i64 [ 0, %31 ], [ %57, %33 ]
%36 = or i64 %34, 1
%37 = getelementptr inbounds double, double* %5, i64 %36
%38 = bitcast double* %37 to <2 x double>*
store <2 x double> %23, <2 x double>* %38
%39 = getelementptr inbounds double, double* %37, i64 2
%40 = bitcast double* %39 to <2 x double>*
store <2 x double> %25, <2 x double>* %40
%41 = or i64 %34, 5
%42 = getelementptr inbounds double, double* %5, i64 %41
%43 = bitcast double* %42 to <2 x double>*
store <2 x double> %23, <2 x double>* %43
%44 = getelementptr inbounds double, double* %42, i64 2
%45 = bitcast double* %44 to <2 x double>*
store <2 x double> %25, <2 x double>* %45
%46 = or i64 %34, 9
%47 = getelementptr inbounds double, double* %5, i64 %46
%48 = bitcast double* %47 to <2 x double>*
store <2 x double> %23, <2 x double>* %48
%49 = getelementptr inbounds double, double* %47, i64 2
%50 = bitcast double* %49 to <2 x double>*
store <2 x double> %25, <2 x double>* %50
%51 = or i64 %34, 13
%52 = getelementptr inbounds double, double* %5, i64 %51
%53 = bitcast double* %52 to <2 x double>*
store <2 x double> %23, <2 x double>* %53
%54 = getelementptr inbounds double, double* %52, i64 2
%55 = bitcast double* %54 to <2 x double>*
store <2 x double> %25, <2 x double>* %55
%56 = add nuw i64 %34, 16
%57 = add nuw i64 %35, 4
%58 = icmp eq i64 %57, %32
br i1 %58, label %59, label %33
59: ; preds = %33, %19
%60 = phi i64 [ 0, %19 ], [ %56, %33 ]
%61 = icmp eq i64 %29, 0
br i1 %61, label %73, label %62
62: ; preds = %59, %62
%63 = phi i64 [ %70, %62 ], [ %60, %59 ]
%64 = phi i64 [ %71, %62 ], [ 0, %59 ]
%65 = or i64 %63, 1
%66 = getelementptr inbounds double, double* %5, i64 %65
%67 = bitcast double* %66 to <2 x double>*
store <2 x double> %23, <2 x double>* %67
%68 = getelementptr inbounds double, double* %66, i64 2
%69 = bitcast double* %68 to <2 x double>*
store <2 x double> %25, <2 x double>* %69
%70 = add nuw i64 %63, 4
%71 = add i64 %64, 1
%72 = icmp eq i64 %71, %29
br i1 %72, label %73, label %62
73: ; preds = %62, %59
%74 = icmp eq i64 %17, %20
br i1 %74, label %88, label %75
75: ; preds = %15, %73
%76 = phi i64 [ 1, %15 ], [ %21, %73 ]
br label %77
77: ; preds = %75, %77
%78 = phi i64 [ %80, %77 ], [ %76, %75 ]
%79 = getelementptr inbounds double, double* %5, i64 %78
store double %2, double* %79
%80 = add nuw nsw i64 %78, 1
%81 = icmp eq i64 %80, %16
br i1 %81, label %88, label %77
82: ; preds = %12
%83 = load i32, i32* @stderr
%84 = tail call i32 @fprintf(i32 %83, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i32 %0)
%85 = tail call i32 @exit(i32 1)
unreachable
86: ; preds = %12, %12, %12
%87 = getelementptr inbounds double, double* %5, i64 2
store double %2, double* %87
br label %88
88: ; preds = %77, %73, %86, %13, %12
ret double* %5
}