#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 parse_options(int, char **);
int runprogram(int, char **);
int /*<<< orphan*/ show_help();
int main(int argc, char *argv[]) {
  int opt_offset = parse_options(argc, argv);
  if (opt_offset < 0) {
    show_help();
    return -(opt_offset + 1);
  }
  return runprogram(argc - opt_offset, argv + opt_offset);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <parse_options@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    1178 <main+0x48>
mov    $0x0,%al
call   1050 <show_help@plt>
mov    -0x14(%rbp),%ecx
add    $0x1,%ecx
xor    %eax,%eax
sub    %ecx,%eax
mov    %eax,-0x4(%rbp)
jmp    1195 <main+0x65>
mov    -0x8(%rbp),%edi
sub    -0x14(%rbp),%edi
mov    -0x10(%rbp),%rsi
movslq -0x14(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rsi
call   1040 <runprogram@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %edi,%ebp
call   1030 <parse_options@plt>
mov    %eax,%ebx
test   %eax,%eax
js     1157 <main+0x27>
sub    %ebx,%ebp
mov    %ebx,%eax
lea    (%r14,%rax,8),%rsi
mov    %ebp,%edi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <runprogram@plt>
xor    %eax,%eax
call   1050 <show_help@plt>
not    %ebx
mov    %ebx,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = load i8**, i8*** %5
%9 = call i32 @parse_options(i32 %7, i8** %8)
store i32 %9, i32* %6
%10 = load i32, i32* %6
%11 = icmp slt i32 %10, 0
br i1 %11, label %12, label %17
12: ; preds = %2
%13 = call i32 (...) @show_help()
%14 = load i32, i32* %6
%15 = add nsw i32 %14, 1
%16 = sub nsw i32 0, %15
store i32 %16, i32* %3
br label %26
17: ; preds = %2
%18 = load i32, i32* %4
%19 = load i32, i32* %6
%20 = sub nsw i32 %18, %19
%21 = load i8**, i8*** %5
%22 = load i32, i32* %6
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i8*, i8** %21, i64 %23
%25 = call i32 @runprogram(i32 %20, i8** %24)
store i32 %25, i32* %3
br label %26
26: ; preds = %17, %12
%27 = load i32, i32* %3
ret i32 %27
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @parse_options(i32 %0, i8** %1)
%4 = icmp slt i32 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %2
%6 = tail call i32 (...) @show_help()
%7 = xor i32 %3, -1
br label %13
8: ; preds = %2
%9 = sub nsw i32 %0, %3
%10 = zext i32 %3 to i64
%11 = getelementptr inbounds i8*, i8** %1, i64 %10
%12 = tail call i32 @runprogram(i32 %9, i8** %11)
br label %13
13: ; preds = %8, %5
%14 = phi i32 [ %7, %5 ], [ %12, %8 ]
ret i32 %14
}