#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 atoi(char *);
int /*<<< orphan*/ ex3(double *, int, int);
int /*<<< orphan*/ free(double *);
int /*<<< orphan*/ initarray(double *, int);
scalar_t__ malloc(int);
int main(int argc, char *argv[]) {
  int n = atoi(argv[1]);
  double *A = (double *)malloc(2 * n * sizeof(double));
  initarray(A, 2 * n);
  ex3(A, n, 0);
  ex3(A, n, 1);
  ex3(A, n, 2);
  ex3(A, n, 3);
  ex3(A, n, 4);
  free(A);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1070 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
shl    $0x1,%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x14(%rbp),%esi
shl    $0x1,%esi
call   1050 <initarray@plt>
mov    -0x20(%rbp),%rdi
mov    -0x14(%rbp),%esi
xor    %edx,%edx
call   1040 <ex3@plt>
mov    -0x20(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    $0x1,%edx
call   1040 <ex3@plt>
mov    -0x20(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    $0x2,%edx
call   1040 <ex3@plt>
mov    -0x20(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    $0x3,%edx
call   1040 <ex3@plt>
mov    -0x20(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    $0x4,%edx
call   1040 <ex3@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
mov    0x8(%rsi),%rdi
call   1070 <atoi@plt>
mov    %eax,%r14d
lea    (%r14,%r14,1),%ebp
mov    %eax,%edi
shl    $0x4,%edi
call   1060 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %ebp,%esi
call   1050 <initarray@plt>
mov    %rbx,%rdi
mov    %r14d,%esi
xor    %edx,%edx
call   1040 <ex3@plt>
mov    %rbx,%rdi
mov    %r14d,%esi
mov    $0x1,%edx
call   1040 <ex3@plt>
mov    %rbx,%rdi
mov    %r14d,%esi
mov    $0x2,%edx
call   1040 <ex3@plt>
mov    %rbx,%rdi
mov    %r14d,%esi
mov    $0x3,%edx
call   1040 <ex3@plt>
mov    %rbx,%rdi
mov    %r14d,%esi
mov    $0x4,%edx
call   1040 <ex3@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca double*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i8**, i8*** %5
%9 = getelementptr inbounds i8*, i8** %8, i64 1
%10 = load i8*, i8** %9
%11 = call i32 @atoi(i8* %10)
store i32 %11, i32* %6
%12 = load i32, i32* %6
%13 = mul nsw i32 2, %12
%14 = sext i32 %13 to i64
%15 = mul i64 %14, 8
%16 = trunc i64 %15 to i32
%17 = call i64 @malloc(i32 %16)
%18 = inttoptr i64 %17 to double*
store double* %18, double** %7
%19 = load double*, double** %7
%20 = load i32, i32* %6
%21 = mul nsw i32 2, %20
%22 = call i32 @initarray(double* %19, i32 %21)
%23 = load double*, double** %7
%24 = load i32, i32* %6
%25 = call i32 @ex3(double* %23, i32 %24, i32 0)
%26 = load double*, double** %7
%27 = load i32, i32* %6
%28 = call i32 @ex3(double* %26, i32 %27, i32 1)
%29 = load double*, double** %7
%30 = load i32, i32* %6
%31 = call i32 @ex3(double* %29, i32 %30, i32 2)
%32 = load double*, double** %7
%33 = load i32, i32* %6
%34 = call i32 @ex3(double* %32, i32 %33, i32 3)
%35 = load double*, double** %7
%36 = load i32, i32* %6
%37 = call i32 @ex3(double* %35, i32 %36, i32 4)
%38 = load double*, double** %7
%39 = call i32 @free(double* %38)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = tail call i32 @atoi(i8* %4)
%6 = shl nsw i32 %5, 1
%7 = shl i32 %5, 4
%8 = tail call i64 @malloc(i32 %7)
%9 = inttoptr i64 %8 to double*
%10 = tail call i32 @initarray(double* %9, i32 %6)
%11 = tail call i32 @ex3(double* %9, i32 %5, i32 0)
%12 = tail call i32 @ex3(double* %9, i32 %5, i32 1)
%13 = tail call i32 @ex3(double* %9, i32 %5, i32 2)
%14 = tail call i32 @ex3(double* %9, i32 %5, i32 3)
%15 = tail call i32 @ex3(double* %9, i32 %5, i32 4)
%16 = tail call i32 @free(double* %9)
ret i32 0
}