#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*/ error_msg(char *);
int /*<<< orphan*/ show_binding(char *, char *);
char *strchr(char *, char);
void cmd_showbind(char *arg) {
  char *key;
  key = strchr(arg, ' ');
  if (key == NULL)
    goto err;
  *key++ = 0;
  while (*key == ' ')
    key++;
  if (*key == 0)
    goto err;
  show_binding(arg, key);
  return;
err:
  error_msg("expecting 2 arguments (context and key)\n");
}


x86 assembly (clang, -O0):
<cmd_showbind>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x20,%esi
call   1050 <strchr@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    115e <cmd_showbind+0x2e>
jmp    11b8 <cmd_showbind+0x88>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x0,(%rax)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
jne    1191 <cmd_showbind+0x61>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1170 <cmd_showbind+0x40>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    11a6 <cmd_showbind+0x76>
jmp    11b8 <cmd_showbind+0x88>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <show_binding@plt>
jmp    11c4 <cmd_showbind+0x94>
lea    0xe41(%rip),%rdi
call   1030 <error_msg@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmd_showbind>:
push   %rbx
mov    %rdi,%rbx
mov    $0x20,%esi
call   1050 <strchr@plt>
test   %rax,%rax
je     1161 <cmd_showbind+0x31>
movb   $0x0,(%rax)
cs nopw 0x0(%rax,%rax,1)
movzbl 0x1(%rax),%ecx
add    $0x1,%rax
cmp    $0x20,%cl
je     1150 <cmd_showbind+0x20>
test   %cl,%cl
jne    116e <cmd_showbind+0x3e>
lea    0xe98(%rip),%rdi
pop    %rbx
jmp    1030 <error_msg@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
pop    %rbx
jmp    1040 <show_binding@plt>

LLVM IR (-O0):
@.str = [41 x i8] c"expecting 2 arguments (context and key)\0A\00"
define void @cmd_showbind(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i8* @strchr(i8* %4, i8 signext 32)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = icmp eq i8* %6, null
br i1 %7, label %8, label %9
8: ; preds = %1
br label %30
9: ; preds = %1
%10 = load i8*, i8** %3
%11 = getelementptr inbounds i8, i8* %10, i32 1
store i8* %11, i8** %3
store i8 0, i8* %10
br label %12
12: ; preds = %17, %9
%13 = load i8*, i8** %3
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = icmp eq i32 %15, 32
br i1 %16, label %17, label %20
17: ; preds = %12
%18 = load i8*, i8** %3
%19 = getelementptr inbounds i8, i8* %18, i32 1
store i8* %19, i8** %3
br label %12
20: ; preds = %12
%21 = load i8*, i8** %3
%22 = load i8, i8* %21
%23 = sext i8 %22 to i32
%24 = icmp eq i32 %23, 0
br i1 %24, label %25, label %26
25: ; preds = %20
br label %30
26: ; preds = %20
%27 = load i8*, i8** %2
%28 = load i8*, i8** %3
%29 = call i32 @show_binding(i8* %27, i8* %28)
br label %32
30: ; preds = %25, %8
%31 = call i32 @error_msg(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
br label %32
32: ; preds = %30, %26
ret void
}

LLVM IR (-O2):
@.str = [41 x i8] c"expecting 2 arguments (context and key)\0A\00"
define void @cmd_showbind(i8* %0) {
%2 = tail call i8* @strchr(i8* dereferenceable(1) %0, i8 signext 32)
%3 = icmp eq i8* %2, null
br i1 %3, label %11, label %4
4: ; preds = %1
store i8 0, i8* %2
br label %5
5: ; preds = %5, %4
%6 = phi i8* [ %2, %4 ], [ %7, %5 ]
%7 = getelementptr inbounds i8, i8* %6, i64 1
%8 = load i8, i8* %7
switch i8 %8, label %9 [
i8 32, label %5
i8 0, label %11
]
9: ; preds = %5
%10 = tail call i32 @show_binding(i8* %0, i8* %7)
br label %13
11: ; preds = %5, %1
%12 = tail call i32 @error_msg(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
br label %13
13: ; preds = %11, %9
ret void
}