#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 *);
char *optarg;
int /*<<< orphan*/ print_help();
int /*<<< orphan*/ print_usage(char *);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char **argv) {
  int c;
  char *fflag;
  while ((c = getopt(argc, argv, ":hf:")) != -1) {
    switch (c) {
    case 'f':
      fflag = optarg;
      printf("%s\n", fflag);
      break;
    case 'h':
      print_usage(argv[0]);
      print_help();
      return 1;
    case ':':
      print_usage(argv[0]);
      return 1;
    case '?':
    default:
      print_usage(argv[0]);
      return 1;
    }
  }
  printf("extra\n");
  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    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe9c(%rip),%rdx
call   1040 <getopt@plt>
mov    %eax,-0x14(%rbp)
cmp    $0xffffffff,%eax
je     123a <main+0xfa>
mov    -0x14(%rbp),%eax
mov    %eax,-0x24(%rbp)
sub    $0x3a,%eax
je     1200 <main+0xc0>
jmp    1189 <main+0x49>
mov    -0x24(%rbp),%eax
sub    $0x3f,%eax
je     1218 <main+0xd8>
jmp    119a <main+0x5a>
mov    -0x24(%rbp),%eax
sub    $0x66,%eax
je     11bc <main+0x7c>
jmp    11ab <main+0x6b>
mov    -0x24(%rbp),%eax
sub    $0x68,%eax
je     11e1 <main+0xa1>
jmp    121d <main+0xdd>
mov    0x2e35(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rsi
lea    0xe30(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1235 <main+0xf5>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1060 <print_usage@plt>
mov    $0x0,%al
call   1050 <print_help@plt>
movl   $0x1,-0x4(%rbp)
jmp    124f <main+0x10f>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1060 <print_usage@plt>
movl   $0x1,-0x4(%rbp)
jmp    124f <main+0x10f>
jmp    121d <main+0xdd>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1060 <print_usage@plt>
movl   $0x1,-0x4(%rbp)
jmp    124f <main+0x10f>
jmp    1156 <main+0x16>
lea    0xdc8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@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,%rbx
mov    %edi,%ebp
lea    0xead(%rip),%r14
mov    0x2e9e(%rip),%r15
nopw   0x0(%rax,%rax,1)
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1040 <getopt@plt>
cmp    $0x66,%eax
jne    117c <main+0x3c>
mov    (%r15),%rdi
call   1030 <puts@plt>
jmp    1160 <main+0x20>
cmp    $0xffffffff,%eax
je     11b0 <main+0x70>
cmp    $0x3a,%eax
je     11a1 <main+0x61>
cmp    $0x68,%eax
jne    11a1 <main+0x61>
mov    (%rbx),%rdi
call   1060 <print_usage@plt>
xor    %eax,%eax
call   1050 <print_help@plt>
mov    $0x1,%eax
jmp    11be <main+0x7e>
mov    (%rbx),%rdi
call   1060 <print_usage@plt>
mov    $0x1,%eax
jmp    11be <main+0x7e>
lea    0xe4e(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c":hf:\00"
@optarg = global i8* null
@.str.1 = [4 x i8] c"%s\0A\00"
@.str.2 = [7 x i8] c"extra\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
br label %8
8: ; preds = %36, %2
%9 = load i32, i32* %4
%10 = load i8**, i8*** %5
%11 = call i32 @getopt(i32 %9, i8** %10, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
store i32 %11, i32* %6
%12 = icmp ne i32 %11, -1
br i1 %12, label %13, label %37
13: ; preds = %8
%14 = load i32, i32* %6
switch i32 %14, label %31 [
i32 102, label %15
i32 104, label %19
i32 58, label %25
i32 63, label %30
]
15: ; preds = %13
%16 = load i8*, i8** @optarg
store i8* %16, i8** %7
%17 = load i8*, i8** %7
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %17)
br label %36
19: ; preds = %13
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 0
%22 = load i8*, i8** %21
%23 = call i32 @print_usage(i8* %22)
%24 = call i32 (...) @print_help()
store i32 1, i32* %3
br label %39
25: ; preds = %13
%26 = load i8**, i8*** %5
%27 = getelementptr inbounds i8*, i8** %26, i64 0
%28 = load i8*, i8** %27
%29 = call i32 @print_usage(i8* %28)
store i32 1, i32* %3
br label %39
30: ; preds = %13
br label %31
31: ; preds = %13, %30
%32 = load i8**, i8*** %5
%33 = getelementptr inbounds i8*, i8** %32, i64 0
%34 = load i8*, i8** %33
%35 = call i32 @print_usage(i8* %34)
store i32 1, i32* %3
br label %39
36: ; preds = %15
br label %8
37: ; preds = %8
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %3
br label %39
39: ; preds = %37, %31, %25, %19
%40 = load i32, i32* %3
ret i32 %40
}

LLVM IR (-O2):
@.str = [5 x i8] c":hf:\00"
@optarg = global i8* null
@str = [6 x i8] c"extra\00"
define i32 @main(i32 %0, i8** %1) {
br label %3
3: ; preds = %5, %2
%4 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
switch i32 %4, label %15 [
i32 -1, label %18
i32 102, label %5
i32 104, label %8
i32 58, label %12
]
5: ; preds = %3
%6 = load i8*, i8** @optarg
%7 = tail call i32 @puts(i8* dereferenceable(1) %6)
br label %3
8: ; preds = %3
%9 = load i8*, i8** %1
%10 = tail call i32 @print_usage(i8* %9)
%11 = tail call i32 (...) @print_help()
br label %20
12: ; preds = %3
%13 = load i8*, i8** %1
%14 = tail call i32 @print_usage(i8* %13)
br label %20
15: ; preds = %3
%16 = load i8*, i8** %1
%17 = tail call i32 @print_usage(i8* %16)
br label %20
18: ; preds = %3
%19 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
br label %20
20: ; preds = %18, %15, %12, %8
%21 = phi i32 [ 1, %15 ], [ 1, %12 ], [ 1, %8 ], [ 0, %18 ]
ret i32 %21
}