#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*/ clearScreen();
int cslls(int, int, int, int, int, int);
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, ...);
int gameplay(int diff, int whr) {
  int numg, nums, prcg, cstg, totalp, slls, csts, prcc, prcs, x, y;
  switch (diff) {
  case 1:
    cstg = 5;
    prcs = 30;
    prcc = 20;
    break;
  case 2:
    cstg = 7;
    prcs = 40;
    prcc = 15;
    break;
  case 3:
    cstg = 9;
    prcs = 50;
    prcc = 12;
    break;
  }
  clearScreen();
  printf("\n\n\t  Manage your stand for today!");
  printf("\n\t");
  printf("\n\tRemember:");
  printf("\n\tCost per glass: %ic", cstg);
  printf("\n\tCost per signal: %ic", csts);
  printf("\n\tAverage competence price per glass: %ic", prcc);
  printf("\n\tWeather: ");
  switch (whr) {
  case 1:
    printf("hot");
    break;
  case 2:
    printf("sunny");
    break;
  case 3:
    printf("cloudy");
    break;
  case 4:
    printf("stormy");
    break;
  }
  printf("\n\n");
  do {
    x = 0;
    printf("\n\tHow many signals will you use? ");
    scanf("%d", &nums);
    printf("\n\tHow many glasses of lemonade will you make? ");
    scanf("%d", &numg);
    printf("\n\tHow much cents per glass will you ask? ");
    scanf("%d", &prcg);
    printf("\n");
    printf("\n\tAre these values right? (Y/N)");
    char slct;
    do {
      scanf(" %c", &slct);
      y = 1;
      switch (slct) {
      case 'Y':
      case 'y':
        printf("\tOK ");
        x = 0;
        y = 1;
        break;
      case 'N':
      case 'n':
        printf("\tPress ENTER to set values again ");
        x = 1;
        y = 1;
        getchar();
        break;
      default:
        printf("\tOption not recognised. Try again... ");
        y = 0;
        break;
      }
    } while (y == 0);
  } while (x == 1);
  clearScreen();
  printf("\n");
  printf("\n\tThe sells for today were...");
  slls = cslls(numg, prcg, nums, diff, whr, prcc);
  totalp = ((slls * prcg) - ((numg * cstg) + (nums * csts)));
  printf("\n");
  printf("\n");
  printf("\n\tYou sold %i glasses.", slls);
  if (totalp < 0) {
    printf("\n\tYou lost %i today", totalp);
  } else {
    printf("\n\tYou won %i today", totalp);
  }
  getchar();
  getchar();
  return totalp;
}


x86 assembly (clang, -O0):
<gameplay>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x3c(%rbp)
sub    $0x1,%eax
je     1194 <gameplay+0x44>
jmp    1172 <gameplay+0x22>
mov    -0x3c(%rbp),%eax
sub    $0x2,%eax
je     11ae <gameplay+0x5e>
jmp    1183 <gameplay+0x33>
mov    -0x3c(%rbp),%eax
sub    $0x3,%eax
je     11c8 <gameplay+0x78>
jmp    11dd <gameplay+0x8d>
movl   $0x5,-0x18(%rbp)
movl   $0x1e,-0x2c(%rbp)
movl   $0x14,-0x28(%rbp)
jmp    11dd <gameplay+0x8d>
movl   $0x7,-0x18(%rbp)
movl   $0x28,-0x2c(%rbp)
movl   $0xf,-0x28(%rbp)
jmp    11dd <gameplay+0x8d>
movl   $0x9,-0x18(%rbp)
movl   $0x32,-0x2c(%rbp)
movl   $0xc,-0x28(%rbp)
xor    %eax,%eax
mov    %al,-0x49(%rbp)
call   1060 <clearScreen@plt>
mov    -0x49(%rbp),%al
lea    0xe1f(%rip),%rdi
call   1040 <printf@plt>
mov    -0x49(%rbp),%al
lea    0xe32(%rip),%rdi
call   1040 <printf@plt>
mov    -0x49(%rbp),%al
lea    0xe26(%rip),%rdi
call   1040 <printf@plt>
mov    -0x49(%rbp),%al
mov    -0x18(%rbp),%esi
lea    0xe20(%rip),%rdi
call   1040 <printf@plt>
mov    -0x49(%rbp),%al
mov    -0x24(%rbp),%esi
lea    0xe24(%rip),%rdi
call   1040 <printf@plt>
mov    -0x49(%rbp),%al
mov    -0x28(%rbp),%esi
lea    0xe29(%rip),%rdi
call   1040 <printf@plt>
mov    -0x49(%rbp),%al
lea    0xe44(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x48(%rbp)
sub    $0x3,%eax
ja     12c9 <gameplay+0x179>
mov    -0x48(%rbp),%rax
lea    0xd87(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xe1b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    12c9 <gameplay+0x179>
lea    0xe0c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    12c9 <gameplay+0x179>
lea    0xdff(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    12c9 <gameplay+0x179>
lea    0xdf3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xdec(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x30(%rbp)
lea    0xdda(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xdee(%rip),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1070 <scanf@plt>
lea    0xddf(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xdce(%rip),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x0,%al
call   1070 <scanf@plt>
lea    0xdee(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xdae(%rip),%rdi
lea    -0x14(%rbp),%rsi
mov    $0x0,%al
call   1070 <scanf@plt>
lea    0xd78(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xdea(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xdfc(%rip),%rdi
xor    %eax,%eax
lea    -0x35(%rbp),%rsi
call   1070 <scanf@plt>
movl   $0x1,-0x34(%rbp)
movsbl -0x35(%rbp),%eax
mov    %eax,-0x50(%rbp)
sub    $0x4e,%eax
je     13dc <gameplay+0x28c>
jmp    1388 <gameplay+0x238>
mov    -0x50(%rbp),%eax
sub    $0x59,%eax
je     13bb <gameplay+0x26b>
jmp    1399 <gameplay+0x249>
mov    -0x50(%rbp),%eax
sub    $0x6e,%eax
je     13dc <gameplay+0x28c>
jmp    13aa <gameplay+0x25a>
mov    -0x50(%rbp),%eax
sub    $0x79,%eax
jne    1404 <gameplay+0x2b4>
jmp    13bb <gameplay+0x26b>
lea    0xd9f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x30(%rbp)
movl   $0x1,-0x34(%rbp)
jmp    1419 <gameplay+0x2c9>
lea    0xd83(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x30(%rbp)
movl   $0x1,-0x34(%rbp)
mov    $0x0,%al
call   1050 <getchar@plt>
jmp    1419 <gameplay+0x2c9>
lea    0xd7d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x34(%rbp)
jmp    141e <gameplay+0x2ce>
cmpl   $0x0,-0x34(%rbp)
je     135a <gameplay+0x20a>
jmp    142d <gameplay+0x2dd>
cmpl   $0x1,-0x30(%rbp)
je     12d7 <gameplay+0x187>
mov    $0x0,%al
call   1060 <clearScreen@plt>
lea    0xc78(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xd5b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0xc(%rbp),%edi
mov    -0x14(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x4(%rbp),%ecx
mov    -0x8(%rbp),%r8d
mov    -0x28(%rbp),%r9d
call   1030 <cslls@plt>
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
imul   -0x14(%rbp),%eax
mov    -0xc(%rbp),%ecx
imul   -0x18(%rbp),%ecx
mov    -0x10(%rbp),%edx
imul   -0x24(%rbp),%edx
add    %edx,%ecx
sub    %ecx,%eax
mov    %eax,-0x1c(%rbp)
lea    0xc24(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xc16(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x20(%rbp),%esi
lea    0xd14(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
cmpl   $0x0,-0x1c(%rbp)
jge    14df <gameplay+0x38f>
mov    -0x1c(%rbp),%esi
lea    0xd10(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    14f0 <gameplay+0x3a0>
mov    -0x1c(%rbp),%esi
lea    0xd0e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    -0x1c(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gameplay>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %esi,%r14d
cmp    $0x3,%edi
mov    %edi,0x18(%rsp)
je     119b <gameplay+0x2b>
cmp    $0x2,%edi
jne    11a7 <gameplay+0x37>
mov    $0xf,%ebx
mov    $0x7,%ebp
jmp    11b1 <gameplay+0x41>
mov    $0xc,%ebx
mov    $0x9,%ebp
jmp    11b1 <gameplay+0x41>
mov    $0x14,%ebx
mov    $0x5,%ebp
xor    %eax,%eax
call   1080 <clearScreen@plt>
lea    0xe41(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe55(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe4a(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe48(%rip),%rdi
mov    %ebp,0x14(%rsp)
mov    %ebp,%esi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe4a(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe53(%rip),%rdi
mov    %ebx,0x1c(%rsp)
mov    %ebx,%esi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe69(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r14,0x20(%rsp)
lea    -0x1(%r14),%eax
cmp    $0x3,%eax
ja     124b <gameplay+0xdb>
cltq
lea    0xfbf(%rip),%rcx
movslq (%rcx,%rax,4),%rdi
add    %rcx,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xfa5(%rip),%rdi
call   1040 <puts@plt>
lea    0xe4e(%rip),%rdi
lea    0xe69(%rip),%rbp
lea    0xc(%rsp),%rbx
lea    0x8(%rsp),%r14
lea    0xeb4(%rip),%r13
lea    0xecd(%rip),%r15
lea    0x7(%rsp),%r12
xor    %eax,%eax
call   1060 <printf@plt>
mov    %rbp,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1090 <scanf@plt>
lea    0xe34(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %rbp,%rdi
lea    0x10(%rsp),%rsi
xor    %eax,%eax
call   1090 <scanf@plt>
lea    0xe46(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %rbp,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1090 <scanf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %r13,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe8c(%rip),%rbx
jmp    12fa <gameplay+0x18a>
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1090 <scanf@plt>
movsbl 0x7(%rsp),%eax
cmp    $0x6d,%eax
jg     1320 <gameplay+0x1b0>
cmp    $0x4e,%eax
je     1330 <gameplay+0x1c0>
cmp    $0x59,%eax
jne    12f0 <gameplay+0x180>
jmp    1369 <gameplay+0x1f9>
nopl   (%rax)
cmp    $0x6e,%eax
je     1330 <gameplay+0x1c0>
cmp    $0x79,%eax
jne    12f0 <gameplay+0x180>
jmp    1369 <gameplay+0x1f9>
nopl   0x0(%rax)
lea    0xe1c(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
xor    %eax,%eax
call   1070 <getchar@plt>
lea    0xc(%rsp),%rbx
lea    0xd5b(%rip),%rdi
lea    0xd76(%rip),%rbp
lea    0x8(%rsp),%r14
lea    0xdc6(%rip),%r13
jmp    1282 <gameplay+0x112>
lea    0xdde(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
xor    %eax,%eax
call   1080 <clearScreen@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe0c(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x10(%rsp),%edi
mov    0x8(%rsp),%esi
mov    0xc(%rsp),%edx
mov    0x18(%rsp),%ecx
mov    0x20(%rsp),%r8
mov    0x1c(%rsp),%r9d
call   1050 <cslls@plt>
mov    %eax,%r14d
mov    0x8(%rsp),%ebp
imul   %eax,%ebp
mov    0x14(%rsp),%ebx
imul   0x10(%rsp),%ebx
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xdd6(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1060 <printf@plt>
sub    %ebx,%ebp
lea    0xdda(%rip),%rax
lea    0xde7(%rip),%rdi
cmovs  %rax,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1060 <printf@plt>
xor    %eax,%eax
call   1070 <getchar@plt>
xor    %eax,%eax
call   1070 <getchar@plt>
mov    %ebp,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [34 x i8] c"\0A\0A\09 Manage your stand for today!\00"
@.str.1 = [3 x i8] c"\0A\09\00"
@.str.2 = [12 x i8] c"\0A\09Remember:\00"
@.str.3 = [22 x i8] c"\0A\09Cost per glass: %ic\00"
@.str.4 = [23 x i8] c"\0A\09Cost per signal: %ic\00"
@.str.5 = [42 x i8] c"\0A\09Average competence price per glass: %ic\00"
@.str.6 = [12 x i8] c"\0A\09Weather: \00"
@.str.7 = [4 x i8] c"hot\00"
@.str.8 = [6 x i8] c"sunny\00"
@.str.9 = [7 x i8] c"cloudy\00"
@.str.10 = [7 x i8] c"stormy\00"
@.str.11 = [3 x i8] c"\0A\0A\00"
@.str.12 = [34 x i8] c"\0A\09How many signals will you use? \00"
@.str.13 = [3 x i8] c"%d\00"
@.str.14 = [47 x i8] c"\0A\09How many glasses of lemonade will you make? \00"
@.str.15 = [42 x i8] c"\0A\09How much cents per glass will you ask? \00"
@.str.16 = [2 x i8] c"\0A\00"
@.str.17 = [32 x i8] c"\0A\09Are these values right? (Y/N)\00"
@.str.18 = [4 x i8] c" %c\00"
@.str.19 = [5 x i8] c"\09OK \00"
@.str.20 = [34 x i8] c"\09Press ENTER to set values again \00"
@.str.21 = [38 x i8] c"\09Option not recognised. Try again... \00"
@.str.22 = [30 x i8] c"\0A\09The sells for today were...\00"
@.str.23 = [23 x i8] c"\0A\09You sold %i glasses.\00"
@.str.24 = [20 x i8] c"\0A\09You lost %i today\00"
@.str.25 = [19 x i8] c"\0A\09You won %i today\00"
define i32 @gameplay(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i8
store i32 %0, i32* %3
store i32 %1, i32* %4
%17 = load i32, i32* %3
switch i32 %17, label %21 [
i32 1, label %18
i32 2, label %19
i32 3, label %20
]
18: ; preds = %2
store i32 5, i32* %8
store i32 30, i32* %13
store i32 20, i32* %12
br label %21
19: ; preds = %2
store i32 7, i32* %8
store i32 40, i32* %13
store i32 15, i32* %12
br label %21
20: ; preds = %2
store i32 9, i32* %8
store i32 50, i32* %13
store i32 12, i32* %12
br label %21
21: ; preds = %2, %20, %19, %18
%22 = call i32 (...) @clearScreen()
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%26 = load i32, i32* %8
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i32 %26)
%28 = load i32, i32* %11
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), i32 %28)
%30 = load i32, i32* %12
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.5, i64 0, i64 0), i32 %30)
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0))
%33 = load i32, i32* %4
switch i32 %33, label %42 [
i32 1, label %34
i32 2, label %36
i32 3, label %38
i32 4, label %40
]
34: ; preds = %21
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
br label %42
36: ; preds = %21
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0))
br label %42
38: ; preds = %21
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0))
br label %42
40: ; preds = %21
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.10, i64 0, i64 0))
br label %42
42: ; preds = %21, %40, %38, %36, %34
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0))
br label %44
44: ; preds = %69, %42
store i32 0, i32* %14
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.12, i64 0, i64 0))
%46 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i64 0, i64 0), i32* %6)
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.14, i64 0, i64 0))
%48 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i64 0, i64 0), i32* %5)
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.15, i64 0, i64 0))
%50 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i64 0, i64 0), i32* %7)
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.16, i64 0, i64 0))
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.17, i64 0, i64 0))
br label %53
53: ; preds = %65, %44
%54 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.18, i64 0, i64 0), i8* %16)
store i32 1, i32* %15
%55 = load i8, i8* %16
%56 = sext i8 %55 to i32
switch i32 %56, label %62 [
i32 89, label %57
i32 121, label %57
i32 78, label %59
i32 110, label %59
]
57: ; preds = %53, %53
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.19, i64 0, i64 0))
store i32 0, i32* %14
store i32 1, i32* %15
br label %64
59: ; preds = %53, %53
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.20, i64 0, i64 0))
store i32 1, i32* %14
store i32 1, i32* %15
%61 = call i32 (...) @getchar()
br label %64
62: ; preds = %53
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.21, i64 0, i64 0))
store i32 0, i32* %15
br label %64
64: ; preds = %62, %59, %57
br label %65
65: ; preds = %64
%66 = load i32, i32* %15
%67 = icmp eq i32 %66, 0
br i1 %67, label %53, label %68
68: ; preds = %65
br label %69
69: ; preds = %68
%70 = load i32, i32* %14
%71 = icmp eq i32 %70, 1
br i1 %71, label %44, label %72
72: ; preds = %69
%73 = call i32 (...) @clearScreen()
%74 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.16, i64 0, i64 0))
%75 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.22, i64 0, i64 0))
%76 = load i32, i32* %5
%77 = load i32, i32* %7
%78 = load i32, i32* %6
%79 = load i32, i32* %3
%80 = load i32, i32* %4
%81 = load i32, i32* %12
%82 = call i32 @cslls(i32 %76, i32 %77, i32 %78, i32 %79, i32 %80, i32 %81)
store i32 %82, i32* %10
%83 = load i32, i32* %10
%84 = load i32, i32* %7
%85 = mul nsw i32 %83, %84
%86 = load i32, i32* %5
%87 = load i32, i32* %8
%88 = mul nsw i32 %86, %87
%89 = load i32, i32* %6
%90 = load i32, i32* %11
%91 = mul nsw i32 %89, %90
%92 = add nsw i32 %88, %91
%93 = sub nsw i32 %85, %92
store i32 %93, i32* %9
%94 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.16, i64 0, i64 0))
%95 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.16, i64 0, i64 0))
%96 = load i32, i32* %10
%97 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.23, i64 0, i64 0), i32 %96)
%98 = load i32, i32* %9
%99 = icmp slt i32 %98, 0
br i1 %99, label %100, label %103
100: ; preds = %72
%101 = load i32, i32* %9
%102 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.24, i64 0, i64 0), i32 %101)
br label %106
103: ; preds = %72
%104 = load i32, i32* %9
%105 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.25, i64 0, i64 0), i32 %104)
br label %106
106: ; preds = %103, %100
%107 = call i32 (...) @getchar()
%108 = call i32 (...) @getchar()
%109 = load i32, i32* %9
ret i32 %109
}

LLVM IR (-O2):
@.str = [34 x i8] c"\0A\0A\09 Manage your stand for today!\00"
@.str.1 = [3 x i8] c"\0A\09\00"
@.str.2 = [12 x i8] c"\0A\09Remember:\00"
@.str.3 = [22 x i8] c"\0A\09Cost per glass: %ic\00"
@.str.4 = [23 x i8] c"\0A\09Cost per signal: %ic\00"
@.str.5 = [42 x i8] c"\0A\09Average competence price per glass: %ic\00"
@.str.6 = [12 x i8] c"\0A\09Weather: \00"
@.str.7 = [4 x i8] c"hot\00"
@.str.8 = [6 x i8] c"sunny\00"
@.str.9 = [7 x i8] c"cloudy\00"
@.str.10 = [7 x i8] c"stormy\00"
@.str.12 = [34 x i8] c"\0A\09How many signals will you use? \00"
@.str.13 = [3 x i8] c"%d\00"
@.str.14 = [47 x i8] c"\0A\09How many glasses of lemonade will you make? \00"
@.str.15 = [42 x i8] c"\0A\09How much cents per glass will you ask? \00"
@.str.17 = [32 x i8] c"\0A\09Are these values right? (Y/N)\00"
@.str.18 = [4 x i8] c" %c\00"
@.str.19 = [5 x i8] c"\09OK \00"
@.str.20 = [34 x i8] c"\09Press ENTER to set values again \00"
@.str.21 = [38 x i8] c"\09Option not recognised. Try again... \00"
@.str.22 = [30 x i8] c"\0A\09The sells for today were...\00"
@.str.23 = [23 x i8] c"\0A\09You sold %i glasses.\00"
@.str.24 = [20 x i8] c"\0A\09You lost %i today\00"
@.str.25 = [19 x i8] c"\0A\09You won %i today\00"
@str = [2 x i8] c"\0A\00"
@reltable.gameplay = [4 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.7 to i64), i64 ptrtoint ([4 x i32]* @reltable.gameplay to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.8 to i64), i64 ptrtoint ([4 x i32]* @reltable.gameplay to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.9 to i64), i64 ptrtoint ([4 x i32]* @reltable.gameplay to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.10 to i64), i64 ptrtoint ([4 x i32]* @reltable.gameplay to i64)) to i32)]
define i32 @gameplay(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8
%7 = bitcast i32* %3 to i8*
%8 = bitcast i32* %4 to i8*
%9 = bitcast i32* %5 to i8*
switch i32 %0, label %12 [
i32 3, label %11
i32 2, label %10
]
10: ; preds = %2
br label %12
11: ; preds = %2
br label %12
12: ; preds = %2, %11, %10
%13 = phi i32 [ 9, %11 ], [ 7, %10 ], [ 5, %2 ]
%14 = phi i32 [ 12, %11 ], [ 15, %10 ], [ 20, %2 ]
%15 = tail call i32 (...) @clearScreen()
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i32 %13)
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), i32 undef)
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.5, i64 0, i64 0), i32 %14)
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0))
%23 = add i32 %1, -1
%24 = icmp ult i32 %23, 4
br i1 %24, label %25, label %30
25: ; preds = %12
%26 = sext i32 %23 to i64
%27 = shl i64 %26, 2
%28 = call i8* @llvm.load.relative.i64(i8* bitcast ([4 x i32]* @reltable.gameplay to i8*), i64 %27)
%29 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) %28)
br label %30
30: ; preds = %12, %25
%31 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
br label %32
32: ; preds = %47, %30
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.12, i64 0, i64 0))
%34 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i64 0, i64 0), i32* %4)
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @.str.14, i64 0, i64 0))
%36 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i64 0, i64 0), i32* %3)
%37 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.15, i64 0, i64 0))
%38 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i64 0, i64 0), i32* %5)
%39 = call i32 @putchar(i32 10)
%40 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.17, i64 0, i64 0))
br label %41
41: ; preds = %45, %32
%42 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.18, i64 0, i64 0), i8* %6)
%43 = load i8, i8* %6
%44 = sext i8 %43 to i32
switch i32 %44, label %45 [
i32 89, label %50
i32 121, label %50
i32 78, label %47
i32 110, label %47
]
45: ; preds = %41
%46 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.21, i64 0, i64 0))
br label %41
47: ; preds = %41, %41
%48 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.20, i64 0, i64 0))
%49 = call i32 (...) @getchar()
br label %32
50: ; preds = %41, %41
%51 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.19, i64 0, i64 0))
%52 = call i32 (...) @clearScreen()
%53 = call i32 @putchar(i32 10)
%54 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.22, i64 0, i64 0))
%55 = load i32, i32* %3
%56 = load i32, i32* %5
%57 = load i32, i32* %4
%58 = call i32 @cslls(i32 %55, i32 %56, i32 %57, i32 %0, i32 %1, i32 %14)
%59 = load i32, i32* %5
%60 = mul nsw i32 %59, %58
%61 = load i32, i32* %3
%62 = mul nsw i32 %61, %13
%63 = sub nsw i32 %60, %62
%64 = call i32 @putchar(i32 10)
%65 = call i32 @putchar(i32 10)
%66 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.23, i64 0, i64 0), i32 %58)
%67 = icmp slt i32 %63, 0
%68 = select i1 %67, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.24, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.25, i64 0, i64 0)
%69 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %68, i32 %63)
%70 = call i32 (...) @getchar()
%71 = call i32 (...) @getchar()
ret i32 %63
}