#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*/ printf(char *, long);
int /*<<< orphan*/ puts(char *);
int main() {
  short int dice;
  long int money = 0;
  puts("Monopoly money calculator\n");
  for (dice = 0; dice < 35000; dice += 40) {
    money += 200;
    printf("Roll %d\r", dice);
  }
  puts("\n");
  printf("You have made a total of $%d!\n", money);
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
lea    0xec2(%rip),%rdi
call   1030 <puts@plt>
movw   $0x0,-0x6(%rbp)
movswl -0x6(%rbp),%eax
cmp    $0x88b8,%eax
jge    1187 <main+0x67>
mov    -0x10(%rbp),%rax
add    $0xc8,%rax
mov    %rax,-0x10(%rbp)
movswq -0x6(%rbp),%rsi
lea    0xea9(%rip),%rdi
call   1040 <printf@plt>
movswl -0x6(%rbp),%eax
add    $0x28,%eax
mov    %ax,-0x6(%rbp)
jmp    1149 <main+0x29>
lea    0xeb3(%rip),%rdi
call   1030 <puts@plt>
mov    -0x10(%rbp),%rsi
lea    0xe86(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xed5(%rip),%rdi
call   1030 <puts@plt>
xor    %ebx,%ebx
lea    0xee2(%rip),%r14
nopl   0x0(%rax)
movswq %bx,%rsi
mov    %r14,%rdi
call   1040 <printf@plt>
add    $0x28,%ebx
jmp    1140 <main+0x20>

LLVM IR (-O0):
@.str = [27 x i8] c"Monopoly money calculator\0A\00"
@.str.1 = [9 x i8] c"Roll %d\0D\00"
@.str.2 = [2 x i8] c"\0A\00"
@.str.3 = [31 x i8] c"You have made a total of $%d!\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i16
%3 = alloca i64
store i32 0, i32* %1
store i64 0, i64* %3
%4 = call i32 @puts(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
store i16 0, i16* %2
br label %5
5: ; preds = %15, %0
%6 = load i16, i16* %2
%7 = sext i16 %6 to i32
%8 = icmp slt i32 %7, 35000
br i1 %8, label %9, label %20
9: ; preds = %5
%10 = load i64, i64* %3
%11 = add nsw i64 %10, 200
store i64 %11, i64* %3
%12 = load i16, i16* %2
%13 = sext i16 %12 to i64
%14 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i64 %13)
br label %15
15: ; preds = %9
%16 = load i16, i16* %2
%17 = sext i16 %16 to i32
%18 = add nsw i32 %17, 40
%19 = trunc i32 %18 to i16
store i16 %19, i16* %2
br label %5
20: ; preds = %5
%21 = call i32 @puts(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%22 = load i64, i64* %3
%23 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0), i64 %22)
ret i32 0
}

LLVM IR (-O2):
@.str = [27 x i8] c"Monopoly money calculator\0A\00"
@.str.1 = [9 x i8] c"Roll %d\0D\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
br label %2
2: ; preds = %2, %0
%3 = phi i16 [ 0, %0 ], [ %6, %2 ]
%4 = sext i16 %3 to i64
%5 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i64 %4)
%6 = add i16 %3, 40
br label %2
}