#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 atoi(char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
scalar_t__ is_uint(char *);
int /*<<< orphan*/ print_help();
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcmp(char *, char *);
int my_getopt(int argc, char **argv, int *stack_size, int *array_size,
              char **output_file, char **input_file, int *mode) {
  int i;
  for (i = 1; i < argc; i++) {
    if (!strcmp(argv[i], "-s")) {
      if (i + 1 < argc && is_uint(argv[i + 1])) {
        *stack_size = atoi(argv[++i]);
      } else {
        fprintf(stderr, "%s: option requires a numerical argument -- 's'\n",
                *argv);
        return -1;
      }
    } else if (!strcmp(argv[i], "-a")) {
      if (i + 1 < argc && is_uint(argv[i + 1])) {
        *array_size = atoi(argv[++i]);
      } else {
        fprintf(stderr, "%s: option requires a numerical argument -- 'a'\n",
                *argv);
        return -1;
      }
    } else if (!strcmp(argv[i], "-c")) {
      *mode &= ~((1 << 2));
    } else if (!strcmp(argv[i], "-S")) {
      *mode &= ~((1 << 2) | (1 << 1));
    } else if (!strcmp(argv[i], "-o")) {
      if (i + 1 < argc) {
        *output_file = argv[++i];
        *mode &= ~((1 << 3));
      } else {
        fprintf(stderr, "%s: option requires an argument -- 'o'\n", *argv);
        return -1;
      }
    } else if (!strcmp(argv[i], "-v")) {
      *mode |= (1 << 5);
    } else if (!strcmp(argv[i], "-h") || !strcmp(argv[i], "--help")) {
      print_help();
      return -1;
    } else if (!strcmp(argv[i], "-pipe")) {
      *mode |= (1 << 3);
    } else if (!strcmp(argv[i], "-i")) {
      *mode |= (1 << 4);
    } else {
      *input_file = argv[i];
      *mode &= ~((1 << 4));
    }
  }
  return *mode;
}


x86 assembly (clang, -O0):
<my_getopt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x10(%rbp),%rax
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
movl   $0x1,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    14f7 <my_getopt+0x3a7>
mov    -0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe67(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    1229 <my_getopt+0xd9>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
cmp    -0x8(%rbp),%eax
jge    11fc <my_getopt+0xac>
mov    -0x10(%rbp),%rax
mov    -0x34(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
call   1070 <is_uint@plt>
cmp    $0x0,%rax
je     11fc <my_getopt+0xac>
mov    -0x10(%rbp),%rax
mov    -0x34(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,-0x34(%rbp)
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
call   1050 <atoi@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
jmp    1224 <my_getopt+0xd4>
mov    0x2ddd(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xdf0(%rip),%rsi
call   1040 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1500 <my_getopt+0x3b0>
jmp    14e4 <my_getopt+0x394>
mov    -0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xdf8(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    12cc <my_getopt+0x17c>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
cmp    -0x8(%rbp),%eax
jge    129f <my_getopt+0x14f>
mov    -0x10(%rbp),%rax
mov    -0x34(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
call   1070 <is_uint@plt>
cmp    $0x0,%rax
je     129f <my_getopt+0x14f>
mov    -0x10(%rbp),%rax
mov    -0x34(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,-0x34(%rbp)
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
call   1050 <atoi@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
jmp    12c7 <my_getopt+0x177>
mov    0x2d3a(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xd81(%rip),%rsi
call   1040 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1500 <my_getopt+0x3b0>
jmp    14df <my_getopt+0x38f>
mov    -0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xd89(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    12fd <my_getopt+0x1ad>
mov    0x10(%rbp),%rax
mov    (%rax),%ecx
and    $0xfffffffb,%ecx
mov    %ecx,(%rax)
jmp    14da <my_getopt+0x38a>
mov    -0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xd5b(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    132e <my_getopt+0x1de>
mov    0x10(%rbp),%rax
mov    (%rax),%ecx
and    $0xfffffff9,%ecx
mov    %ecx,(%rax)
jmp    14d5 <my_getopt+0x385>
mov    -0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xd2d(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    13b6 <my_getopt+0x266>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
cmp    -0x8(%rbp),%eax
jge    1389 <my_getopt+0x239>
mov    -0x10(%rbp),%rax
mov    -0x34(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,-0x34(%rbp)
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rcx
mov    -0x28(%rbp),%rax
mov    %rcx,(%rax)
mov    0x10(%rbp),%rax
mov    (%rax),%ecx
and    $0xfffffff7,%ecx
mov    %ecx,(%rax)
jmp    13b1 <my_getopt+0x261>
mov    0x2c50(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xcd1(%rip),%rsi
call   1040 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1500 <my_getopt+0x3b0>
jmp    14d0 <my_getopt+0x380>
mov    -0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xcd0(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    13e7 <my_getopt+0x297>
mov    0x10(%rbp),%rax
mov    (%rax),%ecx
or     $0x20,%ecx
mov    %ecx,(%rax)
jmp    14cb <my_getopt+0x37b>
mov    -0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xca2(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
je     1429 <my_getopt+0x2d9>
mov    -0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xc84(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    143c <my_getopt+0x2ec>
mov    $0x0,%al
call   1060 <print_help@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1500 <my_getopt+0x3b0>
mov    -0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xc57(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    146d <my_getopt+0x31d>
mov    0x10(%rbp),%rax
mov    (%rax),%ecx
or     $0x8,%ecx
mov    %ecx,(%rax)
jmp    14c1 <my_getopt+0x371>
mov    -0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xc2c(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    149e <my_getopt+0x34e>
mov    0x10(%rbp),%rax
mov    (%rax),%ecx
or     $0x10,%ecx
mov    %ecx,(%rax)
jmp    14bc <my_getopt+0x36c>
mov    -0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,8),%rcx
mov    -0x30(%rbp),%rax
mov    %rcx,(%rax)
mov    0x10(%rbp),%rax
mov    (%rax),%ecx
and    $0xffffffef,%ecx
mov    %ecx,(%rax)
jmp    14c1 <my_getopt+0x371>
jmp    14c6 <my_getopt+0x376>
jmp    14cb <my_getopt+0x37b>
jmp    14d0 <my_getopt+0x380>
jmp    14d5 <my_getopt+0x385>
jmp    14da <my_getopt+0x38a>
jmp    14df <my_getopt+0x38f>
jmp    14e4 <my_getopt+0x394>
jmp    14e9 <my_getopt+0x399>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    117a <my_getopt+0x2a>
mov    0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_getopt>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %r9,0x8(%rsp)
mov    %r8,0x10(%rsp)
mov    %rcx,0x18(%rsp)
mov    %rdx,0x20(%rsp)
cmp    $0x2,%edi
jl     1384 <my_getopt+0x234>
mov    %rsi,%rbx
mov    %edi,%r13d
mov    $0x1,%r12d
lea    0xe72(%rip),%r14
jmp    11ad <my_getopt+0x5d>
mov    0x60(%rsp),%rax
andb   $0xfb,(%rax)
nopl   0x0(%rax,%rax,1)
add    $0x1,%r12d
cmp    %r13d,%r12d
jge    1384 <my_getopt+0x234>
movslq %r12d,%rax
mov    (%rbx,%rax,8),%r15
mov    %r15,%rdi
mov    %r14,%rsi
call   1030 <strcmp@plt>
test   %eax,%eax
je     12b0 <my_getopt+0x160>
mov    %r15,%rdi
lea    0xe63(%rip),%rsi
call   1030 <strcmp@plt>
test   %eax,%eax
je     12f0 <my_getopt+0x1a0>
mov    %r15,%rdi
lea    0xe80(%rip),%rsi
call   1030 <strcmp@plt>
test   %eax,%eax
je     1190 <my_getopt+0x40>
mov    %r15,%rdi
lea    0xe70(%rip),%rsi
call   1030 <strcmp@plt>
test   %eax,%eax
je     1327 <my_getopt+0x1d7>
mov    %r15,%rdi
lea    0xe5c(%rip),%rsi
call   1030 <strcmp@plt>
test   %eax,%eax
je     1334 <my_getopt+0x1e4>
mov    %r15,%rdi
lea    0xe70(%rip),%rsi
call   1030 <strcmp@plt>
test   %eax,%eax
je     135d <my_getopt+0x20d>
mov    %r15,%rdi
lea    0xe5c(%rip),%rsi
call   1030 <strcmp@plt>
test   %eax,%eax
je     13ce <my_getopt+0x27e>
mov    %r15,%rdi
lea    0xe48(%rip),%rsi
call   1030 <strcmp@plt>
test   %eax,%eax
je     13ce <my_getopt+0x27e>
mov    %r15,%rdi
lea    0xe38(%rip),%rsi
call   1030 <strcmp@plt>
test   %eax,%eax
je     136a <my_getopt+0x21a>
mov    %r15,%rdi
lea    0xe27(%rip),%rsi
call   1030 <strcmp@plt>
test   %eax,%eax
je     1377 <my_getopt+0x227>
mov    0x8(%rsp),%rax
mov    %r15,(%rax)
mov    0x60(%rsp),%rax
andb   $0xef,(%rax)
jmp    11a0 <my_getopt+0x50>
nopw   0x0(%rax,%rax,1)
add    $0x1,%r12d
cmp    %r13d,%r12d
jge    138d <my_getopt+0x23d>
movslq %r12d,%rbp
mov    (%rbx,%rbp,8),%rdi
call   1070 <is_uint@plt>
test   %rax,%rax
je     138d <my_getopt+0x23d>
mov    (%rbx,%rbp,8),%rdi
call   1050 <atoi@plt>
mov    0x20(%rsp),%rcx
mov    %eax,(%rcx)
jmp    11a0 <my_getopt+0x50>
nopw   0x0(%rax,%rax,1)
add    $0x1,%r12d
cmp    %r13d,%r12d
jge    13a2 <my_getopt+0x252>
movslq %r12d,%rbp
mov    (%rbx,%rbp,8),%rdi
call   1070 <is_uint@plt>
test   %rax,%rax
je     13a2 <my_getopt+0x252>
mov    (%rbx,%rbp,8),%rdi
call   1050 <atoi@plt>
mov    0x18(%rsp),%rcx
mov    %eax,(%rcx)
jmp    11a0 <my_getopt+0x50>
mov    0x60(%rsp),%rax
andb   $0xf9,(%rax)
jmp    11a0 <my_getopt+0x50>
add    $0x1,%r12d
cmp    %r13d,%r12d
jge    13d7 <my_getopt+0x287>
movslq %r12d,%rax
mov    (%rbx,%rax,8),%rax
mov    0x10(%rsp),%rcx
mov    %rax,(%rcx)
mov    0x60(%rsp),%rax
andb   $0xf7,(%rax)
jmp    11a0 <my_getopt+0x50>
mov    0x60(%rsp),%rax
orb    $0x20,(%rax)
jmp    11a0 <my_getopt+0x50>
mov    0x60(%rsp),%rax
orb    $0x8,(%rax)
jmp    11a0 <my_getopt+0x50>
mov    0x60(%rsp),%rax
orb    $0x10,(%rax)
jmp    11a0 <my_getopt+0x50>
mov    0x60(%rsp),%rax
mov    (%rax),%eax
jmp    13bf <my_getopt+0x26f>
mov    0x2c4c(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
lea    0xc63(%rip),%rsi
jmp    13b5 <my_getopt+0x265>
mov    0x2c37(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
lea    0xc82(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0xffffffff,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %eax,%eax
call   1060 <print_help@plt>
jmp    13ba <my_getopt+0x26a>
mov    0x2c02(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
lea    0xc87(%rip),%rsi
jmp    13b5 <my_getopt+0x265>

LLVM IR (-O0):
@.str = [3 x i8] c"-s\00"
@stderr = global i32 0
@.str.1 = [49 x i8] c"%s: option requires a numerical argument -- 's'\0A\00"
@.str.2 = [3 x i8] c"-a\00"
@.str.3 = [49 x i8] c"%s: option requires a numerical argument -- 'a'\0A\00"
@.str.4 = [3 x i8] c"-c\00"
@.str.5 = [3 x i8] c"-S\00"
@.str.6 = [3 x i8] c"-o\00"
@.str.7 = [40 x i8] c"%s: option requires an argument -- 'o'\0A\00"
@.str.8 = [3 x i8] c"-v\00"
@.str.9 = [3 x i8] c"-h\00"
@.str.10 = [7 x i8] c"--help\00"
@.str.11 = [6 x i8] c"-pipe\00"
@.str.12 = [3 x i8] c"-i\00"
define i32 @my_getopt(i32 %0, i8** %1, i32* %2, i32* %3, i8** %4, i8** %5, i32* %6) {
%8 = alloca i32
%9 = alloca i32
%10 = alloca i8**
%11 = alloca i32*
%12 = alloca i32*
%13 = alloca i8**
%14 = alloca i8**
%15 = alloca i32*
%16 = alloca i32
store i32 %0, i32* %9
store i8** %1, i8*** %10
store i32* %2, i32** %11
store i32* %3, i32** %12
store i8** %4, i8*** %13
store i8** %5, i8*** %14
store i32* %6, i32** %15
store i32 1, i32* %16
br label %17
17: ; preds = %222, %7
%18 = load i32, i32* %16
%19 = load i32, i32* %9
%20 = icmp slt i32 %18, %19
br i1 %20, label %21, label %225
21: ; preds = %17
%22 = load i8**, i8*** %10
%23 = load i32, i32* %16
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i8*, i8** %22, i64 %24
%26 = load i8*, i8** %25
%27 = call i32 @strcmp(i8* %26, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%28 = icmp ne i32 %27, 0
br i1 %28, label %58, label %29
29: ; preds = %21
%30 = load i32, i32* %16
%31 = add nsw i32 %30, 1
%32 = load i32, i32* %9
%33 = icmp slt i32 %31, %32
br i1 %33, label %34, label %52
34: ; preds = %29
%35 = load i8**, i8*** %10
%36 = load i32, i32* %16
%37 = add nsw i32 %36, 1
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds i8*, i8** %35, i64 %38
%40 = load i8*, i8** %39
%41 = call i64 @is_uint(i8* %40)
%42 = icmp ne i64 %41, 0
br i1 %42, label %43, label %52
43: ; preds = %34
%44 = load i8**, i8*** %10
%45 = load i32, i32* %16
%46 = add nsw i32 %45, 1
store i32 %46, i32* %16
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds i8*, i8** %44, i64 %47
%49 = load i8*, i8** %48
%50 = call i32 @atoi(i8* %49)
%51 = load i32*, i32** %11
store i32 %50, i32* %51
br label %57
52: ; preds = %34, %29
%53 = load i32, i32* @stderr
%54 = load i8**, i8*** %10
%55 = load i8*, i8** %54
%56 = call i32 @fprintf(i32 %53, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.1, i64 0, i64 0), i8* %55)
store i32 -1, i32* %8
br label %228
57: ; preds = %43
br label %221
58: ; preds = %21
%59 = load i8**, i8*** %10
%60 = load i32, i32* %16
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds i8*, i8** %59, i64 %61
%63 = load i8*, i8** %62
%64 = call i32 @strcmp(i8* %63, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%65 = icmp ne i32 %64, 0
br i1 %65, label %95, label %66
66: ; preds = %58
%67 = load i32, i32* %16
%68 = add nsw i32 %67, 1
%69 = load i32, i32* %9
%70 = icmp slt i32 %68, %69
br i1 %70, label %71, label %89
71: ; preds = %66
%72 = load i8**, i8*** %10
%73 = load i32, i32* %16
%74 = add nsw i32 %73, 1
%75 = sext i32 %74 to i64
%76 = getelementptr inbounds i8*, i8** %72, i64 %75
%77 = load i8*, i8** %76
%78 = call i64 @is_uint(i8* %77)
%79 = icmp ne i64 %78, 0
br i1 %79, label %80, label %89
80: ; preds = %71
%81 = load i8**, i8*** %10
%82 = load i32, i32* %16
%83 = add nsw i32 %82, 1
store i32 %83, i32* %16
%84 = sext i32 %83 to i64
%85 = getelementptr inbounds i8*, i8** %81, i64 %84
%86 = load i8*, i8** %85
%87 = call i32 @atoi(i8* %86)
%88 = load i32*, i32** %12
store i32 %87, i32* %88
br label %94
89: ; preds = %71, %66
%90 = load i32, i32* @stderr
%91 = load i8**, i8*** %10
%92 = load i8*, i8** %91
%93 = call i32 @fprintf(i32 %90, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.3, i64 0, i64 0), i8* %92)
store i32 -1, i32* %8
br label %228
94: ; preds = %80
br label %220
95: ; preds = %58
%96 = load i8**, i8*** %10
%97 = load i32, i32* %16
%98 = sext i32 %97 to i64
%99 = getelementptr inbounds i8*, i8** %96, i64 %98
%100 = load i8*, i8** %99
%101 = call i32 @strcmp(i8* %100, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%102 = icmp ne i32 %101, 0
br i1 %102, label %107, label %103
103: ; preds = %95
%104 = load i32*, i32** %15
%105 = load i32, i32* %104
%106 = and i32 %105, -5
store i32 %106, i32* %104
br label %219
107: ; preds = %95
%108 = load i8**, i8*** %10
%109 = load i32, i32* %16
%110 = sext i32 %109 to i64
%111 = getelementptr inbounds i8*, i8** %108, i64 %110
%112 = load i8*, i8** %111
%113 = call i32 @strcmp(i8* %112, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
%114 = icmp ne i32 %113, 0
br i1 %114, label %119, label %115
115: ; preds = %107
%116 = load i32*, i32** %15
%117 = load i32, i32* %116
%118 = and i32 %117, -7
store i32 %118, i32* %116
br label %218
119: ; preds = %107
%120 = load i8**, i8*** %10
%121 = load i32, i32* %16
%122 = sext i32 %121 to i64
%123 = getelementptr inbounds i8*, i8** %120, i64 %122
%124 = load i8*, i8** %123
%125 = call i32 @strcmp(i8* %124, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%126 = icmp ne i32 %125, 0
br i1 %126, label %149, label %127
127: ; preds = %119
%128 = load i32, i32* %16
%129 = add nsw i32 %128, 1
%130 = load i32, i32* %9
%131 = icmp slt i32 %129, %130
br i1 %131, label %132, label %143
132: ; preds = %127
%133 = load i8**, i8*** %10
%134 = load i32, i32* %16
%135 = add nsw i32 %134, 1
store i32 %135, i32* %16
%136 = sext i32 %135 to i64
%137 = getelementptr inbounds i8*, i8** %133, i64 %136
%138 = load i8*, i8** %137
%139 = load i8**, i8*** %13
store i8* %138, i8** %139
%140 = load i32*, i32** %15
%141 = load i32, i32* %140
%142 = and i32 %141, -9
store i32 %142, i32* %140
br label %148
143: ; preds = %127
%144 = load i32, i32* @stderr
%145 = load i8**, i8*** %10
%146 = load i8*, i8** %145
%147 = call i32 @fprintf(i32 %144, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.7, i64 0, i64 0), i8* %146)
store i32 -1, i32* %8
br label %228
148: ; preds = %132
br label %217
149: ; preds = %119
%150 = load i8**, i8*** %10
%151 = load i32, i32* %16
%152 = sext i32 %151 to i64
%153 = getelementptr inbounds i8*, i8** %150, i64 %152
%154 = load i8*, i8** %153
%155 = call i32 @strcmp(i8* %154, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0))
%156 = icmp ne i32 %155, 0
br i1 %156, label %161, label %157
157: ; preds = %149
%158 = load i32*, i32** %15
%159 = load i32, i32* %158
%160 = or i32 %159, 32
store i32 %160, i32* %158
br label %216
161: ; preds = %149
%162 = load i8**, i8*** %10
%163 = load i32, i32* %16
%164 = sext i32 %163 to i64
%165 = getelementptr inbounds i8*, i8** %162, i64 %164
%166 = load i8*, i8** %165
%167 = call i32 @strcmp(i8* %166, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0))
%168 = icmp ne i32 %167, 0
br i1 %168, label %169, label %177
169: ; preds = %161
%170 = load i8**, i8*** %10
%171 = load i32, i32* %16
%172 = sext i32 %171 to i64
%173 = getelementptr inbounds i8*, i8** %170, i64 %172
%174 = load i8*, i8** %173
%175 = call i32 @strcmp(i8* %174, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.10, i64 0, i64 0))
%176 = icmp ne i32 %175, 0
br i1 %176, label %179, label %177
177: ; preds = %169, %161
%178 = call i32 (...) @print_help()
store i32 -1, i32* %8
br label %228
179: ; preds = %169
%180 = load i8**, i8*** %10
%181 = load i32, i32* %16
%182 = sext i32 %181 to i64
%183 = getelementptr inbounds i8*, i8** %180, i64 %182
%184 = load i8*, i8** %183
%185 = call i32 @strcmp(i8* %184, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.11, i64 0, i64 0))
%186 = icmp ne i32 %185, 0
br i1 %186, label %191, label %187
187: ; preds = %179
%188 = load i32*, i32** %15
%189 = load i32, i32* %188
%190 = or i32 %189, 8
store i32 %190, i32* %188
br label %214
191: ; preds = %179
%192 = load i8**, i8*** %10
%193 = load i32, i32* %16
%194 = sext i32 %193 to i64
%195 = getelementptr inbounds i8*, i8** %192, i64 %194
%196 = load i8*, i8** %195
%197 = call i32 @strcmp(i8* %196, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.12, i64 0, i64 0))
%198 = icmp ne i32 %197, 0
br i1 %198, label %203, label %199
199: ; preds = %191
%200 = load i32*, i32** %15
%201 = load i32, i32* %200
%202 = or i32 %201, 16
store i32 %202, i32* %200
br label %213
203: ; preds = %191
%204 = load i8**, i8*** %10
%205 = load i32, i32* %16
%206 = sext i32 %205 to i64
%207 = getelementptr inbounds i8*, i8** %204, i64 %206
%208 = load i8*, i8** %207
%209 = load i8**, i8*** %14
store i8* %208, i8** %209
%210 = load i32*, i32** %15
%211 = load i32, i32* %210
%212 = and i32 %211, -17
store i32 %212, i32* %210
br label %213
213: ; preds = %203, %199
br label %214
214: ; preds = %213, %187
br label %215
215: ; preds = %214
br label %216
216: ; preds = %215, %157
br label %217
217: ; preds = %216, %148
br label %218
218: ; preds = %217, %115
br label %219
219: ; preds = %218, %103
br label %220
220: ; preds = %219, %94
br label %221
221: ; preds = %220, %57
br label %222
222: ; preds = %221
%223 = load i32, i32* %16
%224 = add nsw i32 %223, 1
store i32 %224, i32* %16
br label %17
225: ; preds = %17
%226 = load i32*, i32** %15
%227 = load i32, i32* %226
store i32 %227, i32* %8
br label %228
228: ; preds = %225, %177, %143, %89, %52
%229 = load i32, i32* %8
ret i32 %229
}

LLVM IR (-O2):
@.str = [3 x i8] c"-s\00"
@stderr = global i32 0
@.str.1 = [49 x i8] c"%s: option requires a numerical argument -- 's'\0A\00"
@.str.2 = [3 x i8] c"-a\00"
@.str.3 = [49 x i8] c"%s: option requires a numerical argument -- 'a'\0A\00"
@.str.4 = [3 x i8] c"-c\00"
@.str.5 = [3 x i8] c"-S\00"
@.str.6 = [3 x i8] c"-o\00"
@.str.7 = [40 x i8] c"%s: option requires an argument -- 'o'\0A\00"
@.str.8 = [3 x i8] c"-v\00"
@.str.9 = [3 x i8] c"-h\00"
@.str.10 = [7 x i8] c"--help\00"
@.str.11 = [6 x i8] c"-pipe\00"
@.str.12 = [3 x i8] c"-i\00"
define i32 @my_getopt(i32 %0, i8** nocapture %1, i32* nocapture writeonly %2, i32* nocapture writeonly %3, i8** nocapture writeonly %4, i8** nocapture writeonly %5, i32* nocapture %6) {
%8 = icmp sgt i32 %0, 1
br i1 %8, label %9, label %112
9: ; preds = %7, %108
%10 = phi i32 [ %110, %108 ], [ 1, %7 ]
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i8*, i8** %1, i64 %11
%13 = load i8*, i8** %12
%14 = tail call i32 @strcmp(i8* dereferenceable(1) %13, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %32
16: ; preds = %9
%17 = add nsw i32 %10, 1
%18 = icmp slt i32 %17, %0
br i1 %18, label %19, label %28
19: ; preds = %16
%20 = sext i32 %17 to i64
%21 = getelementptr inbounds i8*, i8** %1, i64 %20
%22 = load i8*, i8** %21
%23 = tail call i64 @is_uint(i8* %22)
%24 = icmp eq i64 %23, 0
br i1 %24, label %28, label %25
25: ; preds = %19
%26 = load i8*, i8** %21
%27 = tail call i32 @atoi(i8* %26)
store i32 %27, i32* %2
br label %108
28: ; preds = %19, %16
%29 = load i32, i32* @stderr
%30 = load i8*, i8** %1
%31 = tail call i32 @fprintf(i32 %29, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.1, i64 0, i64 0), i8* %30)
br label %114
32: ; preds = %9
%33 = tail call i32 @strcmp(i8* dereferenceable(1) %13, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%34 = icmp eq i32 %33, 0
br i1 %34, label %35, label %51
35: ; preds = %32
%36 = add nsw i32 %10, 1
%37 = icmp slt i32 %36, %0
br i1 %37, label %38, label %47
38: ; preds = %35
%39 = sext i32 %36 to i64
%40 = getelementptr inbounds i8*, i8** %1, i64 %39
%41 = load i8*, i8** %40
%42 = tail call i64 @is_uint(i8* %41)
%43 = icmp eq i64 %42, 0
br i1 %43, label %47, label %44
44: ; preds = %38
%45 = load i8*, i8** %40
%46 = tail call i32 @atoi(i8* %45)
store i32 %46, i32* %3
br label %108
47: ; preds = %38, %35
%48 = load i32, i32* @stderr
%49 = load i8*, i8** %1
%50 = tail call i32 @fprintf(i32 %48, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.3, i64 0, i64 0), i8* %49)
br label %114
51: ; preds = %32
%52 = tail call i32 @strcmp(i8* dereferenceable(1) %13, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%53 = icmp eq i32 %52, 0
br i1 %53, label %54, label %57
54: ; preds = %51
%55 = load i32, i32* %6
%56 = and i32 %55, -5
store i32 %56, i32* %6
br label %108
57: ; preds = %51
%58 = tail call i32 @strcmp(i8* dereferenceable(1) %13, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
%59 = icmp eq i32 %58, 0
br i1 %59, label %60, label %63
60: ; preds = %57
%61 = load i32, i32* %6
%62 = and i32 %61, -7
store i32 %62, i32* %6
br label %108
63: ; preds = %57
%64 = tail call i32 @strcmp(i8* dereferenceable(1) %13, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%65 = icmp eq i32 %64, 0
br i1 %65, label %66, label %79
66: ; preds = %63
%67 = add nsw i32 %10, 1
%68 = icmp slt i32 %67, %0
br i1 %68, label %69, label %75
69: ; preds = %66
%70 = sext i32 %67 to i64
%71 = getelementptr inbounds i8*, i8** %1, i64 %70
%72 = load i8*, i8** %71
store i8* %72, i8** %4
%73 = load i32, i32* %6
%74 = and i32 %73, -9
store i32 %74, i32* %6
br label %108
75: ; preds = %66
%76 = load i32, i32* @stderr
%77 = load i8*, i8** %1
%78 = tail call i32 @fprintf(i32 %76, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.7, i64 0, i64 0), i8* %77)
br label %114
79: ; preds = %63
%80 = tail call i32 @strcmp(i8* dereferenceable(1) %13, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0))
%81 = icmp eq i32 %80, 0
br i1 %81, label %82, label %85
82: ; preds = %79
%83 = load i32, i32* %6
%84 = or i32 %83, 32
store i32 %84, i32* %6
br label %108
85: ; preds = %79
%86 = tail call i32 @strcmp(i8* dereferenceable(1) %13, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0))
%87 = icmp eq i32 %86, 0
br i1 %87, label %91, label %88
88: ; preds = %85
%89 = tail call i32 @strcmp(i8* dereferenceable(1) %13, i8* dereferenceable(7) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.10, i64 0, i64 0))
%90 = icmp eq i32 %89, 0
br i1 %90, label %91, label %93
91: ; preds = %88, %85
%92 = tail call i32 (...) @print_help()
br label %114
93: ; preds = %88
%94 = tail call i32 @strcmp(i8* dereferenceable(1) %13, i8* dereferenceable(6) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.11, i64 0, i64 0))
%95 = icmp eq i32 %94, 0
br i1 %95, label %96, label %99
96: ; preds = %93
%97 = load i32, i32* %6
%98 = or i32 %97, 8
store i32 %98, i32* %6
br label %108
99: ; preds = %93
%100 = tail call i32 @strcmp(i8* dereferenceable(1) %13, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.12, i64 0, i64 0))
%101 = icmp eq i32 %100, 0
br i1 %101, label %102, label %105
102: ; preds = %99
%103 = load i32, i32* %6
%104 = or i32 %103, 16
store i32 %104, i32* %6
br label %108
105: ; preds = %99
store i8* %13, i8** %5
%106 = load i32, i32* %6
%107 = and i32 %106, -17
store i32 %107, i32* %6
br label %108
108: ; preds = %25, %54, %69, %102, %105, %96, %82, %60, %44
%109 = phi i32 [ %10, %105 ], [ %10, %102 ], [ %10, %96 ], [ %10, %82 ], [ %67, %69 ], [ %10, %60 ], [ %10, %54 ], [ %36, %44 ], [ %17, %25 ]
%110 = add nsw i32 %109, 1
%111 = icmp slt i32 %110, %0
br i1 %111, label %9, label %112
112: ; preds = %108, %7
%113 = load i32, i32* %6
br label %114
114: ; preds = %112, %91, %75, %47, %28
%115 = phi i32 [ -1, %91 ], [ -1, %75 ], [ -1, %47 ], [ -1, %28 ], [ %113, %112 ]
ret i32 %115
}