#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 */
typedef int /*<<< orphan*/ int8_t;

/* Variables and functions */
int /*<<< orphan*/ displaySupplies(int *);
int /*<<< orphan*/ greet();
int initialPurchase(int *);
int /*<<< orphan*/ initializeFlagArray(int /*<<< orphan*/ *);
int main(int argc, char *argv[]) {
  int supplies[5];
  int8_t flags[7];
  int money = -1;
  greet();
  while (money < 0) {
    money = initialPurchase(supplies);
    supplies[1] *= 50;
  }
  initializeFlagArray(flags);
  displaySupplies(supplies);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0xffffffff,-0x54(%rbp)
mov    $0x0,%al
call   1040 <greet@plt>
cmpl   $0x0,-0x54(%rbp)
jge    1186 <main+0x46>
lea    -0x30(%rbp),%rdi
call   1060 <initialPurchase@plt>
mov    %eax,-0x54(%rbp)
imul   $0x32,-0x2c(%rbp),%eax
mov    %eax,-0x2c(%rbp)
jmp    1164 <main+0x24>
lea    -0x50(%rbp),%rdi
call   1030 <initializeFlagArray@plt>
lea    -0x30(%rbp),%rdi
call   1050 <displaySupplies@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x40,%rsp
xor    %eax,%eax
call   1040 <greet@plt>
mov    %rsp,%rbx
nop
mov    %rbx,%rdi
call   1060 <initialPurchase@plt>
imul   $0x32,0x4(%rsp),%ecx
mov    %ecx,0x4(%rsp)
test   %eax,%eax
js     1150 <main+0x10>
lea    0x20(%rsp),%rdi
call   1030 <initializeFlagArray@plt>
mov    %rsp,%rdi
call   1050 <displaySupplies@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [5 x i32]
%7 = alloca [7 x i32]
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 -1, i32* %8
%9 = call i32 (...) @greet()
br label %10
10: ; preds = %13, %2
%11 = load i32, i32* %8
%12 = icmp slt i32 %11, 0
br i1 %12, label %13, label %19
13: ; preds = %10
%14 = getelementptr inbounds [5 x i32], [5 x i32]* %6, i64 0, i64 0
%15 = call i32 @initialPurchase(i32* %14)
store i32 %15, i32* %8
%16 = getelementptr inbounds [5 x i32], [5 x i32]* %6, i64 0, i64 1
%17 = load i32, i32* %16
%18 = mul nsw i32 %17, 50
store i32 %18, i32* %16
br label %10
19: ; preds = %10
%20 = getelementptr inbounds [7 x i32], [7 x i32]* %7, i64 0, i64 0
%21 = call i32 @initializeFlagArray(i32* %20)
%22 = getelementptr inbounds [5 x i32], [5 x i32]* %6, i64 0, i64 0
%23 = call i32 @displaySupplies(i32* %22)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [5 x i32]
%4 = alloca [7 x i32]
%5 = bitcast [5 x i32]* %3 to i8*
%6 = bitcast [7 x i32]* %4 to i8*
%7 = tail call i32 (...) @greet()
%8 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 0
%9 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 1
br label %10
10: ; preds = %2, %10
%11 = call i32 @initialPurchase(i32* %8)
%12 = load i32, i32* %9
%13 = mul nsw i32 %12, 50
store i32 %13, i32* %9
%14 = icmp slt i32 %11, 0
br i1 %14, label %10, label %15
15: ; preds = %10
%16 = getelementptr inbounds [7 x i32], [7 x i32]* %4, i64 0, i64 0
%17 = call i32 @initializeFlagArray(i32* %16)
%18 = call i32 @displaySupplies(i32* %8)
ret i32 0
}