#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*/ exit(int);
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *);
void allocateOutput(int **out_step, int **out_level, float **out_pressure,
                    int wav_sample_count) {
  *out_step = (int *)malloc(wav_sample_count * sizeof(int));
  if (*out_step == NULL) {
    printf("Can't allocate out_step[]\n");
    exit(-1);
  }
  *out_level = (int *)malloc(wav_sample_count * sizeof(int));
  if (*out_level == NULL) {
    printf("Can't allocate out_level[]\n");
    exit(-1);
  }
  *out_pressure = (float *)malloc(wav_sample_count * sizeof(float));
  if (*out_pressure == NULL) {
    printf("Can't allocate out_pressure[]\n");
    exit(-1);
  }
  for (int i = 0; i < wav_sample_count; i++) {
    (*out_step)[i] = 0;
    (*out_level)[i] = 0;
    (*out_pressure)[i] = 0;
  }
}


x86 assembly (clang, -O0):
<allocateOutput>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
movslq -0x1c(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rax
cmpq   $0x0,(%rax)
jne    1184 <allocateOutput+0x54>
lea    0xe8b(%rip),%rdi
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>
movslq -0x1c(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x10(%rbp),%rax
cmpq   $0x0,(%rax)
jne    11c1 <allocateOutput+0x91>
lea    0xe69(%rip),%rdi
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>
movslq -0x1c(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rax
cmpq   $0x0,(%rax)
jne    11fe <allocateOutput+0xce>
lea    0xe48(%rip),%rdi
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1256 <allocateOutput+0x126>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movslq -0x20(%rbp),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movslq -0x20(%rbp),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
movslq -0x20(%rbp),%rcx
xorps  %xmm0,%xmm0
movss  %xmm0,(%rax,%rcx,4)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1205 <allocateOutput+0xd5>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<allocateOutput>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %ecx,%ebx
mov    %rdx,%r12
mov    %rsi,%r14
mov    %rdi,%r15
lea    0x0(,%rbx,4),%ebp
mov    %ebp,%edi
call   1040 <malloc@plt>
mov    %rax,(%r15)
test   %rax,%rax
je     12d3 <allocateOutput+0x1a3>
mov    %ebp,%edi
call   1040 <malloc@plt>
mov    %rax,(%r14)
test   %rax,%rax
je     12dc <allocateOutput+0x1ac>
mov    %ebp,%edi
call   1040 <malloc@plt>
mov    %rax,(%r12)
test   %rax,%rax
je     12e5 <allocateOutput+0x1b5>
test   %ebx,%ebx
jle    12c0 <allocateOutput+0x190>
mov    (%r15),%rcx
mov    (%r14),%rdx
mov    %ebx,%esi
cmp    $0x8,%ebx
jb     11ab <allocateOutput+0x7b>
lea    (%rdx,%rsi,4),%rdi
cmp    %rdi,%rcx
jae    121b <allocateOutput+0xeb>
lea    (%rcx,%rsi,4),%rdi
cmp    %rdi,%rdx
jae    121b <allocateOutput+0xeb>
xor    %edi,%edi
mov    %rdi,%rbp
not    %rbp
test   $0x1,%sil
je     11d2 <allocateOutput+0xa2>
movl   $0x0,(%rcx,%rdi,4)
movl   $0x0,(%rdx,%rdi,4)
movl   $0x0,(%rax,%rdi,4)
or     $0x1,%rdi
add    %rsi,%rbp
je     12c0 <allocateOutput+0x190>
nopl   0x0(%rax,%rax,1)
movl   $0x0,(%rcx,%rdi,4)
movl   $0x0,(%rdx,%rdi,4)
movl   $0x0,(%rax,%rdi,4)
movl   $0x0,0x4(%rcx,%rdi,4)
movl   $0x0,0x4(%rdx,%rdi,4)
movl   $0x0,0x4(%rax,%rdi,4)
add    $0x2,%rdi
cmp    %rdi,%rsi
jne    11e0 <allocateOutput+0xb0>
jmp    12c0 <allocateOutput+0x190>
mov    %esi,%edi
and    $0xfffffff8,%edi
lea    -0x8(%rdi),%rbp
mov    %rbp,%r8
shr    $0x3,%r8
add    $0x1,%r8
test   %rbp,%rbp
je     12c9 <allocateOutput+0x199>
mov    %r8,%rbp
and    $0xfffffffffffffffe,%rbp
xor    %ebx,%ebx
xorps  %xmm0,%xmm0
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movups %xmm0,(%rcx,%rbx,4)
movups %xmm0,0x10(%rcx,%rbx,4)
movups %xmm0,(%rdx,%rbx,4)
movups %xmm0,0x10(%rdx,%rbx,4)
movups %xmm0,(%rax,%rbx,4)
movups %xmm0,0x10(%rax,%rbx,4)
movups %xmm0,0x20(%rcx,%rbx,4)
movups %xmm0,0x30(%rcx,%rbx,4)
movups %xmm0,0x20(%rdx,%rbx,4)
movups %xmm0,0x30(%rdx,%rbx,4)
movups %xmm0,0x20(%rax,%rbx,4)
movups %xmm0,0x30(%rax,%rbx,4)
add    $0x10,%rbx
add    $0xfffffffffffffffe,%rbp
jne    1250 <allocateOutput+0x120>
test   $0x1,%r8b
je     12b7 <allocateOutput+0x187>
xorps  %xmm0,%xmm0
movups %xmm0,(%rcx,%rbx,4)
movups %xmm0,0x10(%rcx,%rbx,4)
movups %xmm0,(%rdx,%rbx,4)
movups %xmm0,0x10(%rdx,%rbx,4)
movups %xmm0,(%rax,%rbx,4)
movups %xmm0,0x10(%rax,%rbx,4)
cmp    %rsi,%rdi
jne    11ad <allocateOutput+0x7d>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %ebx,%ebx
test   $0x1,%r8b
jne    1299 <allocateOutput+0x169>
jmp    12b7 <allocateOutput+0x187>
lea    0xd5f(%rip),%rdi
jmp    12ec <allocateOutput+0x1bc>
lea    0xd3b(%rip),%rdi
jmp    12ec <allocateOutput+0x1bc>
lea    0xd14(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [27 x i8] c"Can't allocate out_step[]\0A\00"
@.str.1 = [28 x i8] c"Can't allocate out_level[]\0A\00"
@.str.2 = [31 x i8] c"Can't allocate out_pressure[]\0A\00"
define void @allocateOutput(i32** %0, i32** %1, float** %2, i32 %3) {
%5 = alloca i32**
%6 = alloca i32**
%7 = alloca float**
%8 = alloca i32
%9 = alloca i32
store i32** %0, i32*** %5
store i32** %1, i32*** %6
store float** %2, float*** %7
store i32 %3, i32* %8
%10 = load i32, i32* %8
%11 = sext i32 %10 to i64
%12 = mul i64 %11, 4
%13 = trunc i64 %12 to i32
%14 = call i64 @malloc(i32 %13)
%15 = inttoptr i64 %14 to i32*
%16 = load i32**, i32*** %5
store i32* %15, i32** %16
%17 = load i32**, i32*** %5
%18 = load i32*, i32** %17
%19 = icmp eq i32* %18, null
br i1 %19, label %20, label %23
20: ; preds = %4
%21 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%22 = call i32 @exit(i32 -1)
unreachable
23: ; preds = %4
%24 = load i32, i32* %8
%25 = sext i32 %24 to i64
%26 = mul i64 %25, 4
%27 = trunc i64 %26 to i32
%28 = call i64 @malloc(i32 %27)
%29 = inttoptr i64 %28 to i32*
%30 = load i32**, i32*** %6
store i32* %29, i32** %30
%31 = load i32**, i32*** %6
%32 = load i32*, i32** %31
%33 = icmp eq i32* %32, null
br i1 %33, label %34, label %37
34: ; preds = %23
%35 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
%36 = call i32 @exit(i32 -1)
unreachable
37: ; preds = %23
%38 = load i32, i32* %8
%39 = sext i32 %38 to i64
%40 = mul i64 %39, 4
%41 = trunc i64 %40 to i32
%42 = call i64 @malloc(i32 %41)
%43 = inttoptr i64 %42 to float*
%44 = load float**, float*** %7
store float* %43, float** %44
%45 = load float**, float*** %7
%46 = load float*, float** %45
%47 = icmp eq float* %46, null
br i1 %47, label %48, label %51
48: ; preds = %37
%49 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0))
%50 = call i32 @exit(i32 -1)
unreachable
51: ; preds = %37
store i32 0, i32* %9
br label %52
52: ; preds = %72, %51
%53 = load i32, i32* %9
%54 = load i32, i32* %8
%55 = icmp slt i32 %53, %54
br i1 %55, label %56, label %75
56: ; preds = %52
%57 = load i32**, i32*** %5
%58 = load i32*, i32** %57
%59 = load i32, i32* %9
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds i32, i32* %58, i64 %60
store i32 0, i32* %61
%62 = load i32**, i32*** %6
%63 = load i32*, i32** %62
%64 = load i32, i32* %9
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds i32, i32* %63, i64 %65
store i32 0, i32* %66
%67 = load float**, float*** %7
%68 = load float*, float** %67
%69 = load i32, i32* %9
%70 = sext i32 %69 to i64
%71 = getelementptr inbounds float, float* %68, i64 %70
store float 0.000000e+00, float* %71
br label %72
72: ; preds = %56
%73 = load i32, i32* %9
%74 = add nsw i32 %73, 1
store i32 %74, i32* %9
br label %52
75: ; preds = %52
ret void
}

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