#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 command_help(char *);
int /*<<< orphan*/ printf(char *, char *);
int cmd_help(int argc, char **argv) {
  if (argc <= 2) {
    printf("Usage: %s [cmd [args]]\n", argv[0]);
    printf("\nCommands: \n"
           "    help            Show this help. \n"
           "    info            Show information about this program. \n"
           "    show            Show meals. \n"
           "    config          Show configuration or set values. \n"
           "\n"
           "Use %s help cmd to show help about this command.\n",
           argv[0]);
    return 0;
  } else {
    return command_help(argv[1]);
  }
}


x86 assembly (clang, -O0):
<cmd_help>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jg     116b <cmd_help+0x4b>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xeb9(%rip),%rdi
call   1040 <printf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xebe(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    117b <cmd_help+0x5b>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <command_help@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmd_help>:
push   %rbx
mov    %rsi,%rbx
cmp    $0x2,%edi
jg     114b <cmd_help+0x2b>
mov    (%rbx),%rsi
lea    0xecd(%rip),%rdi
call   1040 <printf@plt>
mov    (%rbx),%rsi
lea    0xed6(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret
mov    0x8(%rbx),%rdi
pop    %rbx
jmp    1030 <command_help@plt>

LLVM IR (-O0):
@.str = [24 x i8] c"Usage: %s [cmd [args]]\0A\00"
@.str.1 = [246 x i8] c"\0ACommands: \0A help Show this help. \0A info Show information about this program. \0A show Show meals. \0A config Show configuration or set values. \0A\0AUse %s help cmd to show help about this command.\0A\00"
define i32 @cmd_help(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = icmp sle i32 %6, 2
br i1 %7, label %8, label %17
8: ; preds = %2
%9 = load i8**, i8*** %5
%10 = getelementptr inbounds i8*, i8** %9, i64 0
%11 = load i8*, i8** %10
%12 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %11)
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 0
%15 = load i8*, i8** %14
%16 = call i32 @printf(i8* getelementptr inbounds ([246 x i8], [246 x i8]* @.str.1, i64 0, i64 0), i8* %15)
store i32 0, i32* %3
br label %22
17: ; preds = %2
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 1
%20 = load i8*, i8** %19
%21 = call i32 @command_help(i8* %20)
store i32 %21, i32* %3
br label %22
22: ; preds = %17, %8
%23 = load i32, i32* %3
ret i32 %23
}

LLVM IR (-O2):
@.str = [24 x i8] c"Usage: %s [cmd [args]]\0A\00"
@.str.1 = [246 x i8] c"\0ACommands: \0A help Show this help. \0A info Show information about this program. \0A show Show meals. \0A config Show configuration or set values. \0A\0AUse %s help cmd to show help about this command.\0A\00"
define i32 @cmd_help(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 3
br i1 %3, label %4, label %9
4: ; preds = %2
%5 = load i8*, i8** %1
%6 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = load i8*, i8** %1
%8 = tail call i32 @printf(i8* getelementptr inbounds ([246 x i8], [246 x i8]* @.str.1, i64 0, i64 0), i8* %7)
br label %13
9: ; preds = %2
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = tail call i32 @command_help(i8* %11)
br label %13
13: ; preds = %9, %4
%14 = phi i32 [ 0, %4 ], [ %12, %9 ]
ret i32 %14
}