#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 */
typedef void *uintmax_t;
struct option {
  char *name;
  int has_arg;
  int *flag;
  char val;
};
typedef long pid_t;

/* Variables and functions */
scalar_t__ ERANGE;
int /*<<< orphan*/ EXIT_SUCCESS;
long LONG_MAX;
int SIGTERM;
void *atoi(int /*<<< orphan*/);
scalar_t__ errno;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int getopt_long(int, char **, char *, struct option const *,
                int /*<<< orphan*/ *);
int /*<<< orphan*/ optarg;
size_t optind;
int /*<<< orphan*/ print_version();
int /*<<< orphan*/ stderr;
long strtol(char *, char **, int);
int /*<<< orphan*/ usage(char const *);
int parse_args(int argc, char **argv, pid_t *pid, int *sig, uintmax_t *count) {
  int lflag, c;
  const struct option opts[] = {
      {
          .name = "version",
          .has_arg = 0,
          .flag = &lflag,
          .val = 'v',
      },
      {
          .name = "count",
          .has_arg = 1,
          .flag = &lflag,
          .val = 'c',
      },
      {
          .name = "sig",
          .has_arg = 1,
          .flag = &lflag,
          .val = 's',
      },
      {
          .name = NULL,
          .has_arg = 0,
          .flag = 0,
          .val = 0,
      },
  };
  const char *argv0 = *argv;
  char *pidstr;
  long r;
  *sig = 0;
  *count = 0;
  while ((c = getopt_long(argc, argv, "c:s:", opts, NULL)) >= 0) {
    switch (c) {
    case 'c':
    case 's':
      lflag = c;
    case 0:
      switch (lflag) {
      case 'c':
        do {
          if (!*(count)) {
            *count = atoi(optarg);
          } else {
            fprintf(stderr, "Provided '%c' twice\n", ('c'));
            goto err;
          }
        } while (0);
        break;
      case 's':
        do {
          if (!*(sig)) {
            *sig = atoi(optarg);
          } else {
            fprintf(stderr, "Provided '%c' twice\n", ('s'));
            goto err;
          }
        } while (0);
        break;
      case 'v':
        print_version();
        exit(EXIT_SUCCESS);
      default:
        goto err;
      }
      break;
    default:
      goto err;
    }
  }
  if (argv[optind] == NULL || argv[optind + 1] != NULL) {
    goto err;
  }
  r = strtol(argv[optind], &pidstr, 10);
  if (r <= 0 || (r == LONG_MAX && errno == ERANGE) || argv[optind][0] == '\0' ||
      *pidstr != '\0') {
    fprintf(stderr, "Couldn't use PID: %s\n", argv[optind]);
    goto err;
  }
  *pid = r;
  if (*sig == 0) {
    *sig = SIGTERM;
  }
  return 0;
err:
  usage(argv0);
  return -1;
}


x86 assembly (clang, -O0):
<parse_args>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
lea    -0xb0(%rbp),%rdi
lea    0xe54(%rip),%rax
mov    %rax,-0xb0(%rbp)
movl   $0x0,-0xa8(%rbp)
lea    -0x2c(%rbp),%rax
mov    %rax,-0xa0(%rbp)
movb   $0x76,-0x98(%rbp)
add    $0x20,%rdi
lea    0xe2e(%rip),%rax
mov    %rax,-0x90(%rbp)
movl   $0x1,-0x88(%rbp)
lea    -0x2c(%rbp),%rax
mov    %rax,-0x80(%rbp)
movb   $0x63,-0x78(%rbp)
add    $0x20,%rdi
lea    0xe0c(%rip),%rax
mov    %rax,-0x70(%rbp)
movl   $0x1,-0x68(%rbp)
lea    -0x2c(%rbp),%rax
mov    %rax,-0x60(%rbp)
movb   $0x73,-0x58(%rbp)
add    $0x20,%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1050 <memset@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0xb8(%rbp)
mov    -0x20(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x28(%rbp),%rax
movq   $0x0,(%rax)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    -0xb0(%rbp),%rcx
lea    0xdb1(%rip),%rdx
xor    %eax,%eax
mov    %eax,%r8d
call   1040 <getopt_long@plt>
mov    %eax,-0x30(%rbp)
cmp    $0x0,%eax
jl     13d6 <parse_args+0x256>
mov    -0x30(%rbp),%eax
mov    %eax,-0xcc(%rbp)
test   %eax,%eax
je     12bb <parse_args+0x13b>
jmp    128d <parse_args+0x10d>
mov    -0xcc(%rbp),%eax
sub    $0x63,%eax
je     12b5 <parse_args+0x135>
jmp    12a1 <parse_args+0x121>
mov    -0xcc(%rbp),%eax
sub    $0x73,%eax
jne    13cc <parse_args+0x24c>
jmp    12b5 <parse_args+0x135>
mov    -0x30(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
mov    %eax,-0xd0(%rbp)
sub    $0x63,%eax
je     12fa <parse_args+0x17a>
jmp    12d2 <parse_args+0x152>
mov    -0xd0(%rbp),%eax
sub    $0x73,%eax
je     1355 <parse_args+0x1d5>
jmp    12e6 <parse_args+0x166>
mov    -0xd0(%rbp),%eax
sub    $0x76,%eax
je     13ad <parse_args+0x22d>
jmp    13c2 <parse_args+0x242>
jmp    12ff <parse_args+0x17f>
mov    -0x28(%rbp),%rax
cmpq   $0x0,(%rax)
jne    132a <parse_args+0x1aa>
mov    0x2ce4(%rip),%rax
mov    (%rax),%edi
call   1090 <atoi@plt>
mov    %rax,%rcx
mov    -0x28(%rbp),%rax
mov    %rcx,(%rax)
jmp    134b <parse_args+0x1cb>
mov    0x2c8f(%rip),%rax
mov    (%rax),%edi
lea    0xcdd(%rip),%rsi
mov    $0x63,%edx
mov    $0x0,%al
call   1060 <fprintf@plt>
jmp    150c <parse_args+0x38c>
jmp    1350 <parse_args+0x1d0>
jmp    13c7 <parse_args+0x247>
jmp    135a <parse_args+0x1da>
mov    -0x20(%rbp),%rax
cmpl   $0x0,(%rax)
jne    1382 <parse_args+0x202>
mov    0x2c8a(%rip),%rax
mov    (%rax),%edi
call   1090 <atoi@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
jmp    13a3 <parse_args+0x223>
mov    0x2c37(%rip),%rax
mov    (%rax),%edi
lea    0xc85(%rip),%rsi
mov    $0x73,%edx
mov    $0x0,%al
call   1060 <fprintf@plt>
jmp    150c <parse_args+0x38c>
jmp    13a8 <parse_args+0x228>
jmp    13c7 <parse_args+0x247>
mov    $0x0,%al
call   1030 <print_version@plt>
mov    0x2bed(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>
jmp    150c <parse_args+0x38c>
jmp    13d1 <parse_args+0x251>
jmp    150c <parse_args+0x38c>
jmp    124c <parse_args+0xcc>
mov    -0x10(%rbp),%rax
mov    0x2bf7(%rip),%rcx
mov    (%rcx),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     1409 <parse_args+0x289>
mov    -0x10(%rbp),%rax
mov    0x2bde(%rip),%rcx
mov    (%rcx),%rcx
cmpq   $0x0,0x8(%rax,%rcx,8)
je     140e <parse_args+0x28e>
jmp    150c <parse_args+0x38c>
mov    -0x10(%rbp),%rax
mov    0x2bbf(%rip),%rcx
mov    (%rcx),%rcx
mov    (%rax,%rcx,8),%rdi
lea    -0xc0(%rbp),%rsi
mov    $0xa,%edx
call   1070 <strtol@plt>
mov    %rax,-0xc8(%rbp)
cmpq   $0x0,-0xc8(%rbp)
jle    14a8 <parse_args+0x328>
mov    -0xc8(%rbp),%rax
mov    0x2b64(%rip),%rcx
cmp    (%rcx),%rax
jne    1477 <parse_args+0x2f7>
mov    0x2b4c(%rip),%rax
mov    (%rax),%rax
mov    0x2b62(%rip),%rcx
cmp    (%rcx),%rax
je     14a8 <parse_args+0x328>
mov    -0x10(%rbp),%rax
mov    0x2b56(%rip),%rcx
mov    (%rcx),%rcx
mov    (%rax,%rcx,8),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     14a8 <parse_args+0x328>
mov    -0xc0(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     14d6 <parse_args+0x356>
mov    0x2b11(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x2b1c(%rip),%rcx
mov    (%rcx),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xb62(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
jmp    150c <parse_args+0x38c>
mov    -0xc8(%rbp),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x20(%rbp),%rax
cmpl   $0x0,(%rax)
jne    1500 <parse_args+0x380>
mov    0x2ae8(%rip),%rax
mov    (%rax),%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
movl   $0x0,-0x4(%rbp)
jmp    151f <parse_args+0x39f>
mov    -0xb8(%rbp),%rdi
call   1080 <usage@plt>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_args>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xa8,%rsp
mov    %r8,%rbx
mov    %rcx,%r15
mov    %rdx,0x8(%rsp)
mov    %rsi,%r13
mov    %edi,%ebp
lea    0xe68(%rip),%rax
mov    %rax,0x20(%rsp)
movl   $0x0,0x28(%rsp)
lea    0x4(%rsp),%rax
mov    %rax,0x30(%rsp)
movb   $0x76,0x38(%rsp)
lea    0xe4d(%rip),%rcx
mov    %rcx,0x40(%rsp)
movl   $0x1,0x48(%rsp)
mov    %rax,0x50(%rsp)
movb   $0x63,0x58(%rsp)
lea    0xe35(%rip),%rcx
mov    %rcx,0x60(%rsp)
movl   $0x1,0x68(%rsp)
mov    %rax,0x70(%rsp)
movb   $0x73,0x78(%rsp)
xorps  %xmm0,%xmm0
movaps %xmm0,0x80(%rsp)
movaps %xmm0,0x90(%rsp)
mov    (%rsi),%rax
mov    %rax,0x10(%rsp)
movl   $0x0,(%r15)
movq   $0x0,(%r8)
lea    0xdf2(%rip),%rdx
lea    0x20(%rsp),%rcx
xor    %r8d,%r8d
call   1040 <getopt_long@plt>
test   %eax,%eax
js     12d6 <parse_args+0x166>
lea    0xdd6(%rip),%r12
lea    0x20(%rsp),%r14
jmp    1278 <parse_args+0x108>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    0x2da1(%rip),%rax
mov    (%rax),%edi
call   1080 <atoi@plt>
mov    %eax,(%r15)
mov    %ebp,%edi
mov    %r13,%rsi
mov    %r12,%rdx
mov    %r14,%rcx
xor    %r8d,%r8d
call   1040 <getopt_long@plt>
test   %eax,%eax
js     12d6 <parse_args+0x166>
test   %eax,%eax
je     12b0 <parse_args+0x140>
cmp    $0x73,%eax
je     128a <parse_args+0x11a>
cmp    $0x63,%eax
jne    13b9 <parse_args+0x249>
mov    %eax,0x4(%rsp)
cmp    $0x63,%eax
je     12b9 <parse_args+0x149>
cmp    $0x73,%eax
jne    136c <parse_args+0x1fc>
cmpl   $0x0,(%r15)
je     1250 <parse_args+0xe0>
jmp    1386 <parse_args+0x216>
nopw   0x0(%rax,%rax,1)
mov    0x4(%rsp),%eax
cmp    $0x63,%eax
jne    1293 <parse_args+0x123>
cmpq   $0x0,(%rbx)
jne    139d <parse_args+0x22d>
mov    0x2d2e(%rip),%rax
mov    (%rax),%edi
call   1080 <atoi@plt>
mov    %rax,(%rbx)
jmp    1261 <parse_args+0xf1>
mov    0x2cfb(%rip),%rbx
mov    (%rbx),%rax
mov    0x0(%r13,%rax,8),%rdi
test   %rdi,%rdi
je     13b9 <parse_args+0x249>
cmpq   $0x0,0x8(%r13,%rax,8)
jne    13b9 <parse_args+0x249>
lea    0x18(%rsp),%rsi
mov    $0xa,%edx
call   1060 <strtol@plt>
test   %rax,%rax
jle    134b <parse_args+0x1db>
mov    0x2ca3(%rip),%rcx
cmp    (%rcx),%rax
jne    1330 <parse_args+0x1c0>
mov    0x2c8f(%rip),%rcx
mov    (%rcx),%rcx
mov    0x2ca5(%rip),%rdx
cmp    (%rdx),%rcx
je     134b <parse_args+0x1db>
mov    (%rbx),%rcx
mov    0x0(%r13,%rcx,8),%rcx
cmpb   $0x0,(%rcx)
je     134b <parse_args+0x1db>
mov    0x18(%rsp),%rcx
cmpb   $0x0,(%rcx)
je     13da <parse_args+0x26a>
mov    0x2c6e(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rax
mov    0x0(%r13,%rax,8),%rdx
lea    0xcc9(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
jmp    13b9 <parse_args+0x249>
cmp    $0x76,%eax
jne    13b9 <parse_args+0x249>
xor    %eax,%eax
call   1030 <print_version@plt>
mov    0x2c29(%rip),%rax
mov    (%rax),%edi
call   1090 <exit@plt>
mov    0x2c33(%rip),%rax
mov    (%rax),%edi
lea    0xc81(%rip),%rsi
mov    $0x73,%edx
jmp    13b2 <parse_args+0x242>
mov    0x2c1c(%rip),%rax
mov    (%rax),%edi
lea    0xc6a(%rip),%rsi
mov    $0x63,%edx
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    0x10(%rsp),%rdi
call   1070 <usage@plt>
mov    $0xffffffff,%eax
add    $0xa8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x8(%rsp),%rcx
mov    %rax,(%rcx)
xor    %eax,%eax
cmpl   $0x0,(%r15)
jne    13c8 <parse_args+0x258>
mov    0x2bef(%rip),%rcx
mov    (%rcx),%ecx
mov    %ecx,(%r15)
jmp    13c8 <parse_args+0x258>

LLVM IR (-O0):
%struct.option = type { i8*, i32, i32*, i8 }
@.str = [8 x i8] c"version\00"
@.str.1 = [6 x i8] c"count\00"
@.str.2 = [4 x i8] c"sig\00"
@.str.3 = [5 x i8] c"c:s:\00"
@optarg = global i32 0
@stderr = global i32 0
@.str.4 = [21 x i8] c"Provided '%c' twice\0A\00"
@EXIT_SUCCESS = global i32 0
@optind = global i64 0
@LONG_MAX = global i64 0
@errno = global i64 0
@ERANGE = global i64 0
@.str.5 = [22 x i8] c"Couldn't use PID: %s\0A\00"
@SIGTERM = global i32 0
define i32 @parse_args(i32 %0, i8** %1, i64* %2, i32* %3, i8** %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8**
%9 = alloca i64*
%10 = alloca i32*
%11 = alloca i8**
%12 = alloca i32
%13 = alloca i32
%14 = alloca [4 x %struct.option]
%15 = alloca i8*
%16 = alloca i8*
%17 = alloca i64
store i32 %0, i32* %7
store i8** %1, i8*** %8
store i64* %2, i64** %9
store i32* %3, i32** %10
store i8** %4, i8*** %11
%18 = getelementptr inbounds [4 x %struct.option], [4 x %struct.option]* %14, i64 0, i64 0
%19 = getelementptr inbounds %struct.option, %struct.option* %18, i32 0, i32 0
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8** %19
%20 = getelementptr inbounds %struct.option, %struct.option* %18, i32 0, i32 1
store i32 0, i32* %20
%21 = getelementptr inbounds %struct.option, %struct.option* %18, i32 0, i32 2
store i32* %12, i32** %21
%22 = getelementptr inbounds %struct.option, %struct.option* %18, i32 0, i32 3
store i8 118, i8* %22
%23 = getelementptr inbounds %struct.option, %struct.option* %18, i64 1
%24 = getelementptr inbounds %struct.option, %struct.option* %23, i32 0, i32 0
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8** %24
%25 = getelementptr inbounds %struct.option, %struct.option* %23, i32 0, i32 1
store i32 1, i32* %25
%26 = getelementptr inbounds %struct.option, %struct.option* %23, i32 0, i32 2
store i32* %12, i32** %26
%27 = getelementptr inbounds %struct.option, %struct.option* %23, i32 0, i32 3
store i8 99, i8* %27
%28 = getelementptr inbounds %struct.option, %struct.option* %23, i64 1
%29 = getelementptr inbounds %struct.option, %struct.option* %28, i32 0, i32 0
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8** %29
%30 = getelementptr inbounds %struct.option, %struct.option* %28, i32 0, i32 1
store i32 1, i32* %30
%31 = getelementptr inbounds %struct.option, %struct.option* %28, i32 0, i32 2
store i32* %12, i32** %31
%32 = getelementptr inbounds %struct.option, %struct.option* %28, i32 0, i32 3
store i8 115, i8* %32
%33 = getelementptr inbounds %struct.option, %struct.option* %28, i64 1
%34 = bitcast %struct.option* %33 to i8*
%35 = load i8**, i8*** %8
%36 = load i8*, i8** %35
store i8* %36, i8** %15
%37 = load i32*, i32** %10
store i32 0, i32* %37
%38 = load i8**, i8*** %11
store i8* null, i8** %38
br label %39
39: ; preds = %87, %5
%40 = load i32, i32* %7
%41 = load i8**, i8*** %8
%42 = getelementptr inbounds [4 x %struct.option], [4 x %struct.option]* %14, i64 0, i64 0
%43 = call i32 @getopt_long(i32 %40, i8** %41, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), %struct.option* %42, i32* null)
store i32 %43, i32* %13
%44 = icmp sge i32 %43, 0
br i1 %44, label %45, label %88
45: ; preds = %39
%46 = load i32, i32* %13
switch i32 %46, label %86 [
i32 99, label %47
i32 115, label %47
i32 0, label %49
]
47: ; preds = %45, %45
%48 = load i32, i32* %13
store i32 %48, i32* %12
br label %49
49: ; preds = %45, %47
%50 = load i32, i32* %12
switch i32 %50, label %84 [
i32 99, label %51
i32 115, label %65
i32 118, label %80
]
51: ; preds = %49
br label %52
52: ; preds = %51
%53 = load i8**, i8*** %11
%54 = load i8*, i8** %53
%55 = icmp ne i8* %54, null
br i1 %55, label %60, label %56
56: ; preds = %52
%57 = load i32, i32* @optarg
%58 = call i8* @atoi(i32 %57)
%59 = load i8**, i8*** %11
store i8* %58, i8** %59
br label %63
60: ; preds = %52
%61 = load i32, i32* @stderr
%62 = call i32 (i32, i8*, ...) @fprintf(i32 %61, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i32 99)
br label %149
63: ; preds = %56
br label %64
64: ; preds = %63
br label %85
65: ; preds = %49
br label %66
66: ; preds = %65
%67 = load i32*, i32** %10
%68 = load i32, i32* %67
%69 = icmp ne i32 %68, 0
br i1 %69, label %75, label %70
70: ; preds = %66
%71 = load i32, i32* @optarg
%72 = call i8* @atoi(i32 %71)
%73 = ptrtoint i8* %72 to i32
%74 = load i32*, i32** %10
store i32 %73, i32* %74
br label %78
75: ; preds = %66
%76 = load i32, i32* @stderr
%77 = call i32 (i32, i8*, ...) @fprintf(i32 %76, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i32 115)
br label %149
78: ; preds = %70
br label %79
79: ; preds = %78
br label %85
80: ; preds = %49
%81 = call i32 (...) @print_version()
%82 = load i32, i32* @EXIT_SUCCESS
%83 = call i32 @exit(i32 %82)
unreachable
84: ; preds = %49
br label %149
85: ; preds = %79, %64
br label %87
86: ; preds = %45
br label %149
87: ; preds = %85
br label %39
88: ; preds = %39
%89 = load i8**, i8*** %8
%90 = load i64, i64* @optind
%91 = getelementptr inbounds i8*, i8** %89, i64 %90
%92 = load i8*, i8** %91
%93 = icmp eq i8* %92, null
br i1 %93, label %101, label %94
94: ; preds = %88
%95 = load i8**, i8*** %8
%96 = load i64, i64* @optind
%97 = add i64 %96, 1
%98 = getelementptr inbounds i8*, i8** %95, i64 %97
%99 = load i8*, i8** %98
%100 = icmp ne i8* %99, null
br i1 %100, label %101, label %102
101: ; preds = %94, %88
br label %149
102: ; preds = %94
%103 = load i8**, i8*** %8
%104 = load i64, i64* @optind
%105 = getelementptr inbounds i8*, i8** %103, i64 %104
%106 = load i8*, i8** %105
%107 = call i64 @strtol(i8* %106, i8** %16, i32 10)
store i64 %107, i64* %17
%108 = load i64, i64* %17
%109 = icmp sle i64 %108, 0
br i1 %109, label %132, label %110
110: ; preds = %102
%111 = load i64, i64* %17
%112 = load i64, i64* @LONG_MAX
%113 = icmp eq i64 %111, %112
br i1 %113, label %114, label %118
114: ; preds = %110
%115 = load i64, i64* @errno
%116 = load i64, i64* @ERANGE
%117 = icmp eq i64 %115, %116
br i1 %117, label %132, label %118
118: ; preds = %114, %110
%119 = load i8**, i8*** %8
%120 = load i64, i64* @optind
%121 = getelementptr inbounds i8*, i8** %119, i64 %120
%122 = load i8*, i8** %121
%123 = getelementptr inbounds i8, i8* %122, i64 0
%124 = load i8, i8* %123
%125 = sext i8 %124 to i32
%126 = icmp eq i32 %125, 0
br i1 %126, label %132, label %127
127: ; preds = %118
%128 = load i8*, i8** %16
%129 = load i8, i8* %128
%130 = sext i8 %129 to i32
%131 = icmp ne i32 %130, 0
br i1 %131, label %132, label %139
132: ; preds = %127, %118, %114, %102
%133 = load i32, i32* @stderr
%134 = load i8**, i8*** %8
%135 = load i64, i64* @optind
%136 = getelementptr inbounds i8*, i8** %134, i64 %135
%137 = load i8*, i8** %136
%138 = call i32 (i32, i8*, ...) @fprintf(i32 %133, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0), i8* %137)
br label %149
139: ; preds = %127
%140 = load i64, i64* %17
%141 = load i64*, i64** %9
store i64 %140, i64* %141
%142 = load i32*, i32** %10
%143 = load i32, i32* %142
%144 = icmp eq i32 %143, 0
br i1 %144, label %145, label %148
145: ; preds = %139
%146 = load i32, i32* @SIGTERM
%147 = load i32*, i32** %10
store i32 %146, i32* %147
br label %148
148: ; preds = %145, %139
store i32 0, i32* %6
br label %152
149: ; preds = %132, %101, %86, %84, %75, %60
%150 = load i8*, i8** %15
%151 = call i32 @usage(i8* %150)
store i32 -1, i32* %6
br label %152
152: ; preds = %149, %148
%153 = load i32, i32* %6
ret i32 %153
}

LLVM IR (-O2):
%struct.option = type { i8*, i32, i32*, i8 }
@.str = [8 x i8] c"version\00"
@.str.1 = [6 x i8] c"count\00"
@.str.2 = [4 x i8] c"sig\00"
@.str.3 = [5 x i8] c"c:s:\00"
@optarg = global i32 0
@stderr = global i32 0
@.str.4 = [21 x i8] c"Provided '%c' twice\0A\00"
@EXIT_SUCCESS = global i32 0
@optind = global i64 0
@LONG_MAX = global i64 0
@errno = global i64 0
@ERANGE = global i64 0
@.str.5 = [22 x i8] c"Couldn't use PID: %s\0A\00"
@SIGTERM = global i32 0
define i32 @parse_args(i32 %0, i8** %1, i64* nocapture writeonly %2, i32* nocapture %3, i8** nocapture %4) {
%6 = alloca i32
%7 = alloca [4 x %struct.option]
%8 = alloca i8*
%9 = bitcast i32* %6 to i8*
%10 = bitcast [4 x %struct.option]* %7 to i8*
%11 = getelementptr inbounds [4 x %struct.option], [4 x %struct.option]* %7, i64 0, i64 0
%12 = getelementptr inbounds [4 x %struct.option], [4 x %struct.option]* %7, i64 0, i64 0, i32 0
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8** %12
%13 = getelementptr inbounds [4 x %struct.option], [4 x %struct.option]* %7, i64 0, i64 0, i32 1
store i32 0, i32* %13
%14 = getelementptr inbounds [4 x %struct.option], [4 x %struct.option]* %7, i64 0, i64 0, i32 2
store i32* %6, i32** %14
%15 = getelementptr inbounds [4 x %struct.option], [4 x %struct.option]* %7, i64 0, i64 0, i32 3
store i8 118, i8* %15
%16 = getelementptr inbounds [4 x %struct.option], [4 x %struct.option]* %7, i64 0, i64 1, i32 0
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8** %16
%17 = getelementptr inbounds [4 x %struct.option], [4 x %struct.option]* %7, i64 0, i64 1, i32 1
store i32 1, i32* %17
%18 = getelementptr inbounds [4 x %struct.option], [4 x %struct.option]* %7, i64 0, i64 1, i32 2
store i32* %6, i32** %18
%19 = getelementptr inbounds [4 x %struct.option], [4 x %struct.option]* %7, i64 0, i64 1, i32 3
store i8 99, i8* %19
%20 = getelementptr inbounds [4 x %struct.option], [4 x %struct.option]* %7, i64 0, i64 2, i32 0
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8** %20
%21 = getelementptr inbounds [4 x %struct.option], [4 x %struct.option]* %7, i64 0, i64 2, i32 1
store i32 1, i32* %21
%22 = getelementptr inbounds [4 x %struct.option], [4 x %struct.option]* %7, i64 0, i64 2, i32 2
store i32* %6, i32** %22
%23 = getelementptr inbounds [4 x %struct.option], [4 x %struct.option]* %7, i64 0, i64 2, i32 3
store i8 115, i8* %23
%24 = getelementptr inbounds [4 x %struct.option], [4 x %struct.option]* %7, i64 0, i64 3
%25 = bitcast %struct.option* %24 to i8*
%26 = load i8*, i8** %1
%27 = bitcast i8** %8 to i8*
store i32 0, i32* %3
store i8* null, i8** %4
%28 = call i32 @getopt_long(i32 %0, i8** %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), %struct.option* %11, i32* null)
%29 = icmp sgt i32 %28, -1
br i1 %29, label %30, label %64
30: ; preds = %5, %61
%31 = phi i32 [ %62, %61 ], [ %28, %5 ]
switch i32 %31, label %105 [
i32 99, label %32
i32 115, label %32
i32 0, label %33
]
32: ; preds = %30, %30
store i32 %31, i32* %6
br label %35
33: ; preds = %30
%34 = load i32, i32* %6
br label %35
35: ; preds = %33, %32
%36 = phi i32 [ %34, %33 ], [ %31, %32 ]
switch i32 %36, label %105 [
i32 99, label %37
i32 115, label %46
i32 118, label %57
]
37: ; preds = %35
%38 = load i8*, i8** %4
%39 = icmp eq i8* %38, null
br i1 %39, label %40, label %43
40: ; preds = %37
%41 = load i32, i32* @optarg
%42 = call i8* @atoi(i32 %41)
store i8* %42, i8** %4
br label %61
43: ; preds = %37
%44 = load i32, i32* @stderr
%45 = call i32 (i32, i8*, ...) @fprintf(i32 %44, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i32 99)
br label %105
46: ; preds = %35
%47 = load i32, i32* %3
%48 = icmp eq i32 %47, 0
br i1 %48, label %49, label %54
49: ; preds = %46
%50 = load i32, i32* @optarg
%51 = call i8* @atoi(i32 %50)
%52 = ptrtoint i8* %51 to i64
%53 = trunc i64 %52 to i32
store i32 %53, i32* %3
br label %61
54: ; preds = %46
%55 = load i32, i32* @stderr
%56 = call i32 (i32, i8*, ...) @fprintf(i32 %55, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i32 115)
br label %105
57: ; preds = %35
%58 = call i32 (...) @print_version()
%59 = load i32, i32* @EXIT_SUCCESS
%60 = call i32 @exit(i32 %59)
unreachable
61: ; preds = %40, %49
%62 = call i32 @getopt_long(i32 %0, i8** %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), %struct.option* %11, i32* null)
%63 = icmp sgt i32 %62, -1
br i1 %63, label %30, label %64
64: ; preds = %61, %5
%65 = load i64, i64* @optind
%66 = getelementptr inbounds i8*, i8** %1, i64 %65
%67 = load i8*, i8** %66
%68 = icmp eq i8* %67, null
br i1 %68, label %105, label %69
69: ; preds = %64
%70 = add i64 %65, 1
%71 = getelementptr inbounds i8*, i8** %1, i64 %70
%72 = load i8*, i8** %71
%73 = icmp eq i8* %72, null
br i1 %73, label %74, label %105
74: ; preds = %69
%75 = call i64 @strtol(i8* %67, i8** %8, i32 10)
%76 = icmp slt i64 %75, 1
br i1 %76, label %94, label %77
77: ; preds = %74
%78 = load i64, i64* @LONG_MAX
%79 = icmp eq i64 %75, %78
br i1 %79, label %80, label %84
80: ; preds = %77
%81 = load i64, i64* @errno
%82 = load i64, i64* @ERANGE
%83 = icmp eq i64 %81, %82
br i1 %83, label %94, label %84
84: ; preds = %80, %77
%85 = load i64, i64* @optind
%86 = getelementptr inbounds i8*, i8** %1, i64 %85
%87 = load i8*, i8** %86
%88 = load i8, i8* %87
%89 = icmp eq i8 %88, 0
br i1 %89, label %94, label %90
90: ; preds = %84
%91 = load i8*, i8** %8
%92 = load i8, i8* %91
%93 = icmp eq i8 %92, 0
br i1 %93, label %100, label %94
94: ; preds = %90, %84, %80, %74
%95 = load i32, i32* @stderr
%96 = load i64, i64* @optind
%97 = getelementptr inbounds i8*, i8** %1, i64 %96
%98 = load i8*, i8** %97
%99 = call i32 (i32, i8*, ...) @fprintf(i32 %95, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0), i8* %98)
br label %105
100: ; preds = %90
store i64 %75, i64* %2
%101 = load i32, i32* %3
%102 = icmp eq i32 %101, 0
br i1 %102, label %103, label %107
103: ; preds = %100
%104 = load i32, i32* @SIGTERM
store i32 %104, i32* %3
br label %107
105: ; preds = %30, %35, %64, %69, %94, %54, %43
%106 = call i32 @usage(i8* %26)
br label %107
107: ; preds = %100, %103, %105
%108 = phi i32 [ -1, %105 ], [ 0, %103 ], [ 0, %100 ]
ret i32 %108
}