#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 *trade_routine(int, int, int, int *);
int *trade_routine_other(int player, int credits, int type) {
  int start[5];
  if (type == 5) {
    for (int i = 0; i < 5; i++)
      start[i] = i;
  }
  return trade_routine(player, credits, type, start);
}


x86 assembly (clang, -O0):
<trade_routine_other>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
cmpl   $0x5,-0xc(%rbp)
jne    115a <trade_routine_other+0x4a>
movl   $0x0,-0x24(%rbp)
cmpl   $0x5,-0x24(%rbp)
jge    1155 <trade_routine_other+0x45>
mov    -0x24(%rbp),%ecx
movslq -0x24(%rbp),%rax
mov    %ecx,-0x20(%rbp,%rax,4)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1132 <trade_routine_other+0x22>
jmp    115a <trade_routine_other+0x4a>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    -0x20(%rbp),%rcx
call   1030 <trade_routine@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<trade_routine_other>:
sub    $0x18,%rsp
cmp    $0x5,%edx
jne    112c <trade_routine_other+0x1c>
movaps 0xee0(%rip),%xmm0
movaps %xmm0,(%rsp)
movl   $0x4,0x10(%rsp)
mov    %rsp,%rcx
call   1030 <trade_routine@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
define i32* @trade_routine_other(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca [5 x i32]
%8 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%9 = load i32, i32* %6
%10 = icmp eq i32 %9, 5
br i1 %10, label %11, label %24
11: ; preds = %3
store i32 0, i32* %8
br label %12
12: ; preds = %20, %11
%13 = load i32, i32* %8
%14 = icmp slt i32 %13, 5
br i1 %14, label %15, label %23
15: ; preds = %12
%16 = load i32, i32* %8
%17 = load i32, i32* %8
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [5 x i32], [5 x i32]* %7, i64 0, i64 %18
store i32 %16, i32* %19
br label %20
20: ; preds = %15
%21 = load i32, i32* %8
%22 = add nsw i32 %21, 1
store i32 %22, i32* %8
br label %12
23: ; preds = %12
br label %24
24: ; preds = %23, %3
%25 = load i32, i32* %4
%26 = load i32, i32* %5
%27 = load i32, i32* %6
%28 = getelementptr inbounds [5 x i32], [5 x i32]* %7, i64 0, i64 0
%29 = call i32* @trade_routine(i32 %25, i32 %26, i32 %27, i32* %28)
ret i32* %29
}

LLVM IR (-O2):
define i32* @trade_routine_other(i32 %0, i32 %1, i32 %2) {
%4 = alloca [5 x i32]
%5 = bitcast [5 x i32]* %4 to i8*
%6 = icmp eq i32 %2, 5
br i1 %6, label %7, label %10
7: ; preds = %3
%8 = bitcast [5 x i32]* %4 to <4 x i32>*
store <4 x i32> <i32 0, i32 1, i32 2, i32 3>, <4 x i32>* %8
%9 = getelementptr inbounds [5 x i32], [5 x i32]* %4, i64 0, i64 4
store i32 4, i32* %9
br label %10
10: ; preds = %7, %3
%11 = getelementptr inbounds [5 x i32], [5 x i32]* %4, i64 0, i64 0
%12 = call i32* @trade_routine(i32 %0, i32 %1, i32 %2, i32* %11)
ret i32* %12
}