#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*/ fh_cli_alias_show();
int /*<<< orphan*/ fh_cli_print(char *, char *);
int /*<<< orphan*/ fh_cli_write(char *, ...);
int strlen(char *);
int alias_ls_cb(char *full_cmd, char **argv, int argc) {
  char *last_arg = argv[argc - 1];
  if (last_arg[strlen(last_arg) - 1] == '?') {
    fh_cli_write("\n");
    fh_cli_print("<Enter>", "List all your aliases");
    return 0;
  }
  if (argc > 1) {
    fh_cli_write("Usage: %s\n", full_cmd);
    return 0;
  }
  fh_cli_alias_show();
  return 0;
}


x86 assembly (clang, -O0):
<alias_ls_cb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x1c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x28(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x30(%rbp),%rax
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x3f,%eax
jne    11bf <alias_ls_cb+0x7f>
lea    0xe8e(%rip),%rdi
mov    $0x0,%al
call   1040 <fh_cli_write@plt>
lea    0xe59(%rip),%rdi
lea    0xe5a(%rip),%rsi
call   1060 <fh_cli_print@plt>
movl   $0x0,-0x4(%rbp)
jmp    11f5 <alias_ls_cb+0xb5>
cmpl   $0x1,-0x1c(%rbp)
jle    11e7 <alias_ls_cb+0xa7>
mov    -0x10(%rbp),%rsi
lea    0xe4a(%rip),%rdi
mov    $0x0,%al
call   1040 <fh_cli_write@plt>
movl   $0x0,-0x4(%rbp)
jmp    11f5 <alias_ls_cb+0xb5>
mov    $0x0,%al
call   1050 <fh_cli_alias_show@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<alias_ls_cb>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%ebp
mov    %rdi,%r14
movslq %edx,%rax
mov    -0x8(%rsi,%rax,8),%rbx
mov    %rbx,%rdi
call   1030 <strlen@plt>
cltq
cmpb   $0x3f,-0x1(%rax,%rbx,1)
jne    1185 <alias_ls_cb+0x45>
lea    0xebe(%rip),%rdi
xor    %eax,%eax
call   1040 <fh_cli_write@plt>
lea    0xe89(%rip),%rdi
lea    0xe8a(%rip),%rsi
call   1060 <fh_cli_print@plt>
jmp    11a4 <alias_ls_cb+0x64>
cmp    $0x2,%ebp
jl     119d <alias_ls_cb+0x5d>
lea    0xe8d(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <fh_cli_write@plt>
jmp    11a4 <alias_ls_cb+0x64>
xor    %eax,%eax
call   1050 <fh_cli_alias_show@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"\0A\00"
@.str.1 = [8 x i8] c"<Enter>\00"
@.str.2 = [22 x i8] c"List all your aliases\00"
@.str.3 = [11 x i8] c"Usage: %s\0A\00"
define i32 @alias_ls_cb(i8* %0, i8** %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8**
%7 = alloca i32
%8 = alloca i8*
store i8* %0, i8** %5
store i8** %1, i8*** %6
store i32 %2, i32* %7
%9 = load i8**, i8*** %6
%10 = load i32, i32* %7
%11 = sub nsw i32 %10, 1
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds i8*, i8** %9, i64 %12
%14 = load i8*, i8** %13
store i8* %14, i8** %8
%15 = load i8*, i8** %8
%16 = load i8*, i8** %8
%17 = call i32 @strlen(i8* %16)
%18 = sub nsw i32 %17, 1
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i8, i8* %15, i64 %19
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
%23 = icmp eq i32 %22, 63
br i1 %23, label %24, label %27
24: ; preds = %3
%25 = call i32 (i8*, ...) @fh_cli_write(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%26 = call i32 @fh_cli_print(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %4
br label %35
27: ; preds = %3
%28 = load i32, i32* %7
%29 = icmp sgt i32 %28, 1
br i1 %29, label %30, label %33
30: ; preds = %27
%31 = load i8*, i8** %5
%32 = call i32 (i8*, ...) @fh_cli_write(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i8* %31)
store i32 0, i32* %4
br label %35
33: ; preds = %27
%34 = call i32 (...) @fh_cli_alias_show()
store i32 0, i32* %4
br label %35
35: ; preds = %33, %30, %24
%36 = load i32, i32* %4
ret i32 %36
}

LLVM IR (-O2):
@.str = [2 x i8] c"\0A\00"
@.str.1 = [8 x i8] c"<Enter>\00"
@.str.2 = [22 x i8] c"List all your aliases\00"
@.str.3 = [11 x i8] c"Usage: %s\0A\00"
define i32 @alias_ls_cb(i8* %0, i8** nocapture %1, i32 %2) {
%4 = add nsw i32 %2, -1
%5 = sext i32 %4 to i64
%6 = getelementptr inbounds i8*, i8** %1, i64 %5
%7 = load i8*, i8** %6
%8 = tail call i32 @strlen(i8* %7)
%9 = add nsw i32 %8, -1
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i8, i8* %7, i64 %10
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 63
br i1 %13, label %14, label %17
14: ; preds = %3
%15 = tail call i32 (i8*, ...) @fh_cli_write(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%16 = tail call i32 @fh_cli_print(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
br label %23
17: ; preds = %3
%18 = icmp sgt i32 %2, 1
br i1 %18, label %19, label %21
19: ; preds = %17
%20 = tail call i32 (i8*, ...) @fh_cli_write(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i8* %0)
br label %23
21: ; preds = %17
%22 = tail call i32 (...) @fh_cli_alias_show()
br label %23
23: ; preds = %21, %19, %14
ret i32 0
}