#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*/ close(int);
int creat(char *, int);
int errno;
int getopt(int, char **, char *);
int /*<<< orphan*/ getopt_init();
int /*<<< orphan*/ print_usage();
int main(int argc, char **argv) {
  int opt;
  char *point;
  int fd;
  getopt_init();
  while (-1 != (opt = getopt(argc - 1, argv, "h"))) {
    switch (opt) {
    case 'h':
      print_usage();
      return 0;
    default:
      return 0;
    }
  }
  if (argc > 1) {
    point = argv[argc - 1];
    if (0 > (fd = creat(point, 0666))) {
      return -errno;
    }
    close(fd);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1040 <getopt_init@plt>
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
mov    -0x10(%rbp),%rsi
lea    0xe82(%rip),%rdx
call   1050 <getopt@plt>
mov    %eax,%ecx
mov    %ecx,-0x14(%rbp)
mov    $0xffffffff,%eax
cmp    %ecx,%eax
je     11c5 <main+0x75>
mov    -0x14(%rbp),%eax
sub    $0x68,%eax
jne    11b9 <main+0x69>
jmp    11a6 <main+0x56>
mov    $0x0,%al
call   1070 <print_usage@plt>
movl   $0x0,-0x4(%rbp)
jmp    1223 <main+0xd3>
movl   $0x0,-0x4(%rbp)
jmp    1223 <main+0xd3>
cmpl   $0x1,-0x8(%rbp)
jle    121c <main+0xcc>
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    $0x1b6,%esi
call   1060 <creat@plt>
mov    %eax,%ecx
mov    %ecx,-0x24(%rbp)
xor    %eax,%eax
cmp    %ecx,%eax
jle    1214 <main+0xc4>
xor    %eax,%eax
mov    0x2dd6(%rip),%rcx
sub    (%rcx),%eax
mov    %eax,-0x4(%rbp)
jmp    1223 <main+0xd3>
mov    -0x24(%rbp),%edi
call   1030 <close@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r15
mov    %edi,%ebp
xor    %r14d,%r14d
xor    %eax,%eax
call   1040 <getopt_init@plt>
lea    -0x1(%rbp),%ebx
lea    0xe90(%rip),%rdx
mov    %ebx,%edi
mov    %r15,%rsi
call   1050 <getopt@plt>
cmp    $0xffffffff,%eax
je     1190 <main+0x40>
cmp    $0x68,%eax
jne    11bf <main+0x6f>
xor    %r14d,%r14d
xor    %eax,%eax
call   1070 <print_usage@plt>
jmp    11bf <main+0x6f>
cmp    $0x2,%ebp
jl     11bf <main+0x6f>
mov    %ebx,%eax
mov    (%r15,%rax,8),%rdi
mov    $0x1b6,%esi
call   1060 <creat@plt>
test   %eax,%eax
js     11b2 <main+0x62>
mov    %eax,%edi
call   1030 <close@plt>
jmp    11bf <main+0x6f>
mov    0x2e27(%rip),%rax
xor    %r14d,%r14d
sub    (%rax),%r14d
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"h\00"
@errno = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = call i32 (...) @getopt_init()
br label %10
10: ; preds = %2
%11 = load i32, i32* %4
%12 = sub nsw i32 %11, 1
%13 = load i8**, i8*** %5
%14 = call i32 @getopt(i32 %12, i8** %13, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32 %14, i32* %6
%15 = icmp ne i32 -1, %14
br i1 %15, label %16, label %21
16: ; preds = %10
%17 = load i32, i32* %6
switch i32 %17, label %20 [
i32 104, label %18
]
18: ; preds = %16
%19 = call i32 (...) @print_usage()
store i32 0, i32* %3
br label %41
20: ; preds = %16
store i32 0, i32* %3
br label %41
21: ; preds = %10
%22 = load i32, i32* %4
%23 = icmp sgt i32 %22, 1
br i1 %23, label %24, label %40
24: ; preds = %21
%25 = load i8**, i8*** %5
%26 = load i32, i32* %4
%27 = sub nsw i32 %26, 1
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds i8*, i8** %25, i64 %28
%30 = load i8*, i8** %29
store i8* %30, i8** %7
%31 = load i8*, i8** %7
%32 = call i32 @creat(i8* %31, i32 438)
store i32 %32, i32* %8
%33 = icmp sgt i32 0, %32
br i1 %33, label %34, label %37
34: ; preds = %24
%35 = load i32, i32* @errno
%36 = sub nsw i32 0, %35
store i32 %36, i32* %3
br label %41
37: ; preds = %24
%38 = load i32, i32* %8
%39 = call i32 @close(i32 %38)
br label %40
40: ; preds = %37, %21
store i32 0, i32* %3
br label %41
41: ; preds = %40, %34, %20, %18
%42 = load i32, i32* %3
ret i32 %42
}

LLVM IR (-O2):
@.str = [2 x i8] c"h\00"
@errno = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 (...) @getopt_init()
%4 = add nsw i32 %0, -1
%5 = tail call i32 @getopt(i32 %4, i8** %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
switch i32 %5, label %21 [
i32 -1, label %8
i32 104, label %6
]
6: ; preds = %2
%7 = tail call i32 (...) @print_usage()
br label %21
8: ; preds = %2
%9 = icmp sgt i32 %0, 1
br i1 %9, label %10, label %21
10: ; preds = %8
%11 = zext i32 %4 to i64
%12 = getelementptr inbounds i8*, i8** %1, i64 %11
%13 = load i8*, i8** %12
%14 = tail call i32 @creat(i8* %13, i32 438)
%15 = icmp slt i32 %14, 0
br i1 %15, label %16, label %19
16: ; preds = %10
%17 = load i32, i32* @errno
%18 = sub nsw i32 0, %17
br label %21
19: ; preds = %10
%20 = tail call i32 @close(i32 %14)
br label %21
21: ; preds = %8, %19, %2, %16, %6
%22 = phi i32 [ 0, %6 ], [ %18, %16 ], [ 0, %2 ], [ 0, %19 ], [ 0, %8 ]
ret i32 %22
}