#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 do_get_signature(int, char **);
int do_mkdir_p(int, char **);
int do_multi_receive_file(int, char **);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stderr;
scalar_t__ strcmp(char const *, char *);
int main(int argc, char *argv[]) {
  if (argc < 2) {
    fprintf(stderr, "No command specified\n");
    exit(2);
  }
  const char *command = argv[1];
  char **user_args = argv + 2;
  int count_user_args = argc - 2;
  int retcode;
  if (strcmp(command, "get-signature") == 0) {
    retcode = do_get_signature(count_user_args, user_args);
  } else if (strcmp(command, "multi-receive-file") == 0) {
    retcode = do_multi_receive_file(count_user_args, user_args);
  } else if (strcmp(command, "mkdir-p") == 0) {
    retcode = do_mkdir_p(count_user_args, user_args);
  } else {
    fprintf(stderr, "Unknown command: %s", command);
    retcode = 1;
  }
  fflush(stderr);
  exit(retcode);
}


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    11b1 <main+0x41>
mov    0x2e49(%rip),%rax
mov    (%rax),%edi
lea    0xe60(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    $0x2,%edi
call   1090 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
add    $0x10,%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%eax
sub    $0x2,%eax
mov    %eax,-0x24(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xe39(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    1200 <main+0x90>
mov    -0x24(%rbp),%edi
mov    -0x20(%rbp),%rsi
call   1030 <do_get_signature@plt>
mov    %eax,-0x28(%rbp)
jmp    1288 <main+0x118>
mov    -0x18(%rbp),%rdi
lea    0xe19(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    122e <main+0xbe>
mov    -0x24(%rbp),%edi
mov    -0x20(%rbp),%rsi
call   1050 <do_multi_receive_file@plt>
mov    %eax,-0x28(%rbp)
jmp    1283 <main+0x113>
mov    -0x18(%rbp),%rdi
lea    0xdfe(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    125c <main+0xec>
mov    -0x24(%rbp),%edi
mov    -0x20(%rbp),%rsi
call   1040 <do_mkdir_p@plt>
mov    %eax,-0x28(%rbp)
jmp    127e <main+0x10e>
mov    0x2d7d(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rdx
lea    0xdcf(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movl   $0x1,-0x28(%rbp)
jmp    1283 <main+0x113>
jmp    1288 <main+0x118>
mov    0x2d51(%rip),%rax
mov    (%rax),%edi
call   1080 <fflush@plt>
mov    -0x28(%rbp),%edi
call   1090 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
cmp    $0x1,%edi
jg     119a <main+0x2a>
mov    0x2e60(%rip),%rax
mov    (%rax),%edi
lea    0xe77(%rip),%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    $0x2,%edi
call   1090 <exit@plt>
mov    %rsi,%rbx
mov    %edi,%ebp
mov    0x8(%rsi),%r14
add    $0x10,%rbx
add    $0xfffffffe,%ebp
lea    0xe65(%rip),%rsi
mov    %r14,%rdi
call   1060 <strcmp@plt>
test   %rax,%rax
jne    11cc <main+0x5c>
mov    %ebp,%edi
mov    %rbx,%rsi
call   1030 <do_get_signature@plt>
mov    %eax,%ebx
jmp    122f <main+0xbf>
lea    0xe51(%rip),%rsi
mov    %r14,%rdi
call   1060 <strcmp@plt>
test   %rax,%rax
jne    11ee <main+0x7e>
mov    %ebp,%edi
mov    %rbx,%rsi
call   1050 <do_multi_receive_file@plt>
mov    %eax,%ebx
jmp    122f <main+0xbf>
lea    0xe42(%rip),%rsi
mov    %r14,%rdi
call   1060 <strcmp@plt>
test   %rax,%rax
jne    1210 <main+0xa0>
mov    %ebp,%edi
mov    %rbx,%rsi
call   1040 <do_mkdir_p@plt>
mov    %eax,%ebx
jmp    122f <main+0xbf>
mov    0x2dc9(%rip),%rax
mov    (%rax),%edi
lea    0xe1f(%rip),%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    $0x1,%ebx
mov    0x2daa(%rip),%rax
mov    (%rax),%edi
call   1080 <fflush@plt>
mov    %ebx,%edi
call   1090 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [22 x i8] c"No command specified\0A\00"
@.str.1 = [14 x i8] c"get-signature\00"
@.str.2 = [19 x i8] c"multi-receive-file\00"
@.str.3 = [8 x i8] c"mkdir-p\00"
@.str.4 = [20 x i8] c"Unknown command: %s\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
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = load i32, i32* %4
%11 = icmp slt i32 %10, 2
br i1 %11, label %12, label %16
12: ; preds = %2
%13 = load i32, i32* @stderr
%14 = call i32 (i32, i8*, ...) @fprintf(i32 %13, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%15 = call i32 @exit(i32 2)
unreachable
16: ; preds = %2
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 1
%19 = load i8*, i8** %18
store i8* %19, i8** %6
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 2
store i8** %21, i8*** %7
%22 = load i32, i32* %4
%23 = sub nsw i32 %22, 2
store i32 %23, i32* %8
%24 = load i8*, i8** %6
%25 = call i64 @strcmp(i8* %24, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%26 = icmp eq i64 %25, 0
br i1 %26, label %27, label %31
27: ; preds = %16
%28 = load i32, i32* %8
%29 = load i8**, i8*** %7
%30 = call i32 @do_get_signature(i32 %28, i8** %29)
store i32 %30, i32* %9
br label %53
31: ; preds = %16
%32 = load i8*, i8** %6
%33 = call i64 @strcmp(i8* %32, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%34 = icmp eq i64 %33, 0
br i1 %34, label %35, label %39
35: ; preds = %31
%36 = load i32, i32* %8
%37 = load i8**, i8*** %7
%38 = call i32 @do_multi_receive_file(i32 %36, i8** %37)
store i32 %38, i32* %9
br label %52
39: ; preds = %31
%40 = load i8*, i8** %6
%41 = call i64 @strcmp(i8* %40, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%42 = icmp eq i64 %41, 0
br i1 %42, label %43, label %47
43: ; preds = %39
%44 = load i32, i32* %8
%45 = load i8**, i8*** %7
%46 = call i32 @do_mkdir_p(i32 %44, i8** %45)
store i32 %46, i32* %9
br label %51
47: ; preds = %39
%48 = load i32, i32* @stderr
%49 = load i8*, i8** %6
%50 = call i32 (i32, i8*, ...) @fprintf(i32 %48, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0), i8* %49)
store i32 1, i32* %9
br label %51
51: ; preds = %47, %43
br label %52
52: ; preds = %51, %35
br label %53
53: ; preds = %52, %27
%54 = load i32, i32* @stderr
%55 = call i32 @fflush(i32 %54)
%56 = load i32, i32* %9
%57 = call i32 @exit(i32 %56)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [22 x i8] c"No command specified\0A\00"
@.str.1 = [14 x i8] c"get-signature\00"
@.str.2 = [19 x i8] c"multi-receive-file\00"
@.str.3 = [8 x i8] c"mkdir-p\00"
@.str.4 = [20 x i8] c"Unknown command: %s\00"
define i32 @main(i32 %0, i8** %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = tail call i32 (i32, i8*, ...) @fprintf(i32 %5, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @exit(i32 2)
unreachable
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = getelementptr inbounds i8*, i8** %1, i64 2
%12 = add nsw i32 %0, -2
%13 = tail call i64 @strcmp(i8* %10, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %8
%16 = tail call i32 @do_get_signature(i32 %12, i8** %11)
br label %30
17: ; preds = %8
%18 = tail call i64 @strcmp(i8* %10, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%19 = icmp eq i64 %18, 0
br i1 %19, label %20, label %22
20: ; preds = %17
%21 = tail call i32 @do_multi_receive_file(i32 %12, i8** %11)
br label %30
22: ; preds = %17
%23 = tail call i64 @strcmp(i8* %10, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%24 = icmp eq i64 %23, 0
br i1 %24, label %25, label %27
25: ; preds = %22
%26 = tail call i32 @do_mkdir_p(i32 %12, i8** %11)
br label %30
27: ; preds = %22
%28 = load i32, i32* @stderr
%29 = tail call i32 (i32, i8*, ...) @fprintf(i32 %28, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0), i8* %10)
br label %30
30: ; preds = %20, %27, %25, %15
%31 = phi i32 [ %16, %15 ], [ %21, %20 ], [ %26, %25 ], [ 1, %27 ]
%32 = load i32, i32* @stderr
%33 = tail call i32 @fflush(i32 %32)
%34 = tail call i32 @exit(i32 %31)
unreachable
}