#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 *, char *);
int /*<<< orphan*/ print_help();
int /*<<< orphan*/ stderr;
void parse_args(int argc, char **argv, unsigned int *args) {
  char *s;
  char *prog_name;
  prog_name = argv[0];
  while (0 < --argc && (*++argv)[0] == '-') {
    for (s = argv[0] + 1; *s != '\0'; s++) {
      switch (*s) {
      case 'n':
        *args |= 0x02;
        break;
      case 'l':
        *args |= 0X01;
        break;
      case 'h':
        print_help();
        break;
      default:
        fprintf(
            stderr,
            "USAGE : %s [-l -n] [-h] [plain, packed]\nUse -h for more help\n",
            prog_name);
        break;
      }
    }
  }
}


x86 assembly (clang, -O0):
<parse_args>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x28(%rbp)
mov    -0x4(%rbp),%edx
add    $0xffffffff,%edx
mov    %edx,-0x4(%rbp)
xor    %eax,%eax
xor    %ecx,%ecx
cmp    %edx,%ecx
mov    %al,-0x29(%rbp)
jge    1175 <parse_args+0x55>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x10(%rbp)
mov    0x8(%rax),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
sete   %al
mov    %al,-0x29(%rbp)
mov    -0x29(%rbp),%al
test   $0x1,%al
jne    1185 <parse_args+0x65>
jmp    123e <parse_args+0x11e>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1239 <parse_args+0x119>
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
mov    %eax,-0x30(%rbp)
sub    $0x68,%eax
je     11fe <parse_args+0xde>
jmp    11bc <parse_args+0x9c>
mov    -0x30(%rbp),%eax
sub    $0x6c,%eax
je     11ee <parse_args+0xce>
jmp    11cd <parse_args+0xad>
mov    -0x30(%rbp),%eax
sub    $0x6e,%eax
jne    120a <parse_args+0xea>
jmp    11de <parse_args+0xbe>
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
or     $0x2,%ecx
mov    %ecx,(%rax)
jmp    1223 <parse_args+0x103>
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
or     $0x1,%ecx
mov    %ecx,(%rax)
jmp    1223 <parse_args+0x103>
mov    $0x0,%al
call   1040 <print_help@plt>
jmp    1223 <parse_args+0x103>
mov    0x2dcf(%rip),%rax
mov    (%rax),%edi
mov    -0x28(%rbp),%rdx
lea    0xde2(%rip),%rsi
call   1030 <fprintf@plt>
jmp    1228 <parse_args+0x108>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    1194 <parse_args+0x74>
jmp    113e <parse_args+0x1e>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_args>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
cmp    $0x2,%edi
jl     11d5 <parse_args+0xb5>
mov    %rdx,%rbx
mov    %rsi,%r14
mov    %edi,%r15d
mov    (%rsi),%r12
lea    0xeb9(%rip),%r13
jmp    1161 <parse_args+0x41>
nopl   0x0(%rax)
lea    -0x1(%r15),%eax
add    $0x8,%r14
cmp    $0x3,%r15d
mov    %eax,%r15d
jl     11d5 <parse_args+0xb5>
mov    0x8(%r14),%rbp
cmpb   $0x2d,0x0(%rbp)
jne    11d5 <parse_args+0xb5>
mov    0x1(%rbp),%al
test   %al,%al
je     1150 <parse_args+0x30>
add    $0x2,%rbp
jmp    11a0 <parse_args+0x80>
nopl   0x0(%rax,%rax,1)
mov    0x2e59(%rip),%rax
mov    (%rax),%edi
mov    %r13,%rsi
mov    %r12,%rdx
call   1030 <fprintf@plt>
movzbl 0x0(%rbp),%eax
add    $0x1,%rbp
test   %al,%al
je     1150 <parse_args+0x30>
movsbl %al,%eax
cmp    $0x68,%eax
je     11c0 <parse_args+0xa0>
cmp    $0x6c,%eax
je     11d0 <parse_args+0xb0>
cmp    $0x6e,%eax
jne    1180 <parse_args+0x60>
orb    $0x2,(%rbx)
jmp    1194 <parse_args+0x74>
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <print_help@plt>
jmp    1194 <parse_args+0x74>
nopl   0x0(%rax)
orb    $0x1,(%rbx)
jmp    1194 <parse_args+0x74>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [62 x i8] c"USAGE : %s [-l -n] [-h] [plain, packed]\0AUse -h for more help\0A\00"
define void @parse_args(i32 %0, i8** %1, i32* %2) {
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i8*
%8 = alloca i8*
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32* %2, i32** %6
%9 = load i8**, i8*** %5
%10 = getelementptr inbounds i8*, i8** %9, i64 0
%11 = load i8*, i8** %10
store i8* %11, i8** %8
br label %12
12: ; preds = %58, %3
%13 = load i32, i32* %4
%14 = add nsw i32 %13, -1
store i32 %14, i32* %4
%15 = icmp slt i32 0, %14
br i1 %15, label %16, label %24
16: ; preds = %12
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i32 1
store i8** %18, i8*** %5
%19 = load i8*, i8** %18
%20 = getelementptr inbounds i8, i8* %19, i64 0
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
%23 = icmp eq i32 %22, 45
br label %24
24: ; preds = %16, %12
%25 = phi i1 [ false, %12 ], [ %23, %16 ]
br i1 %25, label %26, label %59
26: ; preds = %24
%27 = load i8**, i8*** %5
%28 = getelementptr inbounds i8*, i8** %27, i64 0
%29 = load i8*, i8** %28
%30 = getelementptr inbounds i8, i8* %29, i64 1
store i8* %30, i8** %7
br label %31
31: ; preds = %55, %26
%32 = load i8*, i8** %7
%33 = load i8, i8* %32
%34 = sext i8 %33 to i32
%35 = icmp ne i32 %34, 0
br i1 %35, label %36, label %58
36: ; preds = %31
%37 = load i8*, i8** %7
%38 = load i8, i8* %37
%39 = sext i8 %38 to i32
switch i32 %39, label %50 [
i32 110, label %40
i32 108, label %44
i32 104, label %48
]
40: ; preds = %36
%41 = load i32*, i32** %6
%42 = load i32, i32* %41
%43 = or i32 %42, 2
store i32 %43, i32* %41
br label %54
44: ; preds = %36
%45 = load i32*, i32** %6
%46 = load i32, i32* %45
%47 = or i32 %46, 1
store i32 %47, i32* %45
br label %54
48: ; preds = %36
%49 = call i32 (...) @print_help()
br label %54
50: ; preds = %36
%51 = load i32, i32* @stderr
%52 = load i8*, i8** %8
%53 = call i32 @fprintf(i32 %51, i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str, i64 0, i64 0), i8* %52)
br label %54
54: ; preds = %50, %48, %44, %40
br label %55
55: ; preds = %54
%56 = load i8*, i8** %7
%57 = getelementptr inbounds i8, i8* %56, i32 1
store i8* %57, i8** %7
br label %31
58: ; preds = %31
br label %12
59: ; preds = %24
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [62 x i8] c"USAGE : %s [-l -n] [-h] [plain, packed]\0AUse -h for more help\0A\00"
define void @parse_args(i32 %0, i8** nocapture %1, i32* nocapture %2) {
%4 = load i8*, i8** %1
%5 = icmp sgt i32 %0, 1
br i1 %5, label %8, label %39
6: ; preds = %35, %16
%7 = icmp sgt i32 %9, 2
br i1 %7, label %8, label %39
8: ; preds = %3, %6
%9 = phi i32 [ %11, %6 ], [ %0, %3 ]
%10 = phi i8** [ %12, %6 ], [ %1, %3 ]
%11 = add nsw i32 %9, -1
%12 = getelementptr inbounds i8*, i8** %10, i64 1
%13 = load i8*, i8** %12
%14 = load i8, i8* %13
%15 = icmp eq i8 %14, 45
br i1 %15, label %16, label %39
16: ; preds = %8
%17 = getelementptr inbounds i8, i8* %13, i64 1
%18 = load i8, i8* %17
%19 = icmp eq i8 %18, 0
br i1 %19, label %6, label %20
20: ; preds = %16, %35
%21 = phi i8 [ %37, %35 ], [ %18, %16 ]
%22 = phi i8* [ %36, %35 ], [ %17, %16 ]
%23 = sext i8 %21 to i32
switch i32 %23, label %32 [
i32 110, label %24
i32 108, label %27
i32 104, label %30
]
24: ; preds = %20
%25 = load i32, i32* %2
%26 = or i32 %25, 2
store i32 %26, i32* %2
br label %35
27: ; preds = %20
%28 = load i32, i32* %2
%29 = or i32 %28, 1
store i32 %29, i32* %2
br label %35
30: ; preds = %20
%31 = tail call i32 (...) @print_help()
br label %35
32: ; preds = %20
%33 = load i32, i32* @stderr
%34 = tail call i32 @fprintf(i32 %33, i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str, i64 0, i64 0), i8* %4)
br label %35
35: ; preds = %24, %27, %30, %32
%36 = getelementptr inbounds i8, i8* %22, i64 1
%37 = load i8, i8* %36
%38 = icmp eq i8 %37, 0
br i1 %38, label %6, label %20
39: ; preds = %8, %6, %3
ret void
}