#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 */
char EOF;
int /*<<< orphan*/ chatdat_gen();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
char getopt(int, char **, char *);
scalar_t__ optind;
void handle_args(int argc, char *argv[]) {
  char opt_c;
  while ((opt_c = getopt(argc, argv, "a")) != EOF)
    switch (opt_c) {
    case 'a':
      chatdat_gen();
      exit(0);
    }
  argc -= optind;
  argv += optind;
  return;
}


x86 assembly (clang, -O0):
<handle_args>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xeb3(%rip),%rdx
call   1040 <getopt@plt>
mov    %al,-0x11(%rbp)
movsbl %al,%eax
mov    0x2e89(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     118d <handle_args+0x5d>
mov    -0x11(%rbp),%al
sub    $0x61,%al
jne    1188 <handle_args+0x58>
jmp    117a <handle_args+0x4a>
mov    $0x0,%al
call   1030 <chatdat_gen@plt>
xor    %edi,%edi
call   1050 <exit@plt>
jmp    113f <handle_args+0xf>
mov    0x2e4c(%rip),%rax
mov    (%rax),%rcx
movslq -0x4(%rbp),%rax
sub    %rcx,%rax
mov    %eax,-0x4(%rbp)
mov    0x2e38(%rip),%rax
mov    (%rax),%rax
shl    $0x3,%rax
add    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<handle_args>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0xebd(%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    (%r15),%al
je     1174 <handle_args+0x44>
cmp    $0x61,%al
jne    1150 <handle_args+0x20>
xor    %eax,%eax
call   1030 <chatdat_gen@plt>
xor    %edi,%edi
call   1050 <exit@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"a\00"
@EOF = global i8 0
@optind = global i64 0
define void @handle_args(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i8
store i32 %0, i32* %3
store i8** %1, i8*** %4
br label %6
6: ; preds = %20, %2
%7 = load i32, i32* %3
%8 = load i8**, i8*** %4
%9 = call signext i8 @getopt(i32 %7, i8** %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i8 %9, i8* %5
%10 = sext i8 %9 to i32
%11 = load i8, i8* @EOF
%12 = sext i8 %11 to i32
%13 = icmp ne i32 %10, %12
br i1 %13, label %14, label %21
14: ; preds = %6
%15 = load i8, i8* %5
%16 = sext i8 %15 to i32
switch i32 %16, label %20 [
i32 97, label %17
]
17: ; preds = %14
%18 = call i32 (...) @chatdat_gen()
%19 = call i32 @exit(i32 0)
unreachable
20: ; preds = %14
br label %6
21: ; preds = %6
%22 = load i64, i64* @optind
%23 = load i32, i32* %3
%24 = sext i32 %23 to i64
%25 = sub nsw i64 %24, %22
%26 = trunc i64 %25 to i32
store i32 %26, i32* %3
%27 = load i64, i64* @optind
%28 = load i8**, i8*** %4
%29 = getelementptr inbounds i8*, i8** %28, i64 %27
store i8** %29, i8*** %4
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"a\00"
@EOF = global i8 0
@optind = global i64 0
define void @handle_args(i32 %0, i8** %1) {
br label %3
3: ; preds = %7, %2
%4 = tail call signext i8 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%5 = load i8, i8* @EOF
%6 = icmp eq i8 %4, %5
br i1 %6, label %12, label %7
7: ; preds = %3
%8 = icmp eq i8 %4, 97
br i1 %8, label %9, label %3
9: ; preds = %7
%10 = tail call i32 (...) @chatdat_gen()
%11 = tail call i32 @exit(i32 0)
unreachable
12: ; preds = %3
ret void
}