#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*/ puts(char *);
int /*<<< orphan*/ scanf(char *, char *);
int main() {
  int i;
  char code[26] = "";
  scanf("%s", code);
  for (i = 0; code[i] != '\0'; i++) {
    switch (code[i]) {
    case 'h':
    case 'H':
      puts("Hello, world!");
      break;
    case 'q':
    case 'Q':
      puts(code);
      break;
    case '9':
      puts("99 Bottles of Beer on the Wall");
      break;
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x1a,%edx
call   1040 <memset@plt>
lea    -0x30(%rbp),%rsi
lea    0xea6(%rip),%rdi
call   1050 <scanf@plt>
movl   $0x0,-0x8(%rbp)
movslq -0x8(%rbp),%rax
movsbl -0x30(%rbp,%rax,1),%eax
cmp    $0x0,%eax
je     1214 <main+0xe4>
movslq -0x8(%rbp),%rax
movsbl -0x30(%rbp,%rax,1),%eax
mov    %eax,-0x34(%rbp)
sub    $0x39,%eax
je     11f5 <main+0xc5>
jmp    1192 <main+0x62>
mov    -0x34(%rbp),%eax
sub    $0x48,%eax
je     11d6 <main+0xa6>
jmp    11a3 <main+0x73>
mov    -0x34(%rbp),%eax
sub    $0x51,%eax
je     11e7 <main+0xb7>
jmp    11b4 <main+0x84>
mov    -0x34(%rbp),%eax
sub    $0x68,%eax
je     11d6 <main+0xa6>
jmp    11c5 <main+0x95>
mov    -0x34(%rbp),%eax
sub    $0x71,%eax
je     11e7 <main+0xb7>
jmp    1201 <main+0xd1>
lea    0xe26(%rip),%rdi
call   1030 <puts@plt>
jmp    1201 <main+0xd1>
lea    -0x30(%rbp),%rdi
call   1030 <puts@plt>
jmp    1201 <main+0xd1>
lea    0xe15(%rip),%rdi
call   1030 <puts@plt>
jmp    1206 <main+0xd6>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1166 <main+0x36>
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x28,%rsp
xorps  %xmm0,%xmm0
movups %xmm0,0xa(%rsp)
movaps %xmm0,(%rsp)
lea    0xec2(%rip),%rdi
mov    %rsp,%rsi
call   1040 <scanf@plt>
mov    (%rsp),%al
test   %al,%al
je     11b4 <main+0x94>
lea    0x1(%rsp),%rbx
lea    0xeb8(%rip),%r14
lea    0xea3(%rip),%r15
mov    %rsp,%r12
jmp    1183 <main+0x63>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r12,%rdi
call   1030 <puts@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
je     11b4 <main+0x94>
movsbl %al,%eax
cmp    $0x50,%eax
jle    11a0 <main+0x80>
cmp    $0x51,%eax
je     1170 <main+0x50>
cmp    $0x71,%eax
je     1170 <main+0x50>
cmp    $0x68,%eax
je     11aa <main+0x8a>
jmp    1178 <main+0x58>
nopl   0x0(%rax)
cmp    $0x39,%eax
je     11af <main+0x8f>
cmp    $0x48,%eax
jne    1178 <main+0x58>
mov    %r15,%rdi
jmp    1173 <main+0x53>
mov    %r14,%rdi
jmp    1173 <main+0x53>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [14 x i8] c"Hello, world!\00"
@.str.2 = [31 x i8] c"99 Bottles of Beer on the Wall\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [26 x i8]
store i32 0, i32* %1
%4 = bitcast [26 x i8]* %3 to i8*
%5 = getelementptr inbounds [26 x i8], [26 x i8]* %3, i64 0, i64 0
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %5)
store i32 0, i32* %2
br label %7
7: ; preds = %28, %0
%8 = load i32, i32* %2
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds [26 x i8], [26 x i8]* %3, i64 0, i64 %9
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %31
14: ; preds = %7
%15 = load i32, i32* %2
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [26 x i8], [26 x i8]* %3, i64 0, i64 %16
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
switch i32 %19, label %27 [
i32 104, label %20
i32 72, label %20
i32 113, label %22
i32 81, label %22
i32 57, label %25
]
20: ; preds = %14, %14
%21 = call i32 @puts(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
br label %27
22: ; preds = %14, %14
%23 = getelementptr inbounds [26 x i8], [26 x i8]* %3, i64 0, i64 0
%24 = call i32 @puts(i8* %23)
br label %27
25: ; preds = %14
%26 = call i32 @puts(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0))
br label %27
27: ; preds = %14, %25, %22, %20
br label %28
28: ; preds = %27
%29 = load i32, i32* %2
%30 = add nsw i32 %29, 1
store i32 %30, i32* %2
br label %7
31: ; preds = %7
%32 = load i32, i32* %1
ret i32 %32
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [14 x i8] c"Hello, world!\00"
@.str.2 = [31 x i8] c"99 Bottles of Beer on the Wall\00"
define i32 @main() {
%1 = alloca [26 x i8]
%2 = getelementptr inbounds [26 x i8], [26 x i8]* %1, i64 0, i64 0
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = load i8, i8* %2
%5 = icmp eq i8 %4, 0
br i1 %5, label %21, label %6
6: ; preds = %0, %16
%7 = phi i64 [ %17, %16 ], [ 0, %0 ]
%8 = phi i8 [ %19, %16 ], [ %4, %0 ]
%9 = sext i8 %8 to i32
switch i32 %9, label %16 [
i32 104, label %10
i32 72, label %10
i32 113, label %12
i32 81, label %12
i32 57, label %14
]
10: ; preds = %6, %6
%11 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
br label %16
12: ; preds = %6, %6
%13 = call i32 @puts(i8* %2)
br label %16
14: ; preds = %6
%15 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0))
br label %16
16: ; preds = %10, %12, %14, %6
%17 = add nuw i64 %7, 1
%18 = getelementptr inbounds [26 x i8], [26 x i8]* %1, i64 0, i64 %17
%19 = load i8, i8* %18
%20 = icmp eq i8 %19, 0
br i1 %20, label %21, label %6
21: ; preds = %16, %0
ret i32 0
}