#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*/ EINVAL;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int getopt(int, char **, char *);
int /*<<< orphan*/ print_usage(char *);
int /*<<< orphan*/ printf(char *);
int main(int argc, char *argv[]) {
  int c;
  while ((c = getopt(argc, argv, "h")) != -1) {
    switch (c) {
    case 'h':
      print_usage(argv[0]);
      exit(0);
    default:
      print_usage(argv[0]);
      exit(-EINVAL);
    }
  }
  printf("Hello Elevator AI\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    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe9c(%rip),%rdx
call   1040 <getopt@plt>
mov    %eax,-0x14(%rbp)
cmp    $0xffffffff,%eax
je     11b5 <main+0x75>
mov    -0x14(%rbp),%eax
sub    $0x68,%eax
jne    1199 <main+0x59>
jmp    1186 <main+0x46>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1060 <print_usage@plt>
xor    %edi,%edi
call   1050 <exit@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1060 <print_usage@plt>
xor    %edi,%edi
mov    0x2e32(%rip),%rax
sub    (%rax),%edi
call   1050 <exit@plt>
lea    0xe46(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    %rsi,%rbx
lea    0xeb5(%rip),%rdx
call   1040 <getopt@plt>
cmp    $0xffffffff,%eax
jne    1165 <main+0x25>
lea    0xea6(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rbx
ret
cmp    $0x68,%eax
jne    1179 <main+0x39>
mov    (%rbx),%rdi
call   1060 <print_usage@plt>
xor    %edi,%edi
call   1050 <exit@plt>
mov    (%rbx),%rdi
call   1060 <print_usage@plt>
mov    0x2e58(%rip),%rax
xor    %edi,%edi
sub    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"h\00"
@EINVAL = global i32 0
@.str.1 = [19 x i8] c"Hello Elevator AI\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 = %2
%8 = load i32, i32* %4
%9 = load i8**, i8*** %5
%10 = call i32 @getopt(i32 %8, i8** %9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32 %10, i32* %6
%11 = icmp ne i32 %10, -1
br i1 %11, label %12, label %28
12: ; preds = %7
%13 = load i32, i32* %6
switch i32 %13, label %20 [
i32 104, label %14
]
14: ; preds = %12
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 0
%17 = load i8*, i8** %16
%18 = call i32 @print_usage(i8* %17)
%19 = call i32 @exit(i32 0)
unreachable
20: ; preds = %12
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 0
%23 = load i8*, i8** %22
%24 = call i32 @print_usage(i8* %23)
%25 = load i32, i32* @EINVAL
%26 = sub nsw i32 0, %25
%27 = call i32 @exit(i32 %26)
unreachable
28: ; preds = %7
%29 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [2 x i8] c"h\00"
@EINVAL = global i32 0
@str = [18 x i8] c"Hello Elevator AI\00"
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
switch i32 %3, label %8 [
i32 -1, label %14
i32 104, label %4
]
4: ; preds = %2
%5 = load i8*, i8** %1
%6 = tail call i32 @print_usage(i8* %5)
%7 = tail call i32 @exit(i32 0)
unreachable
8: ; preds = %2
%9 = load i8*, i8** %1
%10 = tail call i32 @print_usage(i8* %9)
%11 = load i32, i32* @EINVAL
%12 = sub nsw i32 0, %11
%13 = tail call i32 @exit(i32 %12)
unreachable
14: ; preds = %2
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
ret i32 0
}