#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 */
char *get_option(char *, char **, int);
int hide_stuff(int, char **);
int /*<<< orphan*/ printf(char *, ...);
int recover_stuff(int, char **);
scalar_t__ strcmp(char *, char *);
int main(int argc, char **argv) {
  char *task = NULL;
  if (argc == 1) {
    printf(
        "usage: %s --task=hide|recover "
        "[--input-file=<filepath>|--input-buf=<data> --output-file=<filepath> "
        "--cover-file=<filepath>]\n",
        argv[0]);
    return 1;
  }
  task = get_option("task", argv, argc);
  if (task == NULL) {
    printf("OPTION PARSING ERROR: --task=hide|recover must be supplied.\n");
    return 1;
  }
  if (strcmp(task, "hide") == 0) {
    return hide_stuff(argc, argv);
  } else if (strcmp(task, "recover") == 0) {
    return recover_stuff(argc, argv);
  } else {
    printf("OPTION PARSING ERROR: \"%s\" is a unknown task.\n", task);
    return 1;
  }
  return 0;
}


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)
movq   $0x0,-0x18(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    1199 <main+0x49>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe7a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    124a <main+0xfa>
mov    -0x10(%rbp),%rsi
mov    -0x8(%rbp),%edx
lea    0xed6(%rip),%rdi
call   1070 <get_option@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    11d5 <main+0x85>
lea    0xec0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    124a <main+0xfa>
mov    -0x18(%rbp),%rdi
lea    0xedf(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    1203 <main+0xb3>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <hide_stuff@plt>
mov    %eax,-0x4(%rbp)
jmp    124a <main+0xfa>
mov    -0x18(%rbp),%rdi
lea    0xeb6(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    1231 <main+0xe1>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1060 <recover_stuff@plt>
mov    %eax,-0x4(%rbp)
jmp    124a <main+0xfa>
mov    -0x18(%rbp),%rsi
lea    0xe90(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-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,%rbx
cmp    $0x1,%edi
jne    1178 <main+0x18>
mov    (%rbx),%rsi
lea    0xe8a(%rip),%rdi
jmp    11c5 <main+0x65>
mov    %edi,%ebp
lea    0xefc(%rip),%rdi
mov    %rbx,%rsi
mov    %ebp,%edx
call   1080 <get_option@plt>
test   %rax,%rax
je     11ce <main+0x6e>
mov    %rax,%r14
lea    0xee8(%rip),%rsi
mov    %rax,%rdi
call   1060 <strcmp@plt>
test   %rax,%rax
je     11e4 <main+0x84>
lea    0xed9(%rip),%rsi
mov    %r14,%rdi
call   1060 <strcmp@plt>
test   %rax,%rax
je     11f2 <main+0x92>
lea    0xecd(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    11da <main+0x7a>
lea    0xee9(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret
mov    %ebp,%edi
mov    %rbx,%rsi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <hide_stuff@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1070 <recover_stuff@plt>

LLVM IR (-O0):
@.str = [125 x i8] c"usage: %s --task=hide|recover [--input-file=<filepath>|--input-buf=<data> --output-file=<filepath> --cover-file=<filepath>]\0A\00"
@.str.1 = [5 x i8] c"task\00"
@.str.2 = [61 x i8] c"OPTION PARSING ERROR: --task=hide|recover must be supplied.\0A\00"
@.str.3 = [5 x i8] c"hide\00"
@.str.4 = [8 x i8] c"recover\00"
@.str.5 = [47 x i8] c"OPTION PARSING ERROR: \22%s\22 is a unknown task.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* null, i8** %6
%7 = load i32, i32* %4
%8 = icmp eq i32 %7, 1
br i1 %8, label %9, label %14
9: ; preds = %2
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 0
%12 = load i8*, i8** %11
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([125 x i8], [125 x i8]* @.str, i64 0, i64 0), i8* %12)
store i32 1, i32* %3
br label %41
14: ; preds = %2
%15 = load i8**, i8*** %5
%16 = load i32, i32* %4
%17 = call i8* @get_option(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8** %15, i32 %16)
store i8* %17, i8** %6
%18 = load i8*, i8** %6
%19 = icmp eq i8* %18, null
br i1 %19, label %20, label %22
20: ; preds = %14
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %3
br label %41
22: ; preds = %14
%23 = load i8*, i8** %6
%24 = call i64 @strcmp(i8* %23, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%25 = icmp eq i64 %24, 0
br i1 %25, label %26, label %30
26: ; preds = %22
%27 = load i32, i32* %4
%28 = load i8**, i8*** %5
%29 = call i32 @hide_stuff(i32 %27, i8** %28)
store i32 %29, i32* %3
br label %41
30: ; preds = %22
%31 = load i8*, i8** %6
%32 = call i64 @strcmp(i8* %31, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
%33 = icmp eq i64 %32, 0
br i1 %33, label %34, label %38
34: ; preds = %30
%35 = load i32, i32* %4
%36 = load i8**, i8*** %5
%37 = call i32 @recover_stuff(i32 %35, i8** %36)
store i32 %37, i32* %3
br label %41
38: ; preds = %30
%39 = load i8*, i8** %6
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.5, i64 0, i64 0), i8* %39)
store i32 1, i32* %3
br label %41
41: ; preds = %38, %34, %26, %20, %9
%42 = load i32, i32* %3
ret i32 %42
}

LLVM IR (-O2):
@.str = [125 x i8] c"usage: %s --task=hide|recover [--input-file=<filepath>|--input-buf=<data> --output-file=<filepath> --cover-file=<filepath>]\0A\00"
@.str.1 = [5 x i8] c"task\00"
@.str.3 = [5 x i8] c"hide\00"
@.str.4 = [8 x i8] c"recover\00"
@.str.5 = [47 x i8] c"OPTION PARSING ERROR: \22%s\22 is a unknown task.\0A\00"
@str = [60 x i8] c"OPTION PARSING ERROR: --task=hide|recover must be supplied.\00"
define i32 @main(i32 %0, i8** %1) {
%3 = icmp eq i32 %0, 1
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = load i8*, i8** %1
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([125 x i8], [125 x i8]* @.str, i64 0, i64 0), i8* %5)
br label %24
7: ; preds = %2
%8 = tail call i8* @get_option(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8** %1, i32 %0)
%9 = icmp eq i8* %8, null
br i1 %9, label %10, label %12
10: ; preds = %7
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @str, i64 0, i64 0))
br label %24
12: ; preds = %7
%13 = tail call i64 @strcmp(i8* %8, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %12
%16 = tail call i32 @hide_stuff(i32 %0, i8** %1)
br label %24
17: ; preds = %12
%18 = tail call i64 @strcmp(i8* %8, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
%19 = icmp eq i64 %18, 0
br i1 %19, label %20, label %22
20: ; preds = %17
%21 = tail call i32 @recover_stuff(i32 %0, i8** %1)
br label %24
22: ; preds = %17
%23 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @.str.5, i64 0, i64 0), i8* %8)
br label %24
24: ; preds = %22, %20, %15, %10, %4
%25 = phi i32 [ 1, %4 ], [ 1, %10 ], [ %16, %15 ], [ %21, %20 ], [ 1, %22 ]
ret i32 %25
}