#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 */
scalar_t__ ERANGE;
long EXIT_FAILURE;
int EXIT_SUCCESS;
long LONG_MAX;
long LONG_MIN;
scalar_t__ errno;
int getopt(int, char **, char *);
int /*<<< orphan*/ log_xxx(int /*<<< orphan*/, int, char *, char *, char *,
                           ...);
int /*<<< orphan*/ myexit(char *, long);
char *optarg;
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
void *strtol(char *, char **, int);
int main(int argc, char *argv[], char *envp[]) {
  int i = 0, o = 0, d = 0, r = 4;
  long e = EXIT_SUCCESS;
  char *n = argv[0], *endptr, **en;
  while ((o = getopt(argc, argv, "e:r:n:d")) != -1) {
    errno = 0;
    switch (o) {
    case 'd':
      d = 1;
      break;
    case 'e':
      e = strtol(optarg, &endptr, 10);
      if ((errno == ERANGE && (e == LONG_MAX || e == LONG_MIN)) ||
          (errno != 0 && e == 0) || (endptr == optarg)) {
        log_xxx(stderr, 1, " [error] ", n, "e arg: invalid number\n");
        myexit(n, EXIT_FAILURE);
      }
      break;
    case 'n':
      n = optarg;
      break;
    case 'r':
      r = strtol(optarg, &endptr, 10);
      if ((errno == ERANGE && (r == LONG_MAX || r == LONG_MIN)) ||
          (errno != 0 && e == 0) || (endptr == optarg)) {
        log_xxx(stderr, 1, " [error] ", n, "r arg: invalid number\n");
        myexit(n, EXIT_FAILURE);
      }
      break;
    default:
      log_xxx(stderr, 1, " [error] ", n,
              "Usage: %s [-e exit val] [-r secs] [args...]\n", argv[0]);
      myexit(n, EXIT_FAILURE);
    }
  }
  log_xxx(stdout, 1, " [info] ", n, "command line was: ");
  for (i = 0; i < argc; i++) {
    log_xxx(stdout, 0, "", "", "%s ", argv[i]);
  }
  log_xxx(stdout, 0, "", "", "\n");
  if (d) {
    log_xxx(stdout, 1, " [debug] ", n, "env contains:\n");
    for (en = envp; *en != 0; en++) {
      log_xxx(stdout, 1, " [debug] ", n, "%s\n", *en);
    }
  }
  for (i = 0; i < r; i++) {
    log_xxx(stdout, 1, " [info] ", n, "progress %3d%%\n",
            (int)((float)i / r * 100.0));
    if (d) {
      log_xxx(stdout, 1, " [debug] ", n, "sleeping...\n");
    }
    sleep(1);
  }
  log_xxx(stdout, 1, " [info] ", n, "progress %3d%%\n", 100);
  myexit(n, e);
  return (EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
movl   $0x4,-0x28(%rbp)
mov    0x2e13(%rip),%rax
movslq (%rax),%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x38(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe97(%rip),%rdx
call   1060 <getopt@plt>
mov    %eax,-0x20(%rbp)
cmp    $0xffffffff,%eax
je     13f3 <main+0x2a3>
mov    0x2df3(%rip),%rax
movq   $0x0,(%rax)
mov    -0x20(%rbp),%eax
add    $0xffffff9c,%eax
mov    %eax,%ecx
mov    %rcx,-0x50(%rbp)
sub    $0xe,%eax
ja     13ad <main+0x25d>
mov    -0x50(%rbp),%rax
lea    0xe1c(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x1,-0x24(%rbp)
jmp    13ee <main+0x29e>
mov    0x2df0(%rip),%rax
mov    (%rax),%rdi
lea    -0x40(%rbp),%rsi
mov    $0xa,%edx
call   1040 <strtol@plt>
mov    %rax,-0x30(%rbp)
mov    0x2d94(%rip),%rax
mov    (%rax),%rax
mov    0x2daa(%rip),%rcx
cmp    (%rcx),%rax
jne    125f <main+0x10f>
mov    -0x30(%rbp),%rax
mov    0x2d7e(%rip),%rcx
cmp    (%rcx),%rax
je     128f <main+0x13f>
mov    -0x30(%rbp),%rax
mov    0x2d8a(%rip),%rcx
cmp    (%rcx),%rax
je     128f <main+0x13f>
mov    0x2d52(%rip),%rax
cmpq   $0x0,(%rax)
je     127b <main+0x12b>
cmpq   $0x0,-0x30(%rbp)
je     128f <main+0x13f>
mov    -0x40(%rbp),%rax
mov    0x2d72(%rip),%rcx
cmp    (%rcx),%rax
jne    12c9 <main+0x179>
mov    0x2d32(%rip),%rax
mov    (%rax),%edi
mov    -0x38(%rbp),%rcx
mov    $0x1,%esi
lea    0xda4(%rip),%rdx
lea    0xda7(%rip),%r8
mov    $0x0,%al
call   1050 <log_xxx@plt>
mov    -0x38(%rbp),%rdi
mov    0x2cef(%rip),%rax
mov    (%rax),%rsi
call   1030 <myexit@plt>
jmp    13ee <main+0x29e>
mov    0x2d23(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x38(%rbp)
jmp    13ee <main+0x29e>
mov    0x2d10(%rip),%rax
mov    (%rax),%rdi
lea    -0x40(%rbp),%rsi
mov    $0xa,%edx
call   1040 <strtol@plt>
mov    %eax,-0x28(%rbp)
mov    0x2cb5(%rip),%rax
mov    (%rax),%rax
mov    0x2ccb(%rip),%rcx
cmp    (%rcx),%rax
jne    133e <main+0x1ee>
movslq -0x28(%rbp),%rax
mov    0x2c9f(%rip),%rcx
cmp    (%rcx),%rax
je     136e <main+0x21e>
movslq -0x28(%rbp),%rax
mov    0x2cab(%rip),%rcx
cmp    (%rcx),%rax
je     136e <main+0x21e>
mov    0x2c73(%rip),%rax
cmpq   $0x0,(%rax)
je     135a <main+0x20a>
cmpq   $0x0,-0x30(%rbp)
je     136e <main+0x21e>
mov    -0x40(%rbp),%rax
mov    0x2c93(%rip),%rcx
cmp    (%rcx),%rax
jne    13a8 <main+0x258>
mov    0x2c53(%rip),%rax
mov    (%rax),%edi
mov    -0x38(%rbp),%rcx
mov    $0x1,%esi
lea    0xcc5(%rip),%rdx
lea    0xcdf(%rip),%r8
mov    $0x0,%al
call   1050 <log_xxx@plt>
mov    -0x38(%rbp),%rdi
mov    0x2c10(%rip),%rax
mov    (%rax),%rsi
call   1030 <myexit@plt>
jmp    13ee <main+0x29e>
mov    0x2c14(%rip),%rax
mov    (%rax),%edi
mov    -0x38(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    (%rax),%r9
mov    $0x1,%esi
lea    0xc7f(%rip),%rdx
lea    0xcb0(%rip),%r8
mov    $0x0,%al
call   1050 <log_xxx@plt>
mov    -0x38(%rbp),%rdi
mov    0x2bca(%rip),%rax
mov    (%rax),%rsi
call   1030 <myexit@plt>
jmp    119f <main+0x4f>
mov    0x2bae(%rip),%rax
mov    (%rax),%edi
mov    -0x38(%rbp),%rcx
mov    $0x1,%esi
lea    0xca5(%rip),%rdx
lea    0xca7(%rip),%r8
mov    $0x0,%al
call   1050 <log_xxx@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    146a <main+0x31a>
mov    0x2b74(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%r9
xor    %esi,%esi
lea    0xcb2(%rip),%rcx
lea    0xc7b(%rip),%r8
mov    %rcx,%rdx
mov    $0x0,%al
call   1050 <log_xxx@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1421 <main+0x2d1>
mov    0x2b37(%rip),%rax
mov    (%rax),%edi
xor    %esi,%esi
lea    0xc81(%rip),%rcx
lea    0xc79(%rip),%r8
mov    %rcx,%rdx
mov    $0x0,%al
call   1050 <log_xxx@plt>
cmpl   $0x0,-0x24(%rbp)
je     1518 <main+0x3c8>
mov    0x2b0a(%rip),%rax
mov    (%rax),%edi
mov    -0x38(%rbp),%rcx
mov    $0x1,%esi
lea    0xc21(%rip),%rdx
lea    0xc24(%rip),%r8
mov    $0x0,%al
call   1050 <log_xxx@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rax
cmpq   $0x0,(%rax)
je     1513 <main+0x3c3>
mov    0x2acd(%rip),%rax
mov    (%rax),%edi
mov    -0x38(%rbp),%rcx
mov    -0x48(%rbp),%rax
mov    (%rax),%r9
mov    $0x1,%esi
lea    0xbdd(%rip),%rdx
lea    0xbef(%rip),%r8
mov    $0x0,%al
call   1050 <log_xxx@plt>
mov    -0x48(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x48(%rbp)
jmp    14c6 <main+0x376>
jmp    1518 <main+0x3c8>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x28(%rbp),%eax
jge    15be <main+0x46e>
mov    0x2a76(%rip),%rax
mov    (%rax),%edi
mov    -0x38(%rbp),%rcx
cvtsi2ssl -0x1c(%rbp),%xmm0
cvtsi2ssl -0x28(%rbp),%xmm1
divss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xaae(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%r9d
mov    $0x1,%esi
lea    0xb4a(%rip),%rdx
lea    0xb80(%rip),%r8
mov    $0x0,%al
call   1050 <log_xxx@plt>
cmpl   $0x0,-0x24(%rbp)
je     15a6 <main+0x456>
mov    0x2a22(%rip),%rax
mov    (%rax),%edi
mov    -0x38(%rbp),%rcx
mov    $0x1,%esi
lea    0xb39(%rip),%rdx
lea    0xb5f(%rip),%r8
mov    $0x0,%al
call   1050 <log_xxx@plt>
mov    $0x1,%edi
call   1070 <sleep@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    151f <main+0x3cf>
mov    0x29e3(%rip),%rax
mov    (%rax),%edi
mov    -0x38(%rbp),%rcx
mov    $0x1,%esi
lea    0xada(%rip),%rdx
lea    0xb10(%rip),%r8
mov    $0x64,%r9d
mov    $0x0,%al
call   1050 <log_xxx@plt>
mov    -0x38(%rbp),%rdi
mov    -0x30(%rbp),%rsi
call   1030 <myexit@plt>
mov    0x29a1(%rip),%rax
mov    (%rax),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rdx,%rbx
mov    %edi,%r14d
mov    0x2e35(%rip),%rax
movslq (%rax),%rax
mov    %rax,0x8(%rsp)
mov    (%rsi),%r12
lea    0xec7(%rip),%rdx
mov    %rsi,%r13
call   1060 <getopt@plt>
cmp    $0xffffffff,%eax
je     1380 <main+0x230>
mov    $0x4,%ecx
mov    %rcx,(%rsp)
xor    %ebp,%ebp
jmp    11fc <main+0xac>
nopl   0x0(%rax,%rax,1)
mov    0x2e21(%rip),%rax
mov    (%rax),%edi
mov    (%rsi),%r9
mov    $0x1,%esi
lea    0xe94(%rip),%rdx
mov    %r12,%rcx
lea    0xec2(%rip),%r8
xor    %eax,%eax
call   1050 <log_xxx@plt>
mov    0x2de0(%rip),%rax
mov    (%rax),%rsi
mov    %r12,%rdi
call   1030 <myexit@plt>
mov    %r13,%rsi
mov    %ebp,%r15d
mov    %r14d,%edi
lea    0xe59(%rip),%rdx
call   1060 <getopt@plt>
mov    %r15d,%ebp
cmp    $0xffffffff,%eax
je     138c <main+0x23c>
mov    0x2db5(%rip),%rcx
movq   $0x0,(%rcx)
add    $0xffffff9c,%eax
cmp    $0xe,%eax
mov    %r13,%rsi
ja     11a0 <main+0x50>
lea    0xdec(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
mov    $0x1,%r15d
jmp    *%rax
mov    0x2dc6(%rip),%rax
mov    (%rax),%rdi
lea    0x10(%rsp),%rsi
mov    $0xa,%edx
call   1040 <strtol@plt>
mov    0x2d6d(%rip),%rcx
mov    (%rcx),%rcx
mov    0x2d83(%rip),%rdx
cmp    (%rdx),%rcx
mov    %rax,0x8(%rsp)
jne    1277 <main+0x127>
mov    0x2d5a(%rip),%rdx
cmp    %rax,(%rdx)
je     1296 <main+0x146>
mov    0x2d6e(%rip),%rdx
cmp    %rax,(%rdx)
je     1296 <main+0x146>
test   %rcx,%rcx
je     1281 <main+0x131>
test   %rax,%rax
je     1296 <main+0x146>
mov    0x10(%rsp),%rcx
mov    0x2d6b(%rip),%rdx
cmp    (%rdx),%rcx
jne    1375 <main+0x225>
mov    0x2d2b(%rip),%rax
mov    (%rax),%edi
mov    $0x1,%esi
lea    0xda1(%rip),%rdx
mov    %r12,%rcx
lea    0xda1(%rip),%r8
jmp    135c <main+0x20c>
nopw   0x0(%rax,%rax,1)
mov    0x2d31(%rip),%rax
mov    (%rax),%r12
jmp    11de <main+0x8e>
nop
mov    0x2d21(%rip),%rax
mov    (%rax),%rdi
lea    0x10(%rsp),%rsi
mov    $0xa,%edx
call   1040 <strtol@plt>
mov    %rax,(%rsp)
mov    0x2cc4(%rip),%rax
mov    (%rax),%rax
mov    0x2cda(%rip),%rcx
cmp    (%rcx),%rax
jne    131f <main+0x1cf>
movslq (%rsp),%rcx
mov    0x2cb2(%rip),%rdx
cmp    (%rdx),%rcx
je     133d <main+0x1ed>
mov    0x2cc6(%rip),%rdx
cmp    (%rdx),%rcx
je     133d <main+0x1ed>
test   %rax,%rax
je     132c <main+0x1dc>
cmpq   $0x0,0x8(%rsp)
je     133d <main+0x1ed>
mov    0x10(%rsp),%rax
mov    0x2cc0(%rip),%rcx
cmp    (%rcx),%rax
jne    1375 <main+0x225>
mov    0x2c84(%rip),%rax
mov    (%rax),%edi
mov    $0x1,%esi
lea    0xcfa(%rip),%rdx
mov    %r12,%rcx
lea    0xd11(%rip),%r8
xor    %eax,%eax
call   1050 <log_xxx@plt>
mov    0x2c46(%rip),%rax
mov    (%rax),%rsi
mov    %r12,%rdi
call   1030 <myexit@plt>
mov    %ebp,%r15d
mov    %r13,%rsi
jmp    11e1 <main+0x91>
mov    $0x4,%eax
mov    %rax,(%rsp)
xor    %r15d,%r15d
mov    0x2c15(%rip),%rax
mov    (%rax),%edi
lea    0xd15(%rip),%rdx
lea    0xd17(%rip),%r8
mov    $0x1,%esi
mov    %r12,0x20(%rsp)
mov    %r12,%rcx
xor    %eax,%eax
call   1050 <log_xxx@plt>
test   %r14d,%r14d
jle    13fc <main+0x2ac>
mov    %r14d,%eax
mov    %r13,%r14
mov    %eax,%r12d
lea    0xd31(%rip),%rbp
xor    %r13d,%r13d
nop
mov    0x2bd1(%rip),%rax
mov    (%rax),%edi
mov    (%r14,%r13,8),%r9
xor    %esi,%esi
mov    %rbp,%rdx
mov    %rbp,%rcx
lea    0xce1(%rip),%r8
xor    %eax,%eax
call   1050 <log_xxx@plt>
add    $0x1,%r13
cmp    %r13,%r12
jne    13d0 <main+0x280>
mov    0x2ba5(%rip),%r13
mov    0x0(%r13),%edi
lea    0xcef(%rip),%rcx
lea    0xce7(%rip),%r8
xor    %esi,%esi
mov    %rcx,%rdx
xor    %eax,%eax
call   1050 <log_xxx@plt>
test   %r15d,%r15d
mov    0x20(%rsp),%rbp
je     1495 <main+0x345>
mov    0x0(%r13),%edi
lea    0xc9b(%rip),%rdx
lea    0xc9e(%rip),%r8
mov    $0x1,%esi
mov    %rbp,%rcx
xor    %eax,%eax
call   1050 <log_xxx@plt>
mov    (%rbx),%r9
test   %r9,%r9
je     1495 <main+0x345>
add    $0x8,%rbx
lea    0xc72(%rip),%r14
lea    0xc84(%rip),%r12
cs nopw 0x0(%rax,%rax,1)
mov    0x0(%r13),%edi
mov    $0x1,%esi
mov    %r14,%rdx
mov    %rbp,%rcx
mov    %r12,%r8
xor    %eax,%eax
call   1050 <log_xxx@plt>
mov    (%rbx),%r9
add    $0x8,%rbx
test   %r9,%r9
jne    1470 <main+0x320>
mov    (%rsp),%rbx
test   %ebx,%ebx
jle    153e <main+0x3ee>
cvtsi2ss %ebx,%xmm0
movss  %xmm0,0x1c(%rsp)
lea    0xc3c(%rip),%r13
xor    %r14d,%r14d
jmp    14d3 <main+0x383>
nopw   0x0(%rax,%rax,1)
mov    $0x1,%edi
call   1070 <sleep@plt>
add    $0x1,%r14d
cmp    %r14d,%ebx
je     153e <main+0x3ee>
mov    0x2ace(%rip),%r12
mov    (%r12),%edi
xorps  %xmm0,%xmm0
cvtsi2ss %r14d,%xmm0
divss  0x1c(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  0xb08(%rip),%xmm0
cvttsd2si %xmm0,%r9d
mov    $0x1,%esi
lea    0xba8(%rip),%rdx
mov    %rbp,%rcx
mov    %r13,%r8
xor    %eax,%eax
call   1050 <log_xxx@plt>
test   %r15d,%r15d
je     14c0 <main+0x370>
mov    (%r12),%edi
mov    $0x1,%esi
lea    0xba6(%rip),%rdx
mov    %rbp,%rcx
lea    0xbc9(%rip),%r8
xor    %eax,%eax
call   1050 <log_xxx@plt>
jmp    14c0 <main+0x370>
mov    0x2a63(%rip),%rax
mov    (%rax),%edi
lea    0xb63(%rip),%rdx
lea    0xb99(%rip),%r8
mov    $0x1,%esi
mov    %rbp,%rcx
mov    $0x64,%r9d
xor    %eax,%eax
call   1050 <log_xxx@plt>
mov    %rbp,%rdi
mov    0x8(%rsp),%rsi
call   1030 <myexit@plt>
mov    0x2a22(%rip),%rax
mov    (%rax),%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@EXIT_SUCCESS = global i32 0
@.str = [8 x i8] c"e:r:n:d\00"
@errno = global i64 0
@optarg = global i8* null
@ERANGE = global i64 0
@LONG_MAX = global i64 0
@LONG_MIN = global i64 0
@stderr = global i32 0
@.str.1 = [10 x i8] c" [error] \00"
@.str.2 = [23 x i8] c"e arg: invalid number\0A\00"
@EXIT_FAILURE = global i64 0
@.str.3 = [23 x i8] c"r arg: invalid number\0A\00"
@.str.4 = [45 x i8] c"Usage: %s [-e exit val] [-r secs] [args...]\0A\00"
@stdout = global i32 0
@.str.5 = [9 x i8] c" [info] \00"
@.str.6 = [19 x i8] c"command line was: \00"
@.str.7 = [1 x i8] zeroinitializer
@.str.8 = [4 x i8] c"%s \00"
@.str.9 = [2 x i8] c"\0A\00"
@.str.10 = [10 x i8] c" [debug] \00"
@.str.11 = [15 x i8] c"env contains:\0A\00"
@.str.12 = [4 x i8] c"%s\0A\00"
@.str.13 = [16 x i8] c"progress %3d%%\0A\00"
@.str.14 = [13 x i8] c"sleeping...\0A\00"
define i32 @main(i32 %0, i8** %1, i8** %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8**
%7 = alloca i8**
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i64
%13 = alloca i8*
%14 = alloca i8*
%15 = alloca i8**
store i32 0, i32* %4
store i32 %0, i32* %5
store i8** %1, i8*** %6
store i8** %2, i8*** %7
store i32 0, i32* %8
store i32 0, i32* %9
store i32 0, i32* %10
store i32 4, i32* %11
%16 = load i32, i32* @EXIT_SUCCESS
%17 = sext i32 %16 to i64
store i64 %17, i64* %12
%18 = load i8**, i8*** %6
%19 = getelementptr inbounds i8*, i8** %18, i64 0
%20 = load i8*, i8** %19
store i8* %20, i8** %13
br label %21
21: ; preds = %109, %3
%22 = load i32, i32* %5
%23 = load i8**, i8*** %6
%24 = call i32 @getopt(i32 %22, i8** %23, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
store i32 %24, i32* %9
%25 = icmp ne i32 %24, -1
br i1 %25, label %26, label %110
26: ; preds = %21
store i64 0, i64* @errno
%27 = load i32, i32* %9
switch i32 %27, label %99 [
i32 100, label %28
i32 101, label %29
i32 110, label %62
i32 114, label %64
]
28: ; preds = %26
store i32 1, i32* %10
br label %109
29: ; preds = %26
%30 = load i8*, i8** @optarg
%31 = call i8* @strtol(i8* %30, i8** %14, i32 10)
%32 = ptrtoint i8* %31 to i64
store i64 %32, i64* %12
%33 = load i64, i64* @errno
%34 = load i64, i64* @ERANGE
%35 = icmp eq i64 %33, %34
br i1 %35, label %36, label %44
36: ; preds = %29
%37 = load i64, i64* %12
%38 = load i64, i64* @LONG_MAX
%39 = icmp eq i64 %37, %38
br i1 %39, label %54, label %40
40: ; preds = %36
%41 = load i64, i64* %12
%42 = load i64, i64* @LONG_MIN
%43 = icmp eq i64 %41, %42
br i1 %43, label %54, label %44
44: ; preds = %40, %29
%45 = load i64, i64* @errno
%46 = icmp ne i64 %45, 0
br i1 %46, label %47, label %50
47: ; preds = %44
%48 = load i64, i64* %12
%49 = icmp eq i64 %48, 0
br i1 %49, label %54, label %50
50: ; preds = %47, %44
%51 = load i8*, i8** %14
%52 = load i8*, i8** @optarg
%53 = icmp eq i8* %51, %52
br i1 %53, label %54, label %61
54: ; preds = %50, %47, %40, %36
%55 = load i32, i32* @stderr
%56 = load i8*, i8** %13
%57 = call i32 (i32, i32, i8*, i8*, i8*, ...) @log_xxx(i32 %55, i32 1, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* %56, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0))
%58 = load i8*, i8** %13
%59 = load i64, i64* @EXIT_FAILURE
%60 = call i32 @myexit(i8* %58, i64 %59)
br label %61
61: ; preds = %54, %50
br label %109
62: ; preds = %26
%63 = load i8*, i8** @optarg
store i8* %63, i8** %13
br label %109
64: ; preds = %26
%65 = load i8*, i8** @optarg
%66 = call i8* @strtol(i8* %65, i8** %14, i32 10)
%67 = ptrtoint i8* %66 to i32
store i32 %67, i32* %11
%68 = load i64, i64* @errno
%69 = load i64, i64* @ERANGE
%70 = icmp eq i64 %68, %69
br i1 %70, label %71, label %81
71: ; preds = %64
%72 = load i32, i32* %11
%73 = sext i32 %72 to i64
%74 = load i64, i64* @LONG_MAX
%75 = icmp eq i64 %73, %74
br i1 %75, label %91, label %76
76: ; preds = %71
%77 = load i32, i32* %11
%78 = sext i32 %77 to i64
%79 = load i64, i64* @LONG_MIN
%80 = icmp eq i64 %78, %79
br i1 %80, label %91, label %81
81: ; preds = %76, %64
%82 = load i64, i64* @errno
%83 = icmp ne i64 %82, 0
br i1 %83, label %84, label %87
84: ; preds = %81
%85 = load i64, i64* %12
%86 = icmp eq i64 %85, 0
br i1 %86, label %91, label %87
87: ; preds = %84, %81
%88 = load i8*, i8** %14
%89 = load i8*, i8** @optarg
%90 = icmp eq i8* %88, %89
br i1 %90, label %91, label %98
91: ; preds = %87, %84, %76, %71
%92 = load i32, i32* @stderr
%93 = load i8*, i8** %13
%94 = call i32 (i32, i32, i8*, i8*, i8*, ...) @log_xxx(i32 %92, i32 1, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* %93, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0))
%95 = load i8*, i8** %13
%96 = load i64, i64* @EXIT_FAILURE
%97 = call i32 @myexit(i8* %95, i64 %96)
br label %98
98: ; preds = %91, %87
br label %109
99: ; preds = %26
%100 = load i32, i32* @stderr
%101 = load i8*, i8** %13
%102 = load i8**, i8*** %6
%103 = getelementptr inbounds i8*, i8** %102, i64 0
%104 = load i8*, i8** %103
%105 = call i32 (i32, i32, i8*, i8*, i8*, ...) @log_xxx(i32 %100, i32 1, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* %101, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.4, i64 0, i64 0), i8* %104)
%106 = load i8*, i8** %13
%107 = load i64, i64* @EXIT_FAILURE
%108 = call i32 @myexit(i8* %106, i64 %107)
br label %109
109: ; preds = %99, %98, %62, %61, %28
br label %21
110: ; preds = %21
%111 = load i32, i32* @stdout
%112 = load i8*, i8** %13
%113 = call i32 (i32, i32, i8*, i8*, i8*, ...) @log_xxx(i32 %111, i32 1, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i8* %112, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0))
store i32 0, i32* %8
br label %114
114: ; preds = %126, %110
%115 = load i32, i32* %8
%116 = load i32, i32* %5
%117 = icmp slt i32 %115, %116
br i1 %117, label %118, label %129
118: ; preds = %114
%119 = load i32, i32* @stdout
%120 = load i8**, i8*** %6
%121 = load i32, i32* %8
%122 = sext i32 %121 to i64
%123 = getelementptr inbounds i8*, i8** %120, i64 %122
%124 = load i8*, i8** %123
%125 = call i32 (i32, i32, i8*, i8*, i8*, ...) @log_xxx(i32 %119, i32 0, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i8* %124)
br label %126
126: ; preds = %118
%127 = load i32, i32* %8
%128 = add nsw i32 %127, 1
store i32 %128, i32* %8
br label %114
129: ; preds = %114
%130 = load i32, i32* @stdout
%131 = call i32 (i32, i32, i8*, i8*, i8*, ...) @log_xxx(i32 %130, i32 0, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
%132 = load i32, i32* %10
%133 = icmp ne i32 %132, 0
br i1 %133, label %134, label %153
134: ; preds = %129
%135 = load i32, i32* @stdout
%136 = load i8*, i8** %13
%137 = call i32 (i32, i32, i8*, i8*, i8*, ...) @log_xxx(i32 %135, i32 1, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0), i8* %136, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.11, i64 0, i64 0))
%138 = load i8**, i8*** %7
store i8** %138, i8*** %15
br label %139
139: ; preds = %149, %134
%140 = load i8**, i8*** %15
%141 = load i8*, i8** %140
%142 = icmp ne i8* %141, null
br i1 %142, label %143, label %152
143: ; preds = %139
%144 = load i32, i32* @stdout
%145 = load i8*, i8** %13
%146 = load i8**, i8*** %15
%147 = load i8*, i8** %146
%148 = call i32 (i32, i32, i8*, i8*, i8*, ...) @log_xxx(i32 %144, i32 1, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0), i8* %145, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.12, i64 0, i64 0), i8* %147)
br label %149
149: ; preds = %143
%150 = load i8**, i8*** %15
%151 = getelementptr inbounds i8*, i8** %150, i32 1
store i8** %151, i8*** %15
br label %139
152: ; preds = %139
br label %153
153: ; preds = %152, %129
store i32 0, i32* %8
br label %154
154: ; preds = %178, %153
%155 = load i32, i32* %8
%156 = load i32, i32* %11
%157 = icmp slt i32 %155, %156
br i1 %157, label %158, label %181
158: ; preds = %154
%159 = load i32, i32* @stdout
%160 = load i8*, i8** %13
%161 = load i32, i32* %8
%162 = sitofp i32 %161 to float
%163 = load i32, i32* %11
%164 = sitofp i32 %163 to float
%165 = fdiv float %162, %164
%166 = fpext float %165 to double
%167 = fmul double %166, 1.000000e+02
%168 = fptosi double %167 to i32
%169 = call i32 (i32, i32, i8*, i8*, i8*, ...) @log_xxx(i32 %159, i32 1, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i8* %160, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.13, i64 0, i64 0), i32 %168)
%170 = load i32, i32* %10
%171 = icmp ne i32 %170, 0
br i1 %171, label %172, label %176
172: ; preds = %158
%173 = load i32, i32* @stdout
%174 = load i8*, i8** %13
%175 = call i32 (i32, i32, i8*, i8*, i8*, ...) @log_xxx(i32 %173, i32 1, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0), i8* %174, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.14, i64 0, i64 0))
br label %176
176: ; preds = %172, %158
%177 = call i32 @sleep(i32 1)
br label %178
178: ; preds = %176
%179 = load i32, i32* %8
%180 = add nsw i32 %179, 1
store i32 %180, i32* %8
br label %154
181: ; preds = %154
%182 = load i32, i32* @stdout
%183 = load i8*, i8** %13
%184 = call i32 (i32, i32, i8*, i8*, i8*, ...) @log_xxx(i32 %182, i32 1, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i8* %183, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.13, i64 0, i64 0), i32 100)
%185 = load i8*, i8** %13
%186 = load i64, i64* %12
%187 = call i32 @myexit(i8* %185, i64 %186)
%188 = load i32, i32* @EXIT_SUCCESS
ret i32 %188
}

LLVM IR (-O2):
@EXIT_SUCCESS = global i32 0
@.str = [8 x i8] c"e:r:n:d\00"
@errno = global i64 0
@optarg = global i8* null
@ERANGE = global i64 0
@LONG_MAX = global i64 0
@LONG_MIN = global i64 0
@stderr = global i32 0
@.str.1 = [10 x i8] c" [error] \00"
@.str.2 = [23 x i8] c"e arg: invalid number\0A\00"
@EXIT_FAILURE = global i64 0
@.str.3 = [23 x i8] c"r arg: invalid number\0A\00"
@.str.4 = [45 x i8] c"Usage: %s [-e exit val] [-r secs] [args...]\0A\00"
@stdout = global i32 0
@.str.5 = [9 x i8] c" [info] \00"
@.str.6 = [19 x i8] c"command line was: \00"
@.str.7 = [1 x i8] zeroinitializer
@.str.8 = [4 x i8] c"%s \00"
@.str.9 = [2 x i8] c"\0A\00"
@.str.10 = [10 x i8] c" [debug] \00"
@.str.11 = [15 x i8] c"env contains:\0A\00"
@.str.12 = [4 x i8] c"%s\0A\00"
@.str.13 = [16 x i8] c"progress %3d%%\0A\00"
@.str.14 = [13 x i8] c"sleeping...\0A\00"
define i32 @main(i32 %0, i8** %1, i8** nocapture %2) {
%4 = alloca i8*
%5 = load i32, i32* @EXIT_SUCCESS
%6 = sext i32 %5 to i64
%7 = load i8*, i8** %1
%8 = bitcast i8** %4 to i8*
%9 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%10 = icmp eq i32 %9, -1
br i1 %10, label %87, label %11
11: ; preds = %3, %80
%12 = phi i32 [ %85, %80 ], [ %9, %3 ]
%13 = phi i8* [ %84, %80 ], [ %7, %3 ]
%14 = phi i64 [ %83, %80 ], [ %6, %3 ]
%15 = phi i32 [ %82, %80 ], [ 4, %3 ]
%16 = phi i32 [ %81, %80 ], [ 0, %3 ]
store i64 0, i64* @errno
switch i32 %12, label %74 [
i32 100, label %80
i32 101, label %17
i32 110, label %43
i32 114, label %45
]
17: ; preds = %11
%18 = load i8*, i8** @optarg
%19 = call i8* @strtol(i8* %18, i8** %4, i32 10)
%20 = ptrtoint i8* %19 to i64
%21 = load i64, i64* @errno
%22 = load i64, i64* @ERANGE
%23 = icmp eq i64 %21, %22
br i1 %23, label %24, label %30
24: ; preds = %17
%25 = load i64, i64* @LONG_MAX
%26 = icmp eq i64 %25, %20
%27 = load i64, i64* @LONG_MIN
%28 = icmp eq i64 %27, %20
%29 = select i1 %26, i1 true, i1 %28
br i1 %29, label %38, label %30
30: ; preds = %24, %17
%31 = icmp ne i64 %21, 0
%32 = icmp eq i8* %19, null
%33 = select i1 %31, i1 %32, i1 false
br i1 %33, label %38, label %34
34: ; preds = %30
%35 = load i8*, i8** %4
%36 = load i8*, i8** @optarg
%37 = icmp eq i8* %35, %36
br i1 %37, label %38, label %80
38: ; preds = %30, %34, %24
%39 = load i32, i32* @stderr
%40 = tail call i32 (i32, i32, i8*, i8*, i8*, ...) @log_xxx(i32 %39, i32 1, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* %13, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0))
%41 = load i64, i64* @EXIT_FAILURE
%42 = tail call i32 @myexit(i8* %13, i64 %41)
br label %80
43: ; preds = %11
%44 = load i8*, i8** @optarg
br label %80
45: ; preds = %11
%46 = load i8*, i8** @optarg
%47 = call i8* @strtol(i8* %46, i8** %4, i32 10)
%48 = ptrtoint i8* %47 to i64
%49 = trunc i64 %48 to i32
%50 = load i64, i64* @errno
%51 = load i64, i64* @ERANGE
%52 = icmp eq i64 %50, %51
br i1 %52, label %53, label %61
53: ; preds = %45
%54 = shl i64 %48, 32
%55 = ashr exact i64 %54, 32
%56 = load i64, i64* @LONG_MAX
%57 = icmp eq i64 %55, %56
%58 = load i64, i64* @LONG_MIN
%59 = icmp eq i64 %55, %58
%60 = select i1 %57, i1 true, i1 %59
br i1 %60, label %69, label %61
61: ; preds = %53, %45
%62 = icmp ne i64 %50, 0
%63 = icmp eq i64 %14, 0
%64 = select i1 %62, i1 %63, i1 false
br i1 %64, label %69, label %65
65: ; preds = %61
%66 = load i8*, i8** %4
%67 = load i8*, i8** @optarg
%68 = icmp eq i8* %66, %67
br i1 %68, label %69, label %80
69: ; preds = %61, %65, %53
%70 = load i32, i32* @stderr
%71 = tail call i32 (i32, i32, i8*, i8*, i8*, ...) @log_xxx(i32 %70, i32 1, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* %13, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0))
%72 = load i64, i64* @EXIT_FAILURE
%73 = tail call i32 @myexit(i8* %13, i64 %72)
br label %80
74: ; preds = %11
%75 = load i32, i32* @stderr
%76 = load i8*, i8** %1
%77 = tail call i32 (i32, i32, i8*, i8*, i8*, ...) @log_xxx(i32 %75, i32 1, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* %13, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.4, i64 0, i64 0), i8* %76)
%78 = load i64, i64* @EXIT_FAILURE
%79 = tail call i32 @myexit(i8* %13, i64 %78)
br label %80
80: ; preds = %11, %65, %69, %34, %38, %74, %43
%81 = phi i32 [ %16, %74 ], [ %16, %69 ], [ %16, %65 ], [ %16, %43 ], [ %16, %38 ], [ %16, %34 ], [ 1, %11 ]
%82 = phi i32 [ %15, %74 ], [ %49, %69 ], [ %49, %65 ], [ %15, %43 ], [ %15, %38 ], [ %15, %34 ], [ %15, %11 ]
%83 = phi i64 [ %14, %74 ], [ %14, %69 ], [ %14, %65 ], [ %14, %43 ], [ %20, %38 ], [ %20, %34 ], [ %14, %11 ]
%84 = phi i8* [ %13, %74 ], [ %13, %69 ], [ %13, %65 ], [ %44, %43 ], [ %13, %38 ], [ %13, %34 ], [ %13, %11 ]
%85 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%86 = icmp eq i32 %85, -1
br i1 %86, label %87, label %11
87: ; preds = %80, %3
%88 = phi i32 [ 0, %3 ], [ %81, %80 ]
%89 = phi i32 [ 4, %3 ], [ %82, %80 ]
%90 = phi i64 [ %6, %3 ], [ %83, %80 ]
%91 = phi i8* [ %7, %3 ], [ %84, %80 ]
%92 = load i32, i32* @stdout
%93 = tail call i32 (i32, i32, i8*, i8*, i8*, ...) @log_xxx(i32 %92, i32 1, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i8* %91, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0))
%94 = icmp sgt i32 %0, 0
br i1 %94, label %95, label %105
95: ; preds = %87
%96 = zext i32 %0 to i64
br label %97
97: ; preds = %95, %97
%98 = phi i64 [ 0, %95 ], [ %103, %97 ]
%99 = load i32, i32* @stdout
%100 = getelementptr inbounds i8*, i8** %1, i64 %98
%101 = load i8*, i8** %100
%102 = tail call i32 (i32, i32, i8*, i8*, i8*, ...) @log_xxx(i32 %99, i32 0, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i8* %101)
%103 = add nuw nsw i64 %98, 1
%104 = icmp eq i64 %103, %96
br i1 %104, label %105, label %97
105: ; preds = %97, %87
%106 = load i32, i32* @stdout
%107 = tail call i32 (i32, i32, i8*, i8*, i8*, ...) @log_xxx(i32 %106, i32 0, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
%108 = icmp eq i32 %88, 0
br i1 %108, label %122, label %109
109: ; preds = %105
%110 = load i32, i32* @stdout
%111 = tail call i32 (i32, i32, i8*, i8*, i8*, ...) @log_xxx(i32 %110, i32 1, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0), i8* %91, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.11, i64 0, i64 0))
%112 = load i8*, i8** %2
%113 = icmp eq i8* %112, null
br i1 %113, label %122, label %114
114: ; preds = %109, %114
%115 = phi i8* [ %120, %114 ], [ %112, %109 ]
%116 = phi i8** [ %119, %114 ], [ %2, %109 ]
%117 = load i32, i32* @stdout
%118 = tail call i32 (i32, i32, i8*, i8*, i8*, ...) @log_xxx(i32 %117, i32 1, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0), i8* %91, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.12, i64 0, i64 0), i8* %115)
%119 = getelementptr inbounds i8*, i8** %116, i64 1
%120 = load i8*, i8** %119
%121 = icmp eq i8* %120, null
br i1 %121, label %122, label %114
122: ; preds = %114, %109, %105
%123 = icmp sgt i32 %89, 0
br i1 %123, label %124, label %142
124: ; preds = %122
%125 = sitofp i32 %89 to float
br label %126
126: ; preds = %124, %138
%127 = phi i32 [ 0, %124 ], [ %140, %138 ]
%128 = load i32, i32* @stdout
%129 = sitofp i32 %127 to float
%130 = fdiv float %129, %125
%131 = fpext float %130 to double
%132 = fmul double %131, 1.000000e+02
%133 = fptosi double %132 to i32
%134 = tail call i32 (i32, i32, i8*, i8*, i8*, ...) @log_xxx(i32 %128, i32 1, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i8* %91, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.13, i64 0, i64 0), i32 %133)
br i1 %108, label %138, label %135
135: ; preds = %126
%136 = load i32, i32* @stdout
%137 = tail call i32 (i32, i32, i8*, i8*, i8*, ...) @log_xxx(i32 %136, i32 1, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0), i8* %91, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.14, i64 0, i64 0))
br label %138
138: ; preds = %135, %126
%139 = tail call i32 @sleep(i32 1)
%140 = add nuw nsw i32 %127, 1
%141 = icmp eq i32 %140, %89
br i1 %141, label %142, label %126
142: ; preds = %138, %122
%143 = load i32, i32* @stdout
%144 = tail call i32 (i32, i32, i8*, i8*, i8*, ...) @log_xxx(i32 %143, i32 1, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i8* %91, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.13, i64 0, i64 0), i32 100)
%145 = tail call i32 @myexit(i8* %91, i64 %90)
%146 = load i32, i32* @EXIT_SUCCESS
ret i32 %146
}