#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*/ puts(char *);
int /*<<< orphan*/ scanf(char *, int *);
int spendThisMuch(int supply) {
  int moneySpent;
  if (supply == 0) {
    scanf("%d", &moneySpent);
    if (moneySpent < 200)
      puts("NOT ENOUGH");
    else if (moneySpent > 300)
      puts("TOO MUCH");
  } else {
    scanf("%d", &moneySpent);
    if (moneySpent < 0)
      puts("IMPOSSIBLE");
  }
  return moneySpent;
}


x86 assembly (clang, -O0):
<spendThisMuch>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    1186 <spendThisMuch+0x66>
lea    0xec4(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0xc8,-0x8(%rbp)
jge    1163 <spendThisMuch+0x43>
lea    0xeaa(%rip),%rdi
call   1030 <puts@plt>
jmp    1181 <spendThisMuch+0x61>
cmpl   $0x12c,-0x8(%rbp)
jle    117c <spendThisMuch+0x5c>
lea    0xe97(%rip),%rdi
call   1030 <puts@plt>
jmp    1181 <spendThisMuch+0x61>
jmp    11b1 <spendThisMuch+0x91>
lea    0xe73(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,-0x8(%rbp)
jge    11ac <spendThisMuch+0x8c>
lea    0xe70(%rip),%rdi
call   1030 <puts@plt>
jmp    11b1 <spendThisMuch+0x91>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<spendThisMuch>:
push   %rbx
sub    $0x10,%rsp
mov    %edi,%ebx
lea    0xed2(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%eax
test   %ebx,%ebx
je     114d <spendThisMuch+0x2d>
test   %eax,%eax
jns    1170 <spendThisMuch+0x50>
lea    0xecc(%rip),%rdi
jmp    116b <spendThisMuch+0x4b>
cmp    $0xc8,%eax
jge    115d <spendThisMuch+0x3d>
lea    0xea8(%rip),%rdi
jmp    116b <spendThisMuch+0x4b>
cmp    $0x12c,%eax
jbe    1170 <spendThisMuch+0x50>
lea    0xea3(%rip),%rdi
call   1030 <puts@plt>
mov    0xc(%rsp),%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [11 x i8] c"NOT ENOUGH\00"
@.str.2 = [9 x i8] c"TOO MUCH\00"
@.str.3 = [11 x i8] c"IMPOSSIBLE\00"
define i32 @spendThisMuch(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %19
6: ; preds = %1
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%8 = load i32, i32* %3
%9 = icmp slt i32 %8, 200
br i1 %9, label %10, label %12
10: ; preds = %6
%11 = call i32 @puts(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
br label %18
12: ; preds = %6
%13 = load i32, i32* %3
%14 = icmp sgt i32 %13, 300
br i1 %14, label %15, label %17
15: ; preds = %12
%16 = call i32 @puts(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
br label %17
17: ; preds = %15, %12
br label %18
18: ; preds = %17, %10
br label %26
19: ; preds = %1
%20 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%21 = load i32, i32* %3
%22 = icmp slt i32 %21, 0
br i1 %22, label %23, label %25
23: ; preds = %19
%24 = call i32 @puts(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
br label %25
25: ; preds = %23, %19
br label %26
26: ; preds = %25, %18
%27 = load i32, i32* %3
ret i32 %27
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [11 x i8] c"NOT ENOUGH\00"
@.str.2 = [9 x i8] c"TOO MUCH\00"
@.str.3 = [11 x i8] c"IMPOSSIBLE\00"
define i32 @spendThisMuch(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = icmp eq i32 %0, 0
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%6 = load i32, i32* %2
br i1 %4, label %7, label %11
7: ; preds = %1
%8 = icmp slt i32 %6, 200
br i1 %8, label %13, label %9
9: ; preds = %7
%10 = icmp ugt i32 %6, 300
br i1 %10, label %13, label %16
11: ; preds = %1
%12 = icmp slt i32 %6, 0
br i1 %12, label %13, label %16
13: ; preds = %11, %9, %7
%14 = phi i8* [ getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), %7 ], [ getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), %9 ], [ getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), %11 ]
%15 = call i32 @puts(i8* dereferenceable(1) %14)
br label %16
16: ; preds = %13, %11, %9
%17 = load i32, i32* %2
ret i32 %17
}