#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 getopt(int, char **, char *);
int /*<<< orphan*/ init();
int /*<<< orphan*/ new_lq_from_interact();
int /*<<< orphan*/ new_lq_from_stdin();
int /*<<< orphan*/ *optarg;
int /*<<< orphan*/ print_distilleries();
int /*<<< orphan*/ print_help();
int /*<<< orphan*/ print_reviews(int);
int main(int argc, char **argv) {
  init();
  int c, id;
  while (-1 != (c = getopt(argc, argv, "npsd:"))) {
    switch (c) {
    case 'n':
      new_lq_from_interact();
      return 0;
    case 'p':
      print_distilleries();
      return 0;
    case 'd':
      id = optarg[0] - '0';
      print_reviews(id);
      return 0;
    case 's':
      new_lq_from_stdin();
      return 0;
    default:
      print_help();
      return -1;
    }
  }
  print_help();
  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   1040 <init@plt>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xea5(%rip),%rdx
call   1080 <getopt@plt>
mov    %eax,%ecx
mov    %ecx,-0x14(%rbp)
mov    $0xffffffff,%eax
cmp    %ecx,%eax
je     124d <main+0xdd>
mov    -0x14(%rbp),%eax
add    $0xffffff9c,%eax
mov    %eax,%ecx
mov    %rcx,-0x20(%rbp)
sub    $0xf,%eax
ja     123a <main+0xca>
mov    -0x20(%rbp),%rax
lea    0xe2e(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x0,%al
call   1060 <new_lq_from_interact@plt>
movl   $0x0,-0x4(%rbp)
jmp    125b <main+0xeb>
mov    $0x0,%al
call   1070 <print_distilleries@plt>
movl   $0x0,-0x4(%rbp)
jmp    125b <main+0xeb>
mov    0x2df0(%rip),%rax
mov    (%rax),%rax
mov    (%rax),%eax
sub    $0x30,%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%edi
call   1050 <print_reviews@plt>
movl   $0x0,-0x4(%rbp)
jmp    125b <main+0xeb>
mov    $0x0,%al
call   1030 <new_lq_from_stdin@plt>
movl   $0x0,-0x4(%rbp)
jmp    125b <main+0xeb>
mov    $0x0,%al
call   1090 <print_help@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    125b <main+0xeb>
mov    $0x0,%al
call   1090 <print_help@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
xor    %eax,%eax
call   1040 <init@plt>
lea    0xeba(%rip),%rdx
mov    %ebp,%edi
mov    %rbx,%rsi
call   1080 <getopt@plt>
lea    -0x64(%rax),%ecx
cmp    $0xf,%ecx
ja     11c0 <main+0x50>
lea    0xe61(%rip),%rax
movslq (%rax,%rcx,4),%rcx
add    %rax,%rcx
jmp    *%rcx
mov    0x2e49(%rip),%rax
mov    (%rax),%rax
mov    (%rax),%edi
add    $0xffffffd0,%edi
call   1050 <print_reviews@plt>
xor    %ebx,%ebx
jmp    11fd <main+0x8d>
cmp    $0xffffffff,%eax
jne    11d0 <main+0x60>
xor    %ebx,%ebx
xor    %eax,%eax
call   1090 <print_help@plt>
jmp    11fd <main+0x8d>
xor    %eax,%eax
call   1090 <print_help@plt>
mov    $0xffffffff,%ebx
jmp    11fd <main+0x8d>
xor    %ebx,%ebx
xor    %eax,%eax
call   1060 <new_lq_from_interact@plt>
jmp    11fd <main+0x8d>
xor    %ebx,%ebx
xor    %eax,%eax
call   1070 <print_distilleries@plt>
jmp    11fd <main+0x8d>
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <new_lq_from_stdin@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"npsd:\00"
@optarg = global i32* null
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = call i32 (...) @init()
br label %9
9: ; preds = %2
%10 = load i32, i32* %4
%11 = load i8**, i8*** %5
%12 = call i32 @getopt(i32 %10, i8** %11, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
store i32 %12, i32* %6
%13 = icmp ne i32 -1, %12
br i1 %13, label %14, label %31
14: ; preds = %9
%15 = load i32, i32* %6
switch i32 %15, label %29 [
i32 110, label %16
i32 112, label %18
i32 100, label %20
i32 115, label %27
]
16: ; preds = %14
%17 = call i32 (...) @new_lq_from_interact()
store i32 0, i32* %3
br label %33
18: ; preds = %14
%19 = call i32 (...) @print_distilleries()
store i32 0, i32* %3
br label %33
20: ; preds = %14
%21 = load i32*, i32** @optarg
%22 = getelementptr inbounds i32, i32* %21, i64 0
%23 = load i32, i32* %22
%24 = sub nsw i32 %23, 48
store i32 %24, i32* %7
%25 = load i32, i32* %7
%26 = call i32 @print_reviews(i32 %25)
store i32 0, i32* %3
br label %33
27: ; preds = %14
%28 = call i32 (...) @new_lq_from_stdin()
store i32 0, i32* %3
br label %33
29: ; preds = %14
%30 = call i32 (...) @print_help()
store i32 -1, i32* %3
br label %33
31: ; preds = %9
%32 = call i32 (...) @print_help()
store i32 0, i32* %3
br label %33
33: ; preds = %31, %29, %27, %20, %18, %16
%34 = load i32, i32* %3
ret i32 %34
}

LLVM IR (-O2):
@.str = [6 x i8] c"npsd:\00"
@optarg = global i32* null
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 (...) @init()
%4 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
switch i32 %4, label %16 [
i32 -1, label %18
i32 110, label %5
i32 112, label %7
i32 100, label %9
i32 115, label %14
]
5: ; preds = %2
%6 = tail call i32 (...) @new_lq_from_interact()
br label %20
7: ; preds = %2
%8 = tail call i32 (...) @print_distilleries()
br label %20
9: ; preds = %2
%10 = load i32*, i32** @optarg
%11 = load i32, i32* %10
%12 = add nsw i32 %11, -48
%13 = tail call i32 @print_reviews(i32 %12)
br label %20
14: ; preds = %2
%15 = tail call i32 (...) @new_lq_from_stdin()
br label %20
16: ; preds = %2
%17 = tail call i32 (...) @print_help()
br label %20
18: ; preds = %2
%19 = tail call i32 (...) @print_help()
br label %20
20: ; preds = %18, %16, %14, %9, %7, %5
%21 = phi i32 [ -1, %16 ], [ 0, %14 ], [ 0, %9 ], [ 0, %7 ], [ 0, %5 ], [ 0, %18 ]
ret i32 %21
}