#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 */
char *consoleTranslToScriptExpr(char *);
int hidCodeFromString(char *);
int /*<<< orphan*/ hidMap(int, char *);
int /*<<< orphan*/ scriptThrowException(char *);
void consoleCmdMap(char *key, char *cmd_or_expr) {
  int code = hidCodeFromString(key);
  if (!code) {
    scriptThrowException("Wrong key shortcut");
    return;
  }
  char *expr = consoleTranslToScriptExpr(cmd_or_expr);
  if (!expr)
    expr = cmd_or_expr;
  hidMap(code, expr);
}


x86 assembly (clang, -O0):
<consoleCmdMap>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <hidCodeFromString@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    1177 <consoleCmdMap+0x37>
lea    0xe93(%rip),%rdi
call   1060 <scriptThrowException@plt>
jmp    11a3 <consoleCmdMap+0x63>
mov    -0x10(%rbp),%rdi
call   1040 <consoleTranslToScriptExpr@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1197 <consoleCmdMap+0x57>
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x20(%rbp),%rsi
call   1030 <hidMap@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<consoleCmdMap>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
call   1050 <hidCodeFromString@plt>
test   %eax,%eax
je     1170 <consoleCmdMap+0x30>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1040 <consoleTranslToScriptExpr@plt>
test   %rax,%rax
cmovne %rax,%rbx
mov    %ebp,%edi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <hidMap@plt>
lea    0xe89(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1060 <scriptThrowException@plt>

LLVM IR (-O0):
@.str = [19 x i8] c"Wrong key shortcut\00"
define void @consoleCmdMap(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %3
%8 = call i32 @hidCodeFromString(i8* %7)
store i32 %8, i32* %5
%9 = load i32, i32* %5
%10 = icmp ne i32 %9, 0
br i1 %10, label %13, label %11
11: ; preds = %2
%12 = call i32 @scriptThrowException(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
br label %24
13: ; preds = %2
%14 = load i8*, i8** %4
%15 = call i8* @consoleTranslToScriptExpr(i8* %14)
store i8* %15, i8** %6
%16 = load i8*, i8** %6
%17 = icmp ne i8* %16, null
br i1 %17, label %20, label %18
18: ; preds = %13
%19 = load i8*, i8** %4
store i8* %19, i8** %6
br label %20
20: ; preds = %18, %13
%21 = load i32, i32* %5
%22 = load i8*, i8** %6
%23 = call i32 @hidMap(i32 %21, i8* %22)
br label %24
24: ; preds = %20, %11
ret void
}

LLVM IR (-O2):
@.str = [19 x i8] c"Wrong key shortcut\00"
define void @consoleCmdMap(i8* %0, i8* %1) {
%3 = tail call i32 @hidCodeFromString(i8* %0)
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @scriptThrowException(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
br label %12
7: ; preds = %2
%8 = tail call i8* @consoleTranslToScriptExpr(i8* %1)
%9 = icmp eq i8* %8, null
%10 = select i1 %9, i8* %1, i8* %8
%11 = tail call i32 @hidMap(i32 %3, i8* %10)
br label %12
12: ; preds = %7, %5
ret void
}