#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*/ animCreateRot(int, int);
int /*<<< orphan*/ animDestroyRot(int /*<<< orphan*/);
int hidCodeFromString(char *);
int /*<<< orphan*/ hidMapRot(int, int /*<<< orphan*/);
int /*<<< orphan*/ scriptThrowException(char *);
void consoleCmdRmap(char *key, int axis1, int axis2) {
  int code = hidCodeFromString(key);
  if (!code) {
    scriptThrowException("Wrong key shortcut");
    return;
  }
  if ((axis1 < 1) || (axis2 < 1) || (axis1 == axis2)) {
    scriptThrowException("Wrong parameters");
    return;
  }
  animDestroyRot(hidMapRot(code, animCreateRot(axis1 - 1, axis2 - 1)));
}


x86 assembly (clang, -O0):
<consoleCmdRmap>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1060 <hidCodeFromString@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    1189 <consoleCmdRmap+0x39>
lea    0xe81(%rip),%rdi
call   1070 <scriptThrowException@plt>
jmp    11e2 <consoleCmdRmap+0x92>
cmpl   $0x1,-0xc(%rbp)
jl     11a9 <consoleCmdRmap+0x59>
cmpl   $0x1,-0x10(%rbp)
jl     11a9 <consoleCmdRmap+0x59>
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jne    11ba <consoleCmdRmap+0x6a>
lea    0xe63(%rip),%rdi
call   1070 <scriptThrowException@plt>
jmp    11e2 <consoleCmdRmap+0x92>
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%edi
sub    $0x1,%edi
mov    -0x10(%rbp),%esi
sub    $0x1,%esi
call   1040 <animCreateRot@plt>
mov    -0x18(%rbp),%edi
mov    %eax,%esi
call   1030 <hidMapRot@plt>
mov    %eax,%edi
call   1050 <animDestroyRot@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<consoleCmdRmap>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%ebx
mov    %esi,%ebp
call   1060 <hidCodeFromString@plt>
test   %eax,%eax
je     1194 <consoleCmdRmap+0x44>
cmp    %ebx,%ebp
je     119d <consoleCmdRmap+0x4d>
test   %ebp,%ebp
jle    119d <consoleCmdRmap+0x4d>
test   %ebx,%ebx
jle    119d <consoleCmdRmap+0x4d>
mov    %eax,%r14d
add    $0xffffffff,%ebp
add    $0xffffffff,%ebx
mov    %ebp,%edi
mov    %ebx,%esi
call   1040 <animCreateRot@plt>
mov    %r14d,%edi
mov    %eax,%esi
call   1030 <hidMapRot@plt>
mov    %eax,%edi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1050 <animDestroyRot@plt>
lea    0xe65(%rip),%rdi
jmp    11a4 <consoleCmdRmap+0x54>
lea    0xe6f(%rip),%rdi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1070 <scriptThrowException@plt>

LLVM IR (-O0):
@.str = [19 x i8] c"Wrong key shortcut\00"
@.str.1 = [17 x i8] c"Wrong parameters\00"
define void @consoleCmdRmap(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i8*, i8** %4
%9 = call i32 @hidCodeFromString(i8* %8)
store i32 %9, i32* %7
%10 = load i32, i32* %7
%11 = icmp ne i32 %10, 0
br i1 %11, label %14, label %12
12: ; preds = %3
%13 = call i32 @scriptThrowException(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
br label %35
14: ; preds = %3
%15 = load i32, i32* %5
%16 = icmp slt i32 %15, 1
br i1 %16, label %24, label %17
17: ; preds = %14
%18 = load i32, i32* %6
%19 = icmp slt i32 %18, 1
br i1 %19, label %24, label %20
20: ; preds = %17
%21 = load i32, i32* %5
%22 = load i32, i32* %6
%23 = icmp eq i32 %21, %22
br i1 %23, label %24, label %26
24: ; preds = %20, %17, %14
%25 = call i32 @scriptThrowException(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
br label %35
26: ; preds = %20
%27 = load i32, i32* %7
%28 = load i32, i32* %5
%29 = sub nsw i32 %28, 1
%30 = load i32, i32* %6
%31 = sub nsw i32 %30, 1
%32 = call i32 @animCreateRot(i32 %29, i32 %31)
%33 = call i32 @hidMapRot(i32 %27, i32 %32)
%34 = call i32 @animDestroyRot(i32 %33)
br label %35
35: ; preds = %26, %24, %12
ret void
}

LLVM IR (-O2):
@.str = [19 x i8] c"Wrong key shortcut\00"
@.str.1 = [17 x i8] c"Wrong parameters\00"
define void @consoleCmdRmap(i8* %0, i32 %1, i32 %2) {
%4 = tail call i32 @hidCodeFromString(i8* %0)
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %3
%7 = tail call i32 @scriptThrowException(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
br label %22
8: ; preds = %3
%9 = icmp slt i32 %1, 1
%10 = icmp slt i32 %2, 1
%11 = or i1 %9, %10
%12 = icmp eq i32 %1, %2
%13 = or i1 %12, %11
br i1 %13, label %14, label %16
14: ; preds = %8
%15 = tail call i32 @scriptThrowException(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
br label %22
16: ; preds = %8
%17 = add nsw i32 %1, -1
%18 = add nsw i32 %2, -1
%19 = tail call i32 @animCreateRot(i32 %17, i32 %18)
%20 = tail call i32 @hidMapRot(i32 %4, i32 %19)
%21 = tail call i32 @animDestroyRot(i32 %20)
br label %22
22: ; preds = %16, %14, %6
ret void
}