#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*/ count();
int get_choice();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ putchar(char);
int main(void) {
  int choice;
  while ((choice = get_choice()) != 'q') {
    switch (choice) {
    case 'a':
      printf("Buy low, sell high.\n");
      break;
    case 'b':
      putchar('\a');
      break;
    case 'c':
      count();
      break;
    default:
      printf("Program error!\n");
      break;
    }
  }
  printf("Bye.\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1060 <get_choice@plt>
mov    %eax,-0x8(%rbp)
cmp    $0x71,%eax
je     11d5 <main+0x95>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
sub    $0x61,%eax
je     1198 <main+0x58>
jmp    1176 <main+0x36>
mov    -0xc(%rbp),%eax
sub    $0x62,%eax
je     11a9 <main+0x69>
jmp    1187 <main+0x47>
mov    -0xc(%rbp),%eax
sub    $0x63,%eax
je     11b8 <main+0x78>
jmp    11c4 <main+0x84>
lea    0xe61(%rip),%rdi
call   1050 <printf@plt>
jmp    11d0 <main+0x90>
mov    $0x7,%edi
call   1040 <putchar@plt>
jmp    11d0 <main+0x90>
mov    $0x0,%al
call   1030 <count@plt>
jmp    11d0 <main+0x90>
lea    0xe4a(%rip),%rdi
call   1050 <printf@plt>
jmp    114f <main+0xf>
lea    0xe49(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
lea    0xf11(%rip),%r14
lea    0xead(%rip),%rbx
lea    0xeef(%rip),%r15
jmp    1167 <main+0x27>
nopl   0x0(%rax)
xor    %eax,%eax
call   1030 <count@plt>
xor    %eax,%eax
call   1060 <get_choice@plt>
add    $0xffffff9f,%eax
cmp    $0x10,%eax
ja     11a0 <main+0x60>
movslq (%rbx,%rax,4),%rax
add    %rbx,%rax
jmp    *%rax
mov    %r15,%rdi
call   1050 <puts@plt>
jmp    1167 <main+0x27>
nopl   0x0(%rax)
mov    $0x7,%edi
call   1040 <putchar@plt>
jmp    1167 <main+0x27>
nopl   0x0(%rax)
mov    %r14,%rdi
call   1050 <puts@plt>
jmp    1167 <main+0x27>
lea    0xe93(%rip),%rdi
call   1050 <puts@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [21 x i8] c"Buy low, sell high.\0A\00"
@.str.1 = [16 x i8] c"Program error!\0A\00"
@.str.2 = [6 x i8] c"Bye.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
br label %3
3: ; preds = %16, %0
%4 = call i32 (...) @get_choice()
store i32 %4, i32* %2
%5 = icmp ne i32 %4, 113
br i1 %5, label %6, label %17
6: ; preds = %3
%7 = load i32, i32* %2
switch i32 %7, label %14 [
i32 97, label %8
i32 98, label %10
i32 99, label %12
]
8: ; preds = %6
%9 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
br label %16
10: ; preds = %6
%11 = call i32 @putchar(i8 signext 7)
br label %16
12: ; preds = %6
%13 = call i32 (...) @count()
br label %16
14: ; preds = %6
%15 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
br label %16
16: ; preds = %14, %12, %10, %8
br label %3
17: ; preds = %3
%18 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [5 x i8] c"Bye.\00"
@str.3 = [20 x i8] c"Buy low, sell high.\00"
@str.4 = [15 x i8] c"Program error!\00"
define i32 @main() {
br label %1
1: ; preds = %11, %0
%2 = tail call i32 (...) @get_choice()
switch i32 %2, label %9 [
i32 113, label %12
i32 97, label %3
i32 98, label %5
i32 99, label %7
]
3: ; preds = %1
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.3, i64 0, i64 0))
br label %11
5: ; preds = %1
%6 = tail call i32 @putchar(i8 signext 7)
br label %11
7: ; preds = %1
%8 = tail call i32 (...) @count()
br label %11
9: ; preds = %1
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.4, i64 0, i64 0))
br label %11
11: ; preds = %9, %7, %5, %3
br label %1
12: ; preds = %1
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0))
ret i32 0
}