#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*/ DisplayUsage(char *);
int /*<<< orphan*/ abort();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char);
int getopt(int, char **, char *);
int /*<<< orphan*/ isprint(char);
char *optarg;
scalar_t__ opterr;
int optind;
char optopt;
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stderr;
int main(int argc, char **argv) {
  int c;
  int index;
  char aflag = 0;
  char tflag = 0;
  char *tvalue = NULL;
  opterr = 0;
  while ((c = getopt(argc, argv, "abt:")) != -1) {
    switch (c) {
    case 'a':
      aflag = 1;
      break;
    case 't':
      tflag = 1;
      tvalue = optarg;
      break;
    case '?':
      if (optopt == 't')
        fprintf(stderr, "Option -%c requires an argument.\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;
    default:
      abort();
    }
  }
  if (argc == 1)
    DisplayUsage(argv[0]);
  else {
    printf("aflag = %d, tflag = %d, tvalue = %s\n", aflag, tflag, tvalue);
  }
  for (index = optind; index < argc; index++) {
    printf("Non-option argument \"%s\" @ argv[%d]\n", argv[index], index);
  }
  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)
movb   $0x0,-0x19(%rbp)
movb   $0x0,-0x1a(%rbp)
movq   $0x0,-0x28(%rbp)
mov    0x2e33(%rip),%rax
movq   $0x0,(%rax)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe5e(%rip),%rdx
call   1070 <getopt@plt>
mov    %eax,-0x14(%rbp)
cmp    $0xffffffff,%eax
je     12b8 <main+0x158>
mov    -0x14(%rbp),%eax
mov    %eax,-0x2c(%rbp)
sub    $0x3f,%eax
je     1209 <main+0xa9>
jmp    11c7 <main+0x67>
mov    -0x2c(%rbp),%eax
sub    $0x61,%eax
je     11e9 <main+0x89>
jmp    11d8 <main+0x78>
mov    -0x2c(%rbp),%eax
sub    $0x74,%eax
je     11f2 <main+0x92>
jmp    12ac <main+0x14c>
movb   $0x1,-0x19(%rbp)
jmp    12b3 <main+0x153>
movb   $0x1,-0x1a(%rbp)
mov    0x2dfb(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x28(%rbp)
jmp    12b3 <main+0x153>
mov    0x2dd0(%rip),%rax
movsbl (%rax),%eax
cmp    $0x74,%eax
jne    1240 <main+0xe0>
mov    0x2da5(%rip),%rax
mov    (%rax),%edi
lea    0xdd9(%rip),%rsi
mov    0x2dad(%rip),%rax
movsbl (%rax),%edx
call   1050 <fprintf@plt>
jmp    12a0 <main+0x140>
mov    0x2d99(%rip),%rax
movsbl (%rax),%edi
call   1060 <isprint@plt>
cmp    $0x0,%eax
je     127c <main+0x11c>
mov    0x2d69(%rip),%rax
mov    (%rax),%edi
lea    0xdbf(%rip),%rsi
mov    0x2d71(%rip),%rax
movsbl (%rax),%edx
call   1050 <fprintf@plt>
jmp    129b <main+0x13b>
mov    0x2d45(%rip),%rax
mov    (%rax),%edi
lea    0xdb2(%rip),%rsi
mov    0x2d4d(%rip),%rax
movsbl (%rax),%edx
call   1050 <fprintf@plt>
jmp    12a0 <main+0x140>
movl   $0x1,-0x4(%rbp)
jmp    1337 <main+0x1d7>
mov    $0x0,%al
call   1030 <abort@plt>
jmp    1194 <main+0x34>
cmpl   $0x1,-0x8(%rbp)
jne    12d3 <main+0x173>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1080 <DisplayUsage@plt>
jmp    12ed <main+0x18d>
movsbl -0x19(%rbp),%esi
movsbl -0x1a(%rbp),%edx
mov    -0x28(%rbp),%rcx
lea    0xd7a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2ce4(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1330 <main+0x1d0>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
mov    -0x18(%rbp),%edx
lea    0xd6a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    12f9 <main+0x199>
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   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %edi,%r13d
mov    0x2e48(%rip),%rax
movq   $0x0,(%rax)
xor    %eax,%eax
mov    %rax,(%rsp)
lea    0xe74(%rip),%r12
mov    0x2e65(%rip),%r15
xor    %ebp,%ebp
xor    %ebx,%ebx
jmp    11a6 <main+0x46>
nopl   0x0(%rax)
mov    (%r15),%rbx
mov    $0x1,%bpl
mov    %r13d,%edi
mov    %r14,%rsi
mov    %r12,%rdx
call   1070 <getopt@plt>
cmp    $0x74,%eax
je     11a0 <main+0x40>
cmp    $0xffffffff,%eax
je     11d7 <main+0x77>
cmp    $0x3f,%eax
je     11e7 <main+0x87>
cmp    $0x61,%eax
jne    12b5 <main+0x155>
mov    $0x1,%eax
mov    %rax,(%rsp)
jmp    11a6 <main+0x46>
cmp    $0x1,%r13d
jne    120e <main+0xae>
mov    (%r14),%rdi
call   1080 <DisplayUsage@plt>
jmp    1227 <main+0xc7>
mov    0x2df2(%rip),%rbx
mov    (%rbx),%al
cmp    $0x74,%al
jne    126e <main+0x10e>
mov    0x2dcd(%rip),%rax
mov    (%rax),%edi
lea    0xe01(%rip),%rsi
mov    $0x74,%edx
jmp    1298 <main+0x138>
movzbl %bpl,%edx
lea    0xe47(%rip),%rdi
mov    (%rsp),%rsi
mov    %rbx,%rcx
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x2daa(%rip),%rax
mov    (%rax),%ebx
xor    %r15d,%r15d
cmp    %r13d,%ebx
jge    12a3 <main+0x143>
movslq %ebx,%rax
lea    (%r14,%rax,8),%rbp
lea    0xe3f(%rip),%r14
xor    %r15d,%r15d
nopl   0x0(%rax)
mov    0x0(%rbp),%rsi
mov    %r14,%rdi
mov    %ebx,%edx
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%ebx
add    $0x8,%rbp
cmp    %ebx,%r13d
jne    1250 <main+0xf0>
jmp    12a3 <main+0x143>
movsbl %al,%edi
call   1060 <isprint@plt>
mov    0x2d4b(%rip),%rcx
mov    (%rcx),%edi
mov    (%rbx),%cl
movsbl %cl,%edx
test   %eax,%eax
je     1291 <main+0x131>
lea    0xd98(%rip),%rsi
jmp    1298 <main+0x138>
lea    0xda6(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x1,%r15d
mov    %r15d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@opterr = global i64 0
@.str = [5 x i8] c"abt:\00"
@optarg = global i8* null
@optopt = global i8 0
@stderr = global i32 0
@.str.1 = [34 x i8] c"Option -%c requires an argument.\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"
@.str.4 = [37 x i8] c"aflag = %d, tflag = %d, tvalue = %s\0A\00"
@optind = global i32 0
@.str.5 = [37 x i8] c"Non-option argument \22%s\22 @ argv[%d]\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8
%9 = alloca i8
%10 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8 0, i8* %8
store i8 0, i8* %9
store i8* null, i8** %10
store i64 0, i64* @opterr
br label %11
11: ; preds = %45, %2
%12 = load i32, i32* %4
%13 = load i8**, i8*** %5
%14 = call i32 @getopt(i32 %12, i8** %13, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
store i32 %14, i32* %6
%15 = icmp ne i32 %14, -1
br i1 %15, label %16, label %46
16: ; preds = %11
%17 = load i32, i32* %6
switch i32 %17, label %43 [
i32 97, label %18
i32 116, label %19
i32 63, label %21
]
18: ; preds = %16
store i8 1, i8* %8
br label %45
19: ; preds = %16
store i8 1, i8* %9
%20 = load i8*, i8** @optarg
store i8* %20, i8** %10
br label %45
21: ; preds = %16
%22 = load i8, i8* @optopt
%23 = sext i8 %22 to i32
%24 = icmp eq i32 %23, 116
br i1 %24, label %25, label %29
25: ; preds = %21
%26 = load i32, i32* @stderr
%27 = load i8, i8* @optopt
%28 = call i32 @fprintf(i32 %26, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), i8 signext %27)
br label %42
29: ; preds = %21
%30 = load i8, i8* @optopt
%31 = call i32 @isprint(i8 signext %30)
%32 = icmp ne i32 %31, 0
br i1 %32, label %33, label %37
33: ; preds = %29
%34 = load i32, i32* @stderr
%35 = load i8, i8* @optopt
%36 = call i32 @fprintf(i32 %34, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i8 signext %35)
br label %41
37: ; preds = %29
%38 = load i32, i32* @stderr
%39 = load i8, i8* @optopt
%40 = call i32 @fprintf(i32 %38, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0), i8 signext %39)
br label %41
41: ; preds = %37, %33
br label %42
42: ; preds = %41, %25
store i32 1, i32* %3
br label %79
43: ; preds = %16
%44 = call i32 (...) @abort()
unreachable
45: ; preds = %19, %18
br label %11
46: ; preds = %11
%47 = load i32, i32* %4
%48 = icmp eq i32 %47, 1
br i1 %48, label %49, label %54
49: ; preds = %46
%50 = load i8**, i8*** %5
%51 = getelementptr inbounds i8*, i8** %50, i64 0
%52 = load i8*, i8** %51
%53 = call i32 @DisplayUsage(i8* %52)
br label %61
54: ; preds = %46
%55 = load i8, i8* %8
%56 = sext i8 %55 to i32
%57 = load i8, i8* %9
%58 = sext i8 %57 to i32
%59 = load i8*, i8** %10
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.4, i64 0, i64 0), i32 %56, i32 %58, i8* %59)
br label %61
61: ; preds = %54, %49
%62 = load i32, i32* @optind
store i32 %62, i32* %7
br label %63
63: ; preds = %75, %61
%64 = load i32, i32* %7
%65 = load i32, i32* %4
%66 = icmp slt i32 %64, %65
br i1 %66, label %67, label %78
67: ; preds = %63
%68 = load i8**, i8*** %5
%69 = load i32, i32* %7
%70 = sext i32 %69 to i64
%71 = getelementptr inbounds i8*, i8** %68, i64 %70
%72 = load i8*, i8** %71
%73 = load i32, i32* %7
%74 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.5, i64 0, i64 0), i8* %72, i32 %73)
br label %75
75: ; preds = %67
%76 = load i32, i32* %7
%77 = add nsw i32 %76, 1
store i32 %77, i32* %7
br label %63
78: ; preds = %63
store i32 0, i32* %3
br label %79
79: ; preds = %78, %42
%80 = load i32, i32* %3
ret i32 %80
}

LLVM IR (-O2):
@opterr = global i64 0
@.str = [5 x i8] c"abt:\00"
@optarg = global i8* null
@optopt = global i8 0
@stderr = global i32 0
@.str.1 = [34 x i8] c"Option -%c requires an argument.\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"
@.str.4 = [37 x i8] c"aflag = %d, tflag = %d, tvalue = %s\0A\00"
@optind = global i32 0
@.str.5 = [37 x i8] c"Non-option argument \22%s\22 @ argv[%d]\0A\00"
define i32 @main(i32 %0, i8** %1) {
store i64 0, i64* @opterr
br label %3
3: ; preds = %7, %2
%4 = phi i32 [ 0, %2 ], [ 1, %7 ]
%5 = phi i8 [ 0, %2 ], [ %8, %7 ]
%6 = phi i8* [ null, %2 ], [ %9, %7 ]
br label %7
7: ; preds = %3, %11
%8 = phi i8 [ 1, %11 ], [ %5, %3 ]
%9 = phi i8* [ %12, %11 ], [ %6, %3 ]
%10 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
switch i32 %10, label %28 [
i32 -1, label %30
i32 97, label %3
i32 116, label %11
i32 63, label %13
]
11: ; preds = %7
%12 = load i8*, i8** @optarg
br label %7
13: ; preds = %7
%14 = load i8, i8* @optopt
%15 = icmp eq i8 %14, 116
br i1 %15, label %16, label %19
16: ; preds = %13
%17 = load i32, i32* @stderr
%18 = tail call i32 @fprintf(i32 %17, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), i8 signext 116)
br label %52
19: ; preds = %13
%20 = tail call i32 @isprint(i8 signext %14)
%21 = icmp eq i32 %20, 0
%22 = load i32, i32* @stderr
%23 = load i8, i8* @optopt
br i1 %21, label %26, label %24
24: ; preds = %19
%25 = tail call i32 @fprintf(i32 %22, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i8 signext %23)
br label %52
26: ; preds = %19
%27 = tail call i32 @fprintf(i32 %22, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0), i8 signext %23)
br label %52
28: ; preds = %7
%29 = tail call i32 (...) @abort()
unreachable
30: ; preds = %7
%31 = icmp eq i32 %0, 1
br i1 %31, label %32, label %35
32: ; preds = %30
%33 = load i8*, i8** %1
%34 = tail call i32 @DisplayUsage(i8* %33)
br label %38
35: ; preds = %30
%36 = zext i8 %8 to i32
%37 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.4, i64 0, i64 0), i32 %4, i32 %36, i8* %9)
br label %38
38: ; preds = %35, %32
%39 = load i32, i32* @optind
%40 = icmp slt i32 %39, %0
br i1 %40, label %41, label %52
41: ; preds = %38
%42 = sext i32 %39 to i64
br label %43
43: ; preds = %41, %43
%44 = phi i64 [ %42, %41 ], [ %49, %43 ]
%45 = getelementptr inbounds i8*, i8** %1, i64 %44
%46 = load i8*, i8** %45
%47 = trunc i64 %44 to i32
%48 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.5, i64 0, i64 0), i8* %46, i32 %47)
%49 = add nsw i64 %44, 1
%50 = trunc i64 %49 to i32
%51 = icmp eq i32 %50, %0
br i1 %51, label %52, label %43
52: ; preds = %43, %38, %16, %26, %24
%53 = phi i32 [ 1, %24 ], [ 1, %26 ], [ 1, %16 ], [ 0, %38 ], [ 0, %43 ]
ret i32 %53
}