#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*/ fprintf(int /*<<< orphan*/, char *, float);
int getopt(int, char **, char *);
int /*<<< orphan*/ isprint(float);
char *optarg;
scalar_t__ opterr;
float optopt;
int /*<<< orphan*/ show_usage();
int /*<<< orphan*/ stderr;
int parse_cmd_line_args(int argc, char **argv, char **config_file) {
  int enable_help = 0;
  int c;
  opterr = 0;
  while ((c = getopt(argc, argv, "hf:w:")) != -1) {
    switch (c) {
    case 'h':
      enable_help = 1;
      break;
    case 'f':
      *config_file = optarg;
      break;
    case '?':
      if (optopt == 'f')
        fprintf(stderr, "Option -%c requires a filename.\n", optopt);
      else if (isprint(optopt))
        fprintf(stderr, "Unknown option `-%c'.\n", optopt);
      else
        fprintf(stderr, "Unknown option character `\\x%x'.\n", optopt);
      return 1;
    }
  }
  if (enable_help) {
    show_usage();
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<parse_cmd_line_args>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    0x2e67(%rip),%rax
movq   $0x0,(%rax)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe8e(%rip),%rdx
call   1060 <getopt@plt>
mov    %eax,-0x20(%rbp)
cmp    $0xffffffff,%eax
je     129a <parse_cmd_line_args+0x15a>
mov    -0x20(%rbp),%eax
mov    %eax,-0x24(%rbp)
sub    $0x3f,%eax
je     11df <parse_cmd_line_args+0x9f>
jmp    119b <parse_cmd_line_args+0x5b>
mov    -0x24(%rbp),%eax
sub    $0x66,%eax
je     11c9 <parse_cmd_line_args+0x89>
jmp    11ac <parse_cmd_line_args+0x6c>
mov    -0x24(%rbp),%eax
sub    $0x68,%eax
jne    1295 <parse_cmd_line_args+0x155>
jmp    11bd <parse_cmd_line_args+0x7d>
movl   $0x1,-0x1c(%rbp)
jmp    1295 <parse_cmd_line_args+0x155>
mov    0x2e28(%rip),%rax
mov    (%rax),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
jmp    1295 <parse_cmd_line_args+0x155>
mov    0x2dfa(%rip),%rax
movss  (%rax),%xmm0
movss  0xe0e(%rip),%xmm1
ucomiss %xmm1,%xmm0
jne    1226 <parse_cmd_line_args+0xe6>
jp     1226 <parse_cmd_line_args+0xe6>
mov    0x2dc8(%rip),%rax
mov    (%rax),%edi
mov    0x2dcf(%rip),%rax
movss  (%rax),%xmm0
lea    0xdee(%rip),%rsi
call   1030 <fprintf@plt>
jmp    1289 <parse_cmd_line_args+0x149>
mov    0x2db3(%rip),%rax
movss  (%rax),%xmm0
call   1040 <isprint@plt>
cmp    $0x0,%eax
je     1264 <parse_cmd_line_args+0x124>
mov    0x2d8a(%rip),%rax
mov    (%rax),%edi
mov    0x2d91(%rip),%rax
movss  (%rax),%xmm0
lea    0xdd1(%rip),%rsi
call   1030 <fprintf@plt>
jmp    1284 <parse_cmd_line_args+0x144>
mov    0x2d65(%rip),%rax
mov    (%rax),%edi
mov    0x2d6c(%rip),%rax
movss  (%rax),%xmm0
lea    0xdc3(%rip),%rsi
call   1030 <fprintf@plt>
jmp    1289 <parse_cmd_line_args+0x149>
movl   $0x1,-0x4(%rbp)
jmp    12be <parse_cmd_line_args+0x17e>
jmp    1168 <parse_cmd_line_args+0x28>
cmpl   $0x0,-0x1c(%rbp)
je     12b7 <parse_cmd_line_args+0x177>
mov    $0x0,%al
call   1050 <show_usage@plt>
movl   $0x1,-0x4(%rbp)
jmp    12be <parse_cmd_line_args+0x17e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_cmd_line_args>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %edi,%ebp
mov    0x2e6e(%rip),%rax
movq   $0x0,(%rax)
mov    $0x1,%r12b
lea    0xe99(%rip),%r15
mov    0x2e86(%rip),%r13
jmp    1187 <parse_cmd_line_args+0x47>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    0x0(%r13),%rax
mov    %rax,(%r14)
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r15,%rdx
call   1060 <getopt@plt>
cmp    $0x65,%eax
jle    11b0 <parse_cmd_line_args+0x70>
cmp    $0x66,%eax
je     1180 <parse_cmd_line_args+0x40>
cmp    $0x68,%eax
jne    1187 <parse_cmd_line_args+0x47>
xor    %r12d,%r12d
jmp    1187 <parse_cmd_line_args+0x47>
nopl   0x0(%rax,%rax,1)
cmp    $0xffffffff,%eax
je     11ea <parse_cmd_line_args+0xaa>
cmp    $0x3f,%eax
jne    1187 <parse_cmd_line_args+0x47>
mov    0x2e1f(%rip),%rbx
movss  (%rbx),%xmm0
ucomiss 0xe34(%rip),%xmm0
jne    11fb <parse_cmd_line_args+0xbb>
jp     11fb <parse_cmd_line_args+0xbb>
mov    0x2df9(%rip),%rax
mov    (%rax),%edi
lea    0xe2a(%rip),%rsi
movss  0xe18(%rip),%xmm0
jmp    1221 <parse_cmd_line_args+0xe1>
xor    %eax,%eax
test   $0x1,%r12b
jne    122b <parse_cmd_line_args+0xeb>
xor    %eax,%eax
call   1050 <show_usage@plt>
jmp    1226 <parse_cmd_line_args+0xe6>
call   1040 <isprint@plt>
mov    0x2dc9(%rip),%rcx
mov    (%rcx),%edi
movss  (%rbx),%xmm0
test   %eax,%eax
je     121a <parse_cmd_line_args+0xda>
lea    0xe13(%rip),%rsi
jmp    1221 <parse_cmd_line_args+0xe1>
lea    0xe21(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@opterr = global i64 0
@.str = [6 x i8] c"hf:w:\00"
@optarg = global i8* null
@optopt = global float 0.000000e+00
@stderr = global i32 0
@.str.1 = [33 x i8] c"Option -%c requires a filename.\0A\00"
@.str.2 = [23 x i8] c"Unknown option `-%c'.\0A\00"
@.str.3 = [34 x i8] c"Unknown option character `\\x%x'.\0A\00"
define i32 @parse_cmd_line_args(i32 %0, i8** %1, i8** %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8**
%7 = alloca i8**
%8 = alloca i32
%9 = alloca i32
store i32 %0, i32* %5
store i8** %1, i8*** %6
store i8** %2, i8*** %7
store i32 0, i32* %8
store i64 0, i64* @opterr
br label %10
10: ; preds = %42, %3
%11 = load i32, i32* %5
%12 = load i8**, i8*** %6
%13 = call i32 @getopt(i32 %11, i8** %12, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
store i32 %13, i32* %9
%14 = icmp ne i32 %13, -1
br i1 %14, label %15, label %43
15: ; preds = %10
%16 = load i32, i32* %9
switch i32 %16, label %42 [
i32 104, label %17
i32 102, label %18
i32 63, label %21
]
17: ; preds = %15
store i32 1, i32* %8
br label %42
18: ; preds = %15
%19 = load i8*, i8** @optarg
%20 = load i8**, i8*** %7
store i8* %19, i8** %20
br label %42
21: ; preds = %15
%22 = load float, float* @optopt
%23 = fcmp oeq float %22, 1.020000e+02
br i1 %23, label %24, label %28
24: ; preds = %21
%25 = load i32, i32* @stderr
%26 = load float, float* @optopt
%27 = call i32 @fprintf(i32 %25, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0), float %26)
br label %41
28: ; preds = %21
%29 = load float, float* @optopt
%30 = call i32 @isprint(float %29)
%31 = icmp ne i32 %30, 0
br i1 %31, label %32, label %36
32: ; preds = %28
%33 = load i32, i32* @stderr
%34 = load float, float* @optopt
%35 = call i32 @fprintf(i32 %33, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), float %34)
br label %40
36: ; preds = %28
%37 = load i32, i32* @stderr
%38 = load float, float* @optopt
%39 = call i32 @fprintf(i32 %37, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0), float %38)
br label %40
40: ; preds = %36, %32
br label %41
41: ; preds = %40, %24
store i32 1, i32* %4
br label %49
42: ; preds = %15, %18, %17
br label %10
43: ; preds = %10
%44 = load i32, i32* %8
%45 = icmp ne i32 %44, 0
br i1 %45, label %46, label %48
46: ; preds = %43
%47 = call i32 (...) @show_usage()
store i32 1, i32* %4
br label %49
48: ; preds = %43
store i32 0, i32* %4
br label %49
49: ; preds = %48, %46, %41
%50 = load i32, i32* %4
ret i32 %50
}

LLVM IR (-O2):
@opterr = global i64 0
@.str = [6 x i8] c"hf:w:\00"
@optarg = global i8* null
@optopt = global float 0.000000e+00
@stderr = global i32 0
@.str.1 = [33 x i8] c"Option -%c requires a filename.\0A\00"
@.str.2 = [23 x i8] c"Unknown option `-%c'.\0A\00"
@.str.3 = [34 x i8] c"Unknown option character `\\x%x'.\0A\00"
define i32 @parse_cmd_line_args(i32 %0, i8** %1, i8** nocapture writeonly %2) {
store i64 0, i64* @opterr
br label %4
4: ; preds = %6, %3
%5 = phi i1 [ true, %3 ], [ false, %6 ]
br label %6
6: ; preds = %8, %4
%7 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
switch i32 %7, label %8 [
i32 -1, label %26
i32 104, label %4
i32 102, label %9
i32 63, label %11
]
8: ; preds = %6, %9
br label %6
9: ; preds = %6
%10 = load i8*, i8** @optarg
store i8* %10, i8** %2
br label %8
11: ; preds = %6
%12 = load float, float* @optopt
%13 = fcmp oeq float %12, 1.020000e+02
br i1 %13, label %14, label %17
14: ; preds = %11
%15 = load i32, i32* @stderr
%16 = tail call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0), float 1.020000e+02)
br label %29
17: ; preds = %11
%18 = tail call i32 @isprint(float %12)
%19 = icmp eq i32 %18, 0
%20 = load i32, i32* @stderr
%21 = load float, float* @optopt
br i1 %19, label %24, label %22
22: ; preds = %17
%23 = tail call i32 @fprintf(i32 %20, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), float %21)
br label %29
24: ; preds = %17
%25 = tail call i32 @fprintf(i32 %20, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0), float %21)
br label %29
26: ; preds = %6
br i1 %5, label %29, label %27
27: ; preds = %26
%28 = tail call i32 (...) @show_usage()
br label %29
29: ; preds = %26, %14, %24, %22, %27
%30 = phi i32 [ 1, %27 ], [ 1, %22 ], [ 1, %24 ], [ 1, %14 ], [ 0, %26 ]
ret i32 %30
}