#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 /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ EXIT_SUCCESS;
char *cli_check_help(int);
char *cli_encrypt_help(int);
char *cli_generate_help(int);
char *cli_sign_help(int);
char *cli_verify_help(int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ printf(char *, char const *);
int /*<<< orphan*/ stderr;
scalar_t__ strcasecmp(char *, char *);
int /*<<< orphan*/ usage(char *);
void help(bool failed, int argc, char **argv) {
  const char *ret = NULL;
  if (argc == 0) {
    usage(NULL);
  } else {
    if (strcasecmp(argv[0], "check") == 0) {
      ret = cli_check_help(true);
    } else if (strcasecmp(argv[0], "verify") == 0) {
      ret = cli_verify_help(true);
    } else if (strcasecmp(argv[0], "sign") == 0) {
      ret = cli_sign_help(true);
    } else if (strcasecmp(argv[0], "generate") == 0) {
      ret = cli_generate_help(true);
    } else if (strcasecmp(argv[0], "encrypt") == 0 ||
               strcasecmp(argv[0], "decrypt") == 0) {
      ret = cli_encrypt_help(true);
    } else {
      usage("unknown command");
    }
    if (ret != NULL) {
      if (failed) {
        fprintf(stderr, "%s", ret);
        exit(EXIT_FAILURE);
      } else {
        printf("%s", ret);
        exit(EXIT_SUCCESS);
      }
    }
  }
}


x86 assembly (clang, -O0):
<help>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    11d2 <help+0x32>
xor    %eax,%eax
mov    %eax,%edi
call   10a0 <usage@plt>
jmp    135e <help+0x1be>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xe20(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    1202 <help+0x62>
mov    $0x1,%edi
call   1060 <cli_check_help@plt>
mov    %rax,-0x18(%rbp)
jmp    12ff <help+0x15f>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xdf6(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    1232 <help+0x92>
mov    $0x1,%edi
call   1050 <cli_verify_help@plt>
mov    %rax,-0x18(%rbp)
jmp    12fa <help+0x15a>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xdcd(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    1262 <help+0xc2>
mov    $0x1,%edi
call   10b0 <cli_sign_help@plt>
mov    %rax,-0x18(%rbp)
jmp    12f5 <help+0x155>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xda2(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    1292 <help+0xf2>
mov    $0x1,%edi
call   1070 <cli_generate_help@plt>
mov    %rax,-0x18(%rbp)
jmp    12f0 <help+0x150>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xd7b(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
je     12cc <help+0x12c>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xd66(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    12df <help+0x13f>
mov    $0x1,%edi
call   1090 <cli_encrypt_help@plt>
mov    %rax,-0x18(%rbp)
jmp    12eb <help+0x14b>
lea    0xd45(%rip),%rdi
call   10a0 <usage@plt>
jmp    12f0 <help+0x150>
jmp    12f5 <help+0x155>
jmp    12fa <help+0x15a>
jmp    12ff <help+0x15f>
cmpq   $0x0,-0x18(%rbp)
je     1359 <help+0x1b9>
cmpl   $0x0,-0x4(%rbp)
je     133b <help+0x19b>
mov    0x2cc5(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rdx
lea    0xd13(%rip),%rsi
call   1080 <fprintf@plt>
mov    0x2ca4(%rip),%rax
mov    (%rax),%edi
call   10c0 <exit@plt>
mov    -0x18(%rbp),%rsi
lea    0xcf5(%rip),%rdi
call   1040 <printf@plt>
mov    0x2c7e(%rip),%rax
mov    (%rax),%edi
call   10c0 <exit@plt>
jmp    135e <help+0x1be>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<help>:
push   %rbp
push   %rbx
push   %rax
test   %esi,%esi
je     1231 <help+0x91>
mov    %edi,%ebp
mov    (%rdx),%rbx
lea    0xe49(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     123e <help+0x9e>
lea    0xe3b(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     124a <help+0xaa>
lea    0xe2e(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     1256 <help+0xb6>
lea    0xe1f(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     126e <help+0xce>
lea    0xe14(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     1262 <help+0xc2>
lea    0xe08(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     1262 <help+0xc2>
lea    0xdfc(%rip),%rdi
jmp    1233 <help+0x93>
xor    %edi,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    10a0 <usage@plt>
mov    $0x1,%edi
call   1060 <cli_check_help@plt>
jmp    1278 <help+0xd8>
mov    $0x1,%edi
call   1050 <cli_verify_help@plt>
jmp    1278 <help+0xd8>
mov    $0x1,%edi
call   10b0 <cli_sign_help@plt>
jmp    1278 <help+0xd8>
mov    $0x1,%edi
call   1090 <cli_encrypt_help@plt>
jmp    1278 <help+0xd8>
mov    $0x1,%edi
call   1070 <cli_generate_help@plt>
test   %rax,%rax
jne    1284 <help+0xe4>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
test   %ebp,%ebp
jne    12a5 <help+0x105>
lea    0xdac(%rip),%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
mov    0x2d32(%rip),%rax
mov    (%rax),%edi
call   10c0 <exit@plt>
mov    0x2d34(%rip),%rcx
mov    (%rcx),%edi
lea    0xd86(%rip),%rsi
mov    %rax,%rdx
call   1080 <fprintf@plt>
mov    0x2d14(%rip),%rax
mov    (%rax),%edi
call   10c0 <exit@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"check\00"
@.str.1 = [7 x i8] c"verify\00"
@.str.2 = [5 x i8] c"sign\00"
@.str.3 = [9 x i8] c"generate\00"
@.str.4 = [8 x i8] c"encrypt\00"
@.str.5 = [8 x i8] c"decrypt\00"
@.str.6 = [16 x i8] c"unknown command\00"
@stderr = global i32 0
@.str.7 = [3 x i8] c"%s\00"
@EXIT_FAILURE = global i32 0
@EXIT_SUCCESS = global i32 0
define void @help(i32 %0, i32 %1, i8** %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8**
%7 = alloca i8*
store i32 %0, i32* %4
store i32 %1, i32* %5
store i8** %2, i8*** %6
store i8* null, i8** %7
%8 = load i32, i32* %5
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %3
%11 = call i32 @usage(i8* null)
br label %82
12: ; preds = %3
%13 = load i8**, i8*** %6
%14 = getelementptr inbounds i8*, i8** %13, i64 0
%15 = load i8*, i8** %14
%16 = call i64 @strcasecmp(i8* %15, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %12
%19 = call i8* @cli_check_help(i32 1)
store i8* %19, i8** %7
br label %64
20: ; preds = %12
%21 = load i8**, i8*** %6
%22 = getelementptr inbounds i8*, i8** %21, i64 0
%23 = load i8*, i8** %22
%24 = call i64 @strcasecmp(i8* %23, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%25 = icmp eq i64 %24, 0
br i1 %25, label %26, label %28
26: ; preds = %20
%27 = call i8* @cli_verify_help(i32 1)
store i8* %27, i8** %7
br label %63
28: ; preds = %20
%29 = load i8**, i8*** %6
%30 = getelementptr inbounds i8*, i8** %29, i64 0
%31 = load i8*, i8** %30
%32 = call i64 @strcasecmp(i8* %31, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%33 = icmp eq i64 %32, 0
br i1 %33, label %34, label %36
34: ; preds = %28
%35 = call i8* @cli_sign_help(i32 1)
store i8* %35, i8** %7
br label %62
36: ; preds = %28
%37 = load i8**, i8*** %6
%38 = getelementptr inbounds i8*, i8** %37, i64 0
%39 = load i8*, i8** %38
%40 = call i64 @strcasecmp(i8* %39, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%41 = icmp eq i64 %40, 0
br i1 %41, label %42, label %44
42: ; preds = %36
%43 = call i8* @cli_generate_help(i32 1)
store i8* %43, i8** %7
br label %61
44: ; preds = %36
%45 = load i8**, i8*** %6
%46 = getelementptr inbounds i8*, i8** %45, i64 0
%47 = load i8*, i8** %46
%48 = call i64 @strcasecmp(i8* %47, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
%49 = icmp eq i64 %48, 0
br i1 %49, label %56, label %50
50: ; preds = %44
%51 = load i8**, i8*** %6
%52 = getelementptr inbounds i8*, i8** %51, i64 0
%53 = load i8*, i8** %52
%54 = call i64 @strcasecmp(i8* %53, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0))
%55 = icmp eq i64 %54, 0
br i1 %55, label %56, label %58
56: ; preds = %50, %44
%57 = call i8* @cli_encrypt_help(i32 1)
store i8* %57, i8** %7
br label %60
58: ; preds = %50
%59 = call i32 @usage(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0))
br label %60
60: ; preds = %58, %56
br label %61
61: ; preds = %60, %42
br label %62
62: ; preds = %61, %34
br label %63
63: ; preds = %62, %26
br label %64
64: ; preds = %63, %18
%65 = load i8*, i8** %7
%66 = icmp ne i8* %65, null
br i1 %66, label %67, label %81
67: ; preds = %64
%68 = load i32, i32* %4
%69 = icmp ne i32 %68, 0
br i1 %69, label %70, label %76
70: ; preds = %67
%71 = load i32, i32* @stderr
%72 = load i8*, i8** %7
%73 = call i32 @fprintf(i32 %71, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i8* %72)
%74 = load i32, i32* @EXIT_FAILURE
%75 = call i32 @exit(i32 %74)
unreachable
76: ; preds = %67
%77 = load i8*, i8** %7
%78 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i8* %77)
%79 = load i32, i32* @EXIT_SUCCESS
%80 = call i32 @exit(i32 %79)
unreachable
81: ; preds = %64
br label %82
82: ; preds = %81, %10
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"check\00"
@.str.1 = [7 x i8] c"verify\00"
@.str.2 = [5 x i8] c"sign\00"
@.str.3 = [9 x i8] c"generate\00"
@.str.4 = [8 x i8] c"encrypt\00"
@.str.5 = [8 x i8] c"decrypt\00"
@.str.6 = [16 x i8] c"unknown command\00"
@stderr = global i32 0
@.str.7 = [3 x i8] c"%s\00"
@EXIT_FAILURE = global i32 0
@EXIT_SUCCESS = global i32 0
define void @help(i32 %0, i32 %1, i8** nocapture %2) {
%4 = icmp eq i32 %1, 0
br i1 %4, label %48, label %5
5: ; preds = %3
%6 = load i8*, i8** %2
%7 = tail call i64 @strcasecmp(i8* %6, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %5
%10 = tail call i8* @cli_check_help(i32 1)
br label %34
11: ; preds = %5
%12 = tail call i64 @strcasecmp(i8* %6, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %11
%15 = tail call i8* @cli_verify_help(i32 1)
br label %34
16: ; preds = %11
%17 = tail call i64 @strcasecmp(i8* %6, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %21
19: ; preds = %16
%20 = tail call i8* @cli_sign_help(i32 1)
br label %34
21: ; preds = %16
%22 = tail call i64 @strcasecmp(i8* %6, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%23 = icmp eq i64 %22, 0
br i1 %23, label %24, label %26
24: ; preds = %21
%25 = tail call i8* @cli_generate_help(i32 1)
br label %34
26: ; preds = %21
%27 = tail call i64 @strcasecmp(i8* %6, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
%28 = icmp eq i64 %27, 0
br i1 %28, label %32, label %29
29: ; preds = %26
%30 = tail call i64 @strcasecmp(i8* %6, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0))
%31 = icmp eq i64 %30, 0
br i1 %31, label %32, label %48
32: ; preds = %29, %26
%33 = tail call i8* @cli_encrypt_help(i32 1)
br label %34
34: ; preds = %14, %24, %32, %19, %9
%35 = phi i8* [ %10, %9 ], [ %15, %14 ], [ %20, %19 ], [ %25, %24 ], [ %33, %32 ]
%36 = icmp eq i8* %35, null
br i1 %36, label %51, label %37
37: ; preds = %34
%38 = icmp eq i32 %0, 0
br i1 %38, label %44, label %39
39: ; preds = %37
%40 = load i32, i32* @stderr
%41 = tail call i32 @fprintf(i32 %40, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i8* %35)
%42 = load i32, i32* @EXIT_FAILURE
%43 = tail call i32 @exit(i32 %42)
unreachable
44: ; preds = %37
%45 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i8* %35)
%46 = load i32, i32* @EXIT_SUCCESS
%47 = tail call i32 @exit(i32 %46)
unreachable
48: ; preds = %29, %3
%49 = phi i8* [ null, %3 ], [ getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0), %29 ]
%50 = tail call i32 @usage(i8* %49)
br label %51
51: ; preds = %48, %34
ret void
}