#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 get_choice();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ putchar(char);
int main(int argc, const char *argv[]) {
  int choice;
  void count(void);
  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    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1060 <get_choice@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x71,%eax
je     11da <main+0x9a>
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
sub    $0x61,%eax
je     119f <main+0x5f>
jmp    117d <main+0x3d>
mov    -0x18(%rbp),%eax
sub    $0x62,%eax
je     11b0 <main+0x70>
jmp    118e <main+0x4e>
mov    -0x18(%rbp),%eax
sub    $0x63,%eax
je     11bf <main+0x7f>
jmp    11c9 <main+0x89>
lea    0xe5a(%rip),%rdi
call   1050 <printf@plt>
jmp    11d5 <main+0x95>
mov    $0x7,%edi
call   1040 <putchar@plt>
jmp    11d5 <main+0x95>
call   1030 <count@plt>
jmp    11d5 <main+0x95>
lea    0xe45(%rip),%rdi
call   1050 <printf@plt>
jmp    1156 <main+0x16>
lea    0xe44(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x20,%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    1165 <main+0x25>
nopl   0x0(%rax)
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    1165 <main+0x25>
nopw   0x0(%rax,%rax,1)
mov    $0x7,%edi
call   1040 <putchar@plt>
jmp    1165 <main+0x25>
nopl   0x0(%rax)
mov    %r14,%rdi
call   1050 <puts@plt>
jmp    1165 <main+0x25>
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(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
br label %7
7: ; preds = %19, %2
%8 = call i32 (...) @get_choice()
store i32 %8, i32* %6
%9 = icmp ne i32 %8, 113
br i1 %9, label %10, label %20
10: ; preds = %7
%11 = load i32, i32* %6
switch i32 %11, label %17 [
i32 97, label %12
i32 98, label %14
i32 99, label %16
]
12: ; preds = %10
%13 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
br label %19
14: ; preds = %10
%15 = call i32 @putchar(i8 signext 7)
br label %19
16: ; preds = %10
br label %19
17: ; preds = %10
%18 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
br label %19
19: ; preds = %17, %16, %14, %12
br label %7
20: ; preds = %7
%21 = 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(i32 %0, i8** nocapture readnone %1) {
br label %3
3: ; preds = %12, %2
%4 = tail call i32 (...) @get_choice()
switch i32 %4, label %10 [
i32 113, label %13
i32 97, label %5
i32 98, label %7
i32 99, label %9
]
5: ; preds = %3
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.3, i64 0, i64 0))
br label %12
7: ; preds = %3
%8 = tail call i32 @putchar(i8 signext 7)
br label %12
9: ; preds = %3
tail call void @count()
br label %12
10: ; preds = %3
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.4, i64 0, i64 0))
br label %12
12: ; preds = %10, %9, %7, %5
br label %3
13: ; preds = %3
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0))
ret i32 0
}