#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*/ clear_scanf_buffer();
int /*<<< orphan*/ clear_screen();
int /*<<< orphan*/ generate_weather(int **, int);
int /*<<< orphan*/ post_weather_update(int **, int);
int /*<<< orphan*/ pot_allocation(int **, int);
int /*<<< orphan*/ print_table(int **, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ purchase(int **, int);
int scanf(char *, int *);
int /*<<< orphan*/ setbuf(int /*<<< orphan*/, int /*<<< orphan*/ *);
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ stdout;
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int /*<<< orphan*/ update_info(int **, int);
int /*<<< orphan*/ wait(int);
int main(void) {
  srand(time(NULL));
  setbuf(stdout, NULL);
  int day = 1;
  int MAX_DAYS;
  clear_screen();
  while (1) {
    printf("Enter the number of days you'd like to play for (minimum 1): ");
    if (scanf("%d", &MAX_DAYS) != 1 || MAX_DAYS < 1) {
      printf("Please enter a digit greater than 0, try again.\n\n");
    } else {
      break;
    }
  }
  clear_scanf_buffer();
  clear_screen();
  int history[MAX_DAYS][6];
  history[0][0] = day;
  history[0][1] = 0;
  history[0][2] = 5;
  history[0][3] = 1;
  history[0][4] = -1;
  history[0][5] = -1;
  history[0][6] = -1;
  while (day <= MAX_DAYS) {
    print_table(history, day);
    pot_allocation(history, day);
    clear_scanf_buffer();
    clear_screen();
    print_table(history, day);
    generate_weather(history, day);
    if (day != MAX_DAYS) {
      update_info(history, day);
    }
    post_weather_update(history, day);
    if (day != MAX_DAYS) {
      purchase(history, day);
      day++;
      clear_scanf_buffer();
      clear_screen();
    } else {
      break;
    }
  }
  printf("\x1B[0m"
         "\n %d days are up! . ",
         MAX_DAYS);
  wait(1);
  printf(". ");
  wait(1);
  printf(". ");
  wait(1);
  clear_screen();
  print_table(history, day);
  int net_worth = 0;
  net_worth += history[day - 1][1];
  net_worth += 100 * history[day - 1][3];
  net_worth += history[day - 1][5];
  if (history[day - 1][6] == 0) {
    net_worth += 5 * (history[day - 1][2] - history[day - 1][4]);
  } else {
    net_worth += 5 * (history[day - 1][2]);
  }
  net_worth -= 100 + 5 * 5;
  printf("\x1B[0m"
         "Congratulations, you've earned $");
  printf("\x1B[1;32m"
         "%d",
         net_worth);
  printf("\x1B[0m"
         " in %d days!\n",
         MAX_DAYS);
  wait(1);
  printf("Extrapolated, that's $");
  printf("\x1B[1;32m"
         "%.2lf",
         net_worth * 365.0 / MAX_DAYS);
  printf("\x1B[0m"
         " a year!\n");
  wait(1);
  printf("Thanks for playing!\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   10a0 <time@plt>
mov    %eax,%edi
call   1070 <srand@plt>
mov    0x2dda(%rip),%rax
mov    (%rax),%edi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <setbuf@plt>
movl   $0x1,-0x8(%rbp)
mov    $0x0,%al
call   10e0 <clear_screen@plt>
lea    0xde2(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xe89(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   10d0 <scanf@plt>
cmp    $0x1,%eax
jne    1250 <main+0x70>
cmpl   $0x1,-0xc(%rbp)
jge    1263 <main+0x83>
lea    0xdef(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    1268 <main+0x88>
jmp    126d <main+0x8d>
jmp    121f <main+0x3f>
xor    %eax,%eax
mov    %al,-0x31(%rbp)
call   1100 <clear_scanf_buffer@plt>
mov    -0x31(%rbp),%al
call   10e0 <clear_screen@plt>
mov    -0xc(%rbp),%eax
mov    %eax,%ecx
mov    %rsp,%rax
mov    %rax,-0x18(%rbp)
lea    (%rcx,%rcx,2),%rax
lea    0xf(,%rax,8),%rdx
movabs $0x3ffffffff0,%rax
and    %rax,%rdx
mov    %rsp,%rax
sub    %rdx,%rax
mov    %rax,-0x30(%rbp)
mov    %rax,%rsp
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%ecx
mov    %ecx,(%rax)
movl   $0x0,0x4(%rax)
movl   $0x5,0x8(%rax)
movl   $0x1,0xc(%rax)
movl   $0xffffffff,0x10(%rax)
movl   $0xffffffff,0x14(%rax)
movl   $0xffffffff,0x18(%rax)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     1390 <main+0x1b0>
mov    -0x30(%rbp),%rdi
mov    -0x8(%rbp),%esi
call   1030 <print_table@plt>
mov    -0x30(%rbp),%rdi
mov    -0x8(%rbp),%esi
call   1040 <pot_allocation@plt>
mov    $0x0,%al
call   1100 <clear_scanf_buffer@plt>
mov    $0x0,%al
call   10e0 <clear_screen@plt>
mov    -0x30(%rbp),%rdi
mov    -0x8(%rbp),%esi
call   1030 <print_table@plt>
mov    -0x30(%rbp),%rdi
mov    -0x8(%rbp),%esi
call   10c0 <generate_weather@plt>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
je     1346 <main+0x166>
mov    -0x30(%rbp),%rdi
mov    -0x8(%rbp),%esi
call   1090 <update_info@plt>
mov    -0x30(%rbp),%rdi
mov    -0x8(%rbp),%esi
call   1080 <post_weather_update@plt>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
je     1386 <main+0x1a6>
mov    -0x30(%rbp),%rdi
mov    -0x8(%rbp),%esi
call   10b0 <purchase@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1100 <clear_scanf_buffer@plt>
mov    $0x0,%al
call   10e0 <clear_screen@plt>
jmp    138b <main+0x1ab>
jmp    1390 <main+0x1b0>
jmp    12e4 <main+0x104>
mov    -0xc(%rbp),%esi
lea    0xcde(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x1,%edi
call   10f0 <wait@plt>
lea    0xcdc(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x1,%edi
call   10f0 <wait@plt>
lea    0xcc4(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x1,%edi
call   10f0 <wait@plt>
mov    $0x0,%al
call   10e0 <clear_screen@plt>
mov    -0x30(%rbp),%rdi
mov    -0x8(%rbp),%esi
call   1030 <print_table@plt>
mov    -0x30(%rbp),%rax
movl   $0x0,-0x24(%rbp)
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
imul   $0x18,%rcx,%rdx
mov    %rax,%rcx
add    %rdx,%rcx
mov    0x4(%rcx),%ecx
add    -0x24(%rbp),%ecx
mov    %ecx,-0x24(%rbp)
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
imul   $0x18,%rcx,%rdx
mov    %rax,%rcx
add    %rdx,%rcx
imul   $0x64,0xc(%rcx),%ecx
add    -0x24(%rbp),%ecx
mov    %ecx,-0x24(%rbp)
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
imul   $0x18,%rcx,%rdx
mov    %rax,%rcx
add    %rdx,%rcx
mov    0x14(%rcx),%ecx
add    -0x24(%rbp),%ecx
mov    %ecx,-0x24(%rbp)
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
cmpl   $0x0,0x18(%rax)
jne    14a2 <main+0x2c2>
mov    -0x30(%rbp),%rcx
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
cltq
imul   $0x18,%rax,%rdx
mov    %rcx,%rax
add    %rdx,%rax
mov    0x8(%rax),%eax
mov    -0x8(%rbp),%edx
sub    $0x1,%edx
movslq %edx,%rdx
imul   $0x18,%rdx,%rdx
add    %rdx,%rcx
sub    0x10(%rcx),%eax
imul   $0x5,%eax,%eax
add    -0x24(%rbp),%eax
mov    %eax,-0x24(%rbp)
jmp    14c0 <main+0x2e0>
mov    -0x30(%rbp),%rax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
imul   $0x5,0x8(%rax),%eax
add    -0x24(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
sub    $0x7d,%eax
mov    %eax,-0x24(%rbp)
lea    0xbc1(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x24(%rbp),%esi
lea    0xbd5(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0xc(%rbp),%esi
lea    0xbce(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x1,%edi
call   10f0 <wait@plt>
lea    0xbc8(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
cvtsi2sdl -0x24(%rbp),%xmm0
movsd  0xae2(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsi2sdl -0xc(%rbp),%xmm1
divsd  %xmm1,%xmm0
lea    0xbb7(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
lea    0xbb6(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x1,%edi
call   10f0 <wait@plt>
lea    0xbac(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
xor    %edi,%edi
call   10b0 <time@plt>
mov    %eax,%edi
call   1080 <srand@plt>
mov    0x2dcc(%rip),%rax
mov    (%rax),%edi
xor    %esi,%esi
call   1060 <setbuf@plt>
xor    %eax,%eax
call   10f0 <clear_screen@plt>
lea    0xded(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xe62(%rip),%rdi
lea    -0x24(%rbp),%rsi
call   10e0 <scanf@plt>
cmp    $0x1,%eax
jne    124d <main+0x5d>
cmpl   $0x0,-0x24(%rbp)
jg     1298 <main+0xa8>
lea    0xea1(%rip),%r14
lea    0xdbd(%rip),%r15
lea    0xe39(%rip),%r12
lea    -0x24(%rbp),%rbx
cs nopw 0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1040 <puts@plt>
mov    %r15,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   10e0 <scanf@plt>
cmp    $0x1,%eax
jne    1270 <main+0x80>
cmpl   $0x0,-0x24(%rbp)
jle    1270 <main+0x80>
xor    %eax,%eax
call   1110 <clear_scanf_buffer@plt>
xor    %eax,%eax
call   10f0 <clear_screen@plt>
mov    %rsp,%r12
mov    -0x24(%rbp),%eax
lea    (%rax,%rax,2),%rax
lea    0xf(,%rax,8),%rax
movabs $0x3ffffffff0,%rcx
and    %rax,%rcx
mov    %rsp,%rax
mov    %rax,%r14
sub    %rcx,%r14
neg    %rcx
mov    %r14,%rsp
movaps 0xd25(%rip),%xmm0
movaps %xmm0,(%rax,%rcx,1)
movq   $0xffffffffffffffff,0x10(%r14)
ff
movl   $0xffffffff,0x18(%r14)
ff
mov    -0x24(%rbp),%esi
test   %esi,%esi
jle    137c <main+0x18c>
mov    $0x1,%ebx
nop
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <print_table@plt>
mov    %r14,%rdi
mov    %ebx,%esi
call   1050 <pot_allocation@plt>
xor    %eax,%eax
call   1110 <clear_scanf_buffer@plt>
xor    %eax,%eax
call   10f0 <clear_screen@plt>
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <print_table@plt>
mov    %r14,%rdi
mov    %ebx,%esi
call   10d0 <generate_weather@plt>
cmp    -0x24(%rbp),%ebx
je     1345 <main+0x155>
mov    %r14,%rdi
mov    %ebx,%esi
call   10a0 <update_info@plt>
mov    %r14,%rdi
mov    %ebx,%esi
call   1090 <post_weather_update@plt>
cmp    -0x24(%rbp),%ebx
je     1384 <main+0x194>
mov    %r14,%rdi
mov    %ebx,%esi
call   10c0 <purchase@plt>
lea    0x1(%rbx),%r15d
xor    %eax,%eax
call   1110 <clear_scanf_buffer@plt>
xor    %eax,%eax
call   10f0 <clear_screen@plt>
mov    -0x24(%rbp),%esi
cmp    %esi,%ebx
mov    %r15d,%ebx
jl     1300 <main+0x110>
jmp    1389 <main+0x199>
mov    $0x1,%r15d
jmp    1389 <main+0x199>
mov    %ebx,%esi
mov    %ebx,%r15d
lea    0xcc6(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0x1,%edi
call   1100 <wait@plt>
lea    0xcc4(%rip),%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0x1,%edi
call   1100 <wait@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0x1,%edi
call   1100 <wait@plt>
xor    %eax,%eax
call   10f0 <clear_screen@plt>
mov    %r14,%rdi
mov    %r15d,%esi
call   1030 <print_table@plt>
add    $0xffffffff,%r15d
movslq %r15d,%rax
lea    (%rax,%rax,2),%rdi
mov    0x4(%r14,%rdi,8),%eax
mov    0x8(%r14,%rdi,8),%esi
mov    0xc(%r14,%rdi,8),%edx
mov    0x14(%r14,%rdi,8),%ecx
cmpl   $0x0,0x18(%r14,%rdi,8)
jne    140e <main+0x21e>
sub    0x10(%r14,%rdi,8),%esi
lea    (%rsi,%rsi,4),%esi
imul   $0x64,%edx,%edx
add    %edx,%eax
add    %ecx,%eax
lea    (%rax,%rsi,1),%ebx
add    $0xffffff83,%ebx
lea    0xc4a(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xc61(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1070 <printf@plt>
mov    -0x24(%rbp),%esi
lea    0xc58(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0x1,%edi
call   1100 <wait@plt>
lea    0xc52(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %ebx,%xmm0
mulsd  0xb9c(%rip),%xmm0
cvtsi2sdl -0x24(%rbp),%xmm1
divsd  %xmm1,%xmm0
lea    0xc43(%rip),%rdi
mov    $0x1,%al
call   1070 <printf@plt>
lea    0xc42(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%edi
call   1100 <wait@plt>
lea    0xc39(%rip),%rdi
call   1040 <puts@plt>
mov    %r12,%rsp
xor    %eax,%eax
lea    -0x20(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stdout = global i32 0
@.str = [62 x i8] c"Enter the number of days you'd like to play for (minimum 1): \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [50 x i8] c"Please enter a digit greater than 0, try again.\0A\0A\00"
@.str.3 = [25 x i8] c"\1B[0m\0A %d days are up! . \00"
@.str.4 = [3 x i8] c". \00"
@.str.5 = [37 x i8] c"\1B[0mCongratulations, you've earned $\00"
@.str.6 = [10 x i8] c"\1B[1;32m%d\00"
@.str.7 = [18 x i8] c"\1B[0m in %d days!\0A\00"
@.str.8 = [23 x i8] c"Extrapolated, that's $\00"
@.str.9 = [13 x i8] c"\1B[1;32m%.2lf\00"
@.str.10 = [14 x i8] c"\1B[0m a year!\0A\00"
@.str.11 = [21 x i8] c"Thanks for playing!\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i32
store i32 0, i32* %1
%7 = call i32 @time(i32* null)
%8 = call i32 @srand(i32 %7)
%9 = load i32, i32* @stdout
%10 = call i32 @setbuf(i32 %9, i32* null)
store i32 1, i32* %2
%11 = call i32 (...) @clear_screen()
br label %12
12: ; preds = %0, %22
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str, i64 0, i64 0))
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%15 = icmp ne i32 %14, 1
br i1 %15, label %19, label %16
16: ; preds = %12
%17 = load i32, i32* %3
%18 = icmp slt i32 %17, 1
br i1 %18, label %19, label %21
19: ; preds = %16, %12
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.2, i64 0, i64 0))
br label %22
21: ; preds = %16
br label %23
22: ; preds = %19
br label %12
23: ; preds = %21
%24 = call i32 (...) @clear_scanf_buffer()
%25 = call i32 (...) @clear_screen()
%26 = load i32, i32* %3
%27 = zext i32 %26 to i64
%28 = call i8* @llvm.stacksave()
store i8* %28, i8** %4
%29 = alloca [6 x i32], i64 %27
store i64 %27, i64* %5
%30 = load i32, i32* %2
%31 = getelementptr inbounds [6 x i32], [6 x i32]* %29, i64 0
%32 = getelementptr inbounds [6 x i32], [6 x i32]* %31, i64 0, i64 0
store i32 %30, i32* %32
%33 = getelementptr inbounds [6 x i32], [6 x i32]* %29, i64 0
%34 = getelementptr inbounds [6 x i32], [6 x i32]* %33, i64 0, i64 1
store i32 0, i32* %34
%35 = getelementptr inbounds [6 x i32], [6 x i32]* %29, i64 0
%36 = getelementptr inbounds [6 x i32], [6 x i32]* %35, i64 0, i64 2
store i32 5, i32* %36
%37 = getelementptr inbounds [6 x i32], [6 x i32]* %29, i64 0
%38 = getelementptr inbounds [6 x i32], [6 x i32]* %37, i64 0, i64 3
store i32 1, i32* %38
%39 = getelementptr inbounds [6 x i32], [6 x i32]* %29, i64 0
%40 = getelementptr inbounds [6 x i32], [6 x i32]* %39, i64 0, i64 4
store i32 -1, i32* %40
%41 = getelementptr inbounds [6 x i32], [6 x i32]* %29, i64 0
%42 = getelementptr inbounds [6 x i32], [6 x i32]* %41, i64 0, i64 5
store i32 -1, i32* %42
%43 = getelementptr inbounds [6 x i32], [6 x i32]* %29, i64 0
%44 = getelementptr inbounds [6 x i32], [6 x i32]* %43, i64 0, i64 6
store i32 -1, i32* %44
br label %45
45: ; preds = %87, %23
%46 = load i32, i32* %2
%47 = load i32, i32* %3
%48 = icmp sle i32 %46, %47
br i1 %48, label %49, label %88
49: ; preds = %45
%50 = bitcast [6 x i32]* %29 to i32**
%51 = load i32, i32* %2
%52 = call i32 @print_table(i32** %50, i32 %51)
%53 = bitcast [6 x i32]* %29 to i32**
%54 = load i32, i32* %2
%55 = call i32 @pot_allocation(i32** %53, i32 %54)
%56 = call i32 (...) @clear_scanf_buffer()
%57 = call i32 (...) @clear_screen()
%58 = bitcast [6 x i32]* %29 to i32**
%59 = load i32, i32* %2
%60 = call i32 @print_table(i32** %58, i32 %59)
%61 = bitcast [6 x i32]* %29 to i32**
%62 = load i32, i32* %2
%63 = call i32 @generate_weather(i32** %61, i32 %62)
%64 = load i32, i32* %2
%65 = load i32, i32* %3
%66 = icmp ne i32 %64, %65
br i1 %66, label %67, label %71
67: ; preds = %49
%68 = bitcast [6 x i32]* %29 to i32**
%69 = load i32, i32* %2
%70 = call i32 @update_info(i32** %68, i32 %69)
br label %71
71: ; preds = %67, %49
%72 = bitcast [6 x i32]* %29 to i32**
%73 = load i32, i32* %2
%74 = call i32 @post_weather_update(i32** %72, i32 %73)
%75 = load i32, i32* %2
%76 = load i32, i32* %3
%77 = icmp ne i32 %75, %76
br i1 %77, label %78, label %86
78: ; preds = %71
%79 = bitcast [6 x i32]* %29 to i32**
%80 = load i32, i32* %2
%81 = call i32 @purchase(i32** %79, i32 %80)
%82 = load i32, i32* %2
%83 = add nsw i32 %82, 1
store i32 %83, i32* %2
%84 = call i32 (...) @clear_scanf_buffer()
%85 = call i32 (...) @clear_screen()
br label %87
86: ; preds = %71
br label %88
87: ; preds = %78
br label %45
88: ; preds = %86, %45
%89 = load i32, i32* %3
%90 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i32 %89)
%91 = call i32 @wait(i32 1)
%92 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%93 = call i32 @wait(i32 1)
%94 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%95 = call i32 @wait(i32 1)
%96 = call i32 (...) @clear_screen()
%97 = bitcast [6 x i32]* %29 to i32**
%98 = load i32, i32* %2
%99 = call i32 @print_table(i32** %97, i32 %98)
store i32 0, i32* %6
%100 = load i32, i32* %2
%101 = sub nsw i32 %100, 1
%102 = sext i32 %101 to i64
%103 = getelementptr inbounds [6 x i32], [6 x i32]* %29, i64 %102
%104 = getelementptr inbounds [6 x i32], [6 x i32]* %103, i64 0, i64 1
%105 = load i32, i32* %104
%106 = load i32, i32* %6
%107 = add nsw i32 %106, %105
store i32 %107, i32* %6
%108 = load i32, i32* %2
%109 = sub nsw i32 %108, 1
%110 = sext i32 %109 to i64
%111 = getelementptr inbounds [6 x i32], [6 x i32]* %29, i64 %110
%112 = getelementptr inbounds [6 x i32], [6 x i32]* %111, i64 0, i64 3
%113 = load i32, i32* %112
%114 = mul nsw i32 100, %113
%115 = load i32, i32* %6
%116 = add nsw i32 %115, %114
store i32 %116, i32* %6
%117 = load i32, i32* %2
%118 = sub nsw i32 %117, 1
%119 = sext i32 %118 to i64
%120 = getelementptr inbounds [6 x i32], [6 x i32]* %29, i64 %119
%121 = getelementptr inbounds [6 x i32], [6 x i32]* %120, i64 0, i64 5
%122 = load i32, i32* %121
%123 = load i32, i32* %6
%124 = add nsw i32 %123, %122
store i32 %124, i32* %6
%125 = load i32, i32* %2
%126 = sub nsw i32 %125, 1
%127 = sext i32 %126 to i64
%128 = getelementptr inbounds [6 x i32], [6 x i32]* %29, i64 %127
%129 = getelementptr inbounds [6 x i32], [6 x i32]* %128, i64 0, i64 6
%130 = load i32, i32* %129
%131 = icmp eq i32 %130, 0
br i1 %131, label %132, label %149
132: ; preds = %88
%133 = load i32, i32* %2
%134 = sub nsw i32 %133, 1
%135 = sext i32 %134 to i64
%136 = getelementptr inbounds [6 x i32], [6 x i32]* %29, i64 %135
%137 = getelementptr inbounds [6 x i32], [6 x i32]* %136, i64 0, i64 2
%138 = load i32, i32* %137
%139 = load i32, i32* %2
%140 = sub nsw i32 %139, 1
%141 = sext i32 %140 to i64
%142 = getelementptr inbounds [6 x i32], [6 x i32]* %29, i64 %141
%143 = getelementptr inbounds [6 x i32], [6 x i32]* %142, i64 0, i64 4
%144 = load i32, i32* %143
%145 = sub nsw i32 %138, %144
%146 = mul nsw i32 5, %145
%147 = load i32, i32* %6
%148 = add nsw i32 %147, %146
store i32 %148, i32* %6
br label %159
149: ; preds = %88
%150 = load i32, i32* %2
%151 = sub nsw i32 %150, 1
%152 = sext i32 %151 to i64
%153 = getelementptr inbounds [6 x i32], [6 x i32]* %29, i64 %152
%154 = getelementptr inbounds [6 x i32], [6 x i32]* %153, i64 0, i64 2
%155 = load i32, i32* %154
%156 = mul nsw i32 5, %155
%157 = load i32, i32* %6
%158 = add nsw i32 %157, %156
store i32 %158, i32* %6
br label %159
159: ; preds = %149, %132
%160 = load i32, i32* %6
%161 = sub nsw i32 %160, 125
store i32 %161, i32* %6
%162 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.5, i64 0, i64 0))
%163 = load i32, i32* %6
%164 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i32 %163)
%165 = load i32, i32* %3
%166 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.7, i64 0, i64 0), i32 %165)
%167 = call i32 @wait(i32 1)
%168 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.8, i64 0, i64 0))
%169 = load i32, i32* %6
%170 = sitofp i32 %169 to double
%171 = fmul double %170, 3.650000e+02
%172 = load i32, i32* %3
%173 = sitofp i32 %172 to double
%174 = fdiv double %171, %173
%175 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.9, i64 0, i64 0), double %174)
%176 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.10, i64 0, i64 0))
%177 = call i32 @wait(i32 1)
%178 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.11, i64 0, i64 0))
store i32 0, i32* %1
%179 = load i8*, i8** %4
%180 = load i32, i32* %1
ret i32 %180
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [62 x i8] c"Enter the number of days you'd like to play for (minimum 1): \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.3 = [25 x i8] c"\1B[0m\0A %d days are up! . \00"
@.str.4 = [3 x i8] c". \00"
@.str.5 = [37 x i8] c"\1B[0mCongratulations, you've earned $\00"
@.str.6 = [10 x i8] c"\1B[1;32m%d\00"
@.str.7 = [18 x i8] c"\1B[0m in %d days!\0A\00"
@.str.8 = [23 x i8] c"Extrapolated, that's $\00"
@.str.9 = [13 x i8] c"\1B[1;32m%.2lf\00"
@str = [13 x i8] c"\1B[0m a year!\00"
@str.12 = [20 x i8] c"Thanks for playing!\00"
@str.13 = [49 x i8] c"Please enter a digit greater than 0, try again.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = tail call i32 @time(i32* null)
%3 = tail call i32 @srand(i32 %2)
%4 = load i32, i32* @stdout
%5 = tail call i32 @setbuf(i32 %4, i32* null)
%6 = bitcast i32* %1 to i8*
%7 = tail call i32 (...) @clear_screen()
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([62 x i8], [62 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%10 = icmp ne i32 %9, 1
%11 = load i32, i32* %1
%12 = icmp slt i32 %11, 1
%13 = select i1 %10, i1 true, i1 %12
br i1 %13, label %14, label %22
14: ; preds = %0, %14
%15 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @str.13, i64 0, i64 0))
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([62 x i8], [62 x i8]* @.str, i64 0, i64 0))
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%18 = icmp ne i32 %17, 1
%19 = load i32, i32* %1
%20 = icmp slt i32 %19, 1
%21 = select i1 %18, i1 true, i1 %20
br i1 %21, label %14, label %22
22: ; preds = %14, %0
%23 = call i32 (...) @clear_scanf_buffer()
%24 = call i32 (...) @clear_screen()
%25 = load i32, i32* %1
%26 = zext i32 %25 to i64
%27 = call i8* @llvm.stacksave()
%28 = alloca [6 x i32], i64 %26
%29 = bitcast [6 x i32]* %28 to <4 x i32>*
store <4 x i32> <i32 1, i32 0, i32 5, i32 1>, <4 x i32>* %29
%30 = getelementptr inbounds [6 x i32], [6 x i32]* %28, i64 0, i64 4
store i32 -1, i32* %30
%31 = getelementptr inbounds [6 x i32], [6 x i32]* %28, i64 0, i64 5
store i32 -1, i32* %31
%32 = getelementptr inbounds [6 x i32], [6 x i32]* %28, i64 0, i64 6
store i32 -1, i32* %32
%33 = load i32, i32* %1
%34 = icmp slt i32 %33, 1
br i1 %34, label %60, label %35
35: ; preds = %22
%36 = bitcast [6 x i32]* %28 to i32**
br label %37
37: ; preds = %35, %53
%38 = phi i32 [ 1, %35 ], [ %55, %53 ]
%39 = call i32 @print_table(i32** %36, i32 %38)
%40 = call i32 @pot_allocation(i32** %36, i32 %38)
%41 = call i32 (...) @clear_scanf_buffer()
%42 = call i32 (...) @clear_screen()
%43 = call i32 @print_table(i32** %36, i32 %38)
%44 = call i32 @generate_weather(i32** %36, i32 %38)
%45 = load i32, i32* %1
%46 = icmp eq i32 %38, %45
br i1 %46, label %49, label %47
47: ; preds = %37
%48 = call i32 @update_info(i32** %36, i32 %38)
br label %49
49: ; preds = %47, %37
%50 = call i32 @post_weather_update(i32** %36, i32 %38)
%51 = load i32, i32* %1
%52 = icmp eq i32 %38, %51
br i1 %52, label %60, label %53
53: ; preds = %49
%54 = call i32 @purchase(i32** %36, i32 %38)
%55 = add nuw nsw i32 %38, 1
%56 = call i32 (...) @clear_scanf_buffer()
%57 = call i32 (...) @clear_screen()
%58 = load i32, i32* %1
%59 = icmp slt i32 %38, %58
br i1 %59, label %37, label %60
60: ; preds = %53, %49, %22
%61 = phi i32 [ %33, %22 ], [ %38, %49 ], [ %58, %53 ]
%62 = phi i32 [ 1, %22 ], [ %38, %49 ], [ %55, %53 ]
%63 = bitcast [6 x i32]* %28 to i32**
%64 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i32 %61)
%65 = call i32 @wait(i32 1)
%66 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%67 = call i32 @wait(i32 1)
%68 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%69 = call i32 @wait(i32 1)
%70 = call i32 (...) @clear_screen()
%71 = call i32 @print_table(i32** %63, i32 %62)
%72 = add nsw i32 %62, -1
%73 = sext i32 %72 to i64
%74 = getelementptr inbounds [6 x i32], [6 x i32]* %28, i64 %73, i64 1
%75 = load i32, i32* %74
%76 = getelementptr inbounds [6 x i32], [6 x i32]* %28, i64 %73, i64 3
%77 = load i32, i32* %76
%78 = getelementptr inbounds [6 x i32], [6 x i32]* %28, i64 %73, i64 5
%79 = load i32, i32* %78
%80 = getelementptr inbounds [6 x i32], [6 x i32]* %28, i64 %73, i64 6
%81 = load i32, i32* %80
%82 = icmp eq i32 %81, 0
%83 = getelementptr inbounds [6 x i32], [6 x i32]* %28, i64 %73, i64 2
%84 = load i32, i32* %83
br i1 %82, label %85, label %89
85: ; preds = %60
%86 = getelementptr inbounds [6 x i32], [6 x i32]* %28, i64 %73, i64 4
%87 = load i32, i32* %86
%88 = sub nsw i32 %84, %87
br label %89
89: ; preds = %60, %85
%90 = phi i32 [ %88, %85 ], [ %84, %60 ]
%91 = mul nsw i32 %90, 5
%92 = mul nsw i32 %77, 100
%93 = add i32 %75, -125
%94 = add i32 %93, %92
%95 = add i32 %94, %79
%96 = add i32 %95, %91
%97 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.5, i64 0, i64 0))
%98 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i32 %96)
%99 = load i32, i32* %1
%100 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.7, i64 0, i64 0), i32 %99)
%101 = call i32 @wait(i32 1)
%102 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.8, i64 0, i64 0))
%103 = sitofp i32 %96 to double
%104 = fmul double %103, 3.650000e+02
%105 = load i32, i32* %1
%106 = sitofp i32 %105 to double
%107 = fdiv double %104, %106
%108 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.9, i64 0, i64 0), double %107)
%109 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
%110 = call i32 @wait(i32 1)
%111 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.12, i64 0, i64 0))
ret i32 0
}