#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 int /*<<< orphan*/ FILE;

/* Variables and functions */
scalar_t__ buildOptLists(int, char **, char **, char ***);
int /*<<< orphan*/ *createTempManPage(char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ freeList(char **);
int /*<<< orphan*/ printOptions(int /*<<< orphan*/ *, char *, char **);
int /*<<< orphan*/ printf(char *);
int main(int argc, char *argv[]) {
  if (argc < 2) {
    printf("Usage: explain command opt1 opt2 opt3...\n");
    exit(1);
  }
  char *smallOpts = NULL;
  char **longOpts = NULL;
  if (buildOptLists(argc, argv, &smallOpts, &longOpts) > 0) {
    return 1;
  }
  FILE *manPage = createTempManPage(argv[1]);
  if (manPage) {
    printOptions(manPage, smallOpts, longOpts);
    fclose(manPage);
  }
  free(smallOpts);
  freeList(longOpts);
}


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)
cmpl   $0x2,-0x8(%rbp)
jge    11b6 <main+0x36>
lea    0xe59(%rip),%rdi
call   1060 <printf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    -0x18(%rbp),%rdx
lea    -0x20(%rbp),%rcx
call   10a0 <buildOptLists@plt>
cmp    $0x0,%rax
jle    11f0 <main+0x70>
movl   $0x1,-0x4(%rbp)
jmp    1238 <main+0xb8>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1070 <createTempManPage@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     1226 <main+0xa6>
mov    -0x28(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1080 <printOptions@plt>
mov    -0x28(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    -0x20(%rbp),%rdi
call   1040 <freeList@plt>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
cmp    $0x1,%edi
jle    11fd <main+0x7d>
mov    %rsi,%rbx
movq   $0x0,0x8(%rsp)
movq   $0x0,(%rsp)
lea    0x8(%rsp),%rdx
mov    %rsp,%rcx
call   10a0 <buildOptLists@plt>
mov    %rax,%rcx
mov    $0x1,%eax
test   %rcx,%rcx
jg     11f7 <main+0x77>
mov    0x8(%rbx),%rdi
call   1070 <createTempManPage@plt>
test   %rax,%rax
je     11e2 <main+0x62>
mov    %rax,%rbx
mov    0x8(%rsp),%rsi
mov    (%rsp),%rdx
mov    %rax,%rdi
call   1080 <printOptions@plt>
mov    %rbx,%rdi
call   1060 <fclose@plt>
mov    0x8(%rsp),%rdi
call   1030 <free@plt>
mov    (%rsp),%rdi
call   1050 <freeList@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret
lea    0xdfc(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%edi
call   1090 <exit@plt>

LLVM IR (-O0):
@.str = [42 x i8] c"Usage: explain command opt1 opt2 opt3...\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8**
%8 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i32, i32* %4
%10 = icmp slt i32 %9, 2
br i1 %10, label %11, label %14
11: ; preds = %2
%12 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
%13 = call i32 @exit(i32 1)
unreachable
14: ; preds = %2
store i8* null, i8** %6
store i8** null, i8*** %7
%15 = load i32, i32* %4
%16 = load i8**, i8*** %5
%17 = call i64 @buildOptLists(i32 %15, i8** %16, i8** %6, i8*** %7)
%18 = icmp sgt i64 %17, 0
br i1 %18, label %19, label %20
19: ; preds = %14
store i32 1, i32* %3
br label %39
20: ; preds = %14
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 1
%23 = load i8*, i8** %22
%24 = call i32* @createTempManPage(i8* %23)
store i32* %24, i32** %8
%25 = load i32*, i32** %8
%26 = icmp ne i32* %25, null
br i1 %26, label %27, label %34
27: ; preds = %20
%28 = load i32*, i32** %8
%29 = load i8*, i8** %6
%30 = load i8**, i8*** %7
%31 = call i32 @printOptions(i32* %28, i8* %29, i8** %30)
%32 = load i32*, i32** %8
%33 = call i32 @fclose(i32* %32)
br label %34
34: ; preds = %27, %20
%35 = load i8*, i8** %6
%36 = call i32 @free(i8* %35)
%37 = load i8**, i8*** %7
%38 = call i32 @freeList(i8** %37)
br label %39
39: ; preds = %34, %19
%40 = load i32, i32* %3
ret i32 %40
}

LLVM IR (-O2):
@str = [41 x i8] c"Usage: explain command opt1 opt2 opt3...\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i8*
%4 = alloca i8**
%5 = icmp slt i32 %0, 2
br i1 %5, label %6, label %9
6: ; preds = %2
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str, i64 0, i64 0))
%8 = tail call i32 @exit(i32 1)
unreachable
9: ; preds = %2
%10 = bitcast i8** %3 to i8*
store i8* null, i8** %3
%11 = bitcast i8*** %4 to i8*
store i8** null, i8*** %4
%12 = call i64 @buildOptLists(i32 %0, i8** %1, i8** %3, i8*** %4)
%13 = icmp sgt i64 %12, 0
br i1 %13, label %29, label %14
14: ; preds = %9
%15 = getelementptr inbounds i8*, i8** %1, i64 1
%16 = load i8*, i8** %15
%17 = call i32* @createTempManPage(i8* %16)
%18 = icmp eq i32* %17, null
br i1 %18, label %24, label %19
19: ; preds = %14
%20 = load i8*, i8** %3
%21 = load i8**, i8*** %4
%22 = call i32 @printOptions(i32* %17, i8* %20, i8** %21)
%23 = call i32 @fclose(i32* %17)
br label %24
24: ; preds = %19, %14
%25 = load i8*, i8** %3
%26 = call i32 @free(i8* %25)
%27 = load i8**, i8*** %4
%28 = call i32 @freeList(i8** %27)
br label %29
29: ; preds = %9, %24
%30 = phi i32 [ 0, %24 ], [ 1, %9 ]
ret i32 %30
}