#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 */
struct psmouse {
  int dummy;
};

/* Variables and functions */
scalar_t__ psmouse_command(struct psmouse *, unsigned char *, int);
scalar_t__ psmouse_sliced_command(struct psmouse *, unsigned char);
int ps2pp_cmd(struct psmouse *psmouse, unsigned char *param,
              unsigned char command) {
  if (psmouse_sliced_command(psmouse, command))
    return -1;
  if (psmouse_command(psmouse, param, 0x03eb))
    return -1;
  return 0;
}


x86 assembly (clang, -O0):
<ps2pp_cmd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dl,%al
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %al,-0x19(%rbp)
mov    -0x10(%rbp),%rdi
movzbl -0x19(%rbp),%esi
call   1040 <psmouse_sliced_command@plt>
cmp    $0x0,%rax
je     1158 <ps2pp_cmd+0x38>
movl   $0xffffffff,-0x4(%rbp)
jmp    1187 <ps2pp_cmd+0x67>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    $0x3eb,%edx
call   1030 <psmouse_command@plt>
cmp    $0x0,%rax
je     1180 <ps2pp_cmd+0x60>
movl   $0xffffffff,-0x4(%rbp)
jmp    1187 <ps2pp_cmd+0x67>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ps2pp_cmd>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
mov    %edx,%esi
call   1040 <psmouse_sliced_command@plt>
mov    %rax,%rcx
mov    $0xffffffff,%eax
test   %rcx,%rcx
jne    1153 <ps2pp_cmd+0x33>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x3eb,%edx
call   1030 <psmouse_command@plt>
neg    %rax
sbb    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.psmouse = type { i32 }
define i32 @ps2pp_cmd(%struct.psmouse* %0, i8* %1, i8 zeroext %2) {
%4 = alloca i32
%5 = alloca %struct.psmouse*
%6 = alloca i8*
%7 = alloca i8
store %struct.psmouse* %0, %struct.psmouse** %5
store i8* %1, i8** %6
store i8 %2, i8* %7
%8 = load %struct.psmouse*, %struct.psmouse** %5
%9 = load i8, i8* %7
%10 = call i64 @psmouse_sliced_command(%struct.psmouse* %8, i8 zeroext %9)
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %3
store i32 -1, i32* %4
br label %20
13: ; preds = %3
%14 = load %struct.psmouse*, %struct.psmouse** %5
%15 = load i8*, i8** %6
%16 = call i64 @psmouse_command(%struct.psmouse* %14, i8* %15, i32 1003)
%17 = icmp ne i64 %16, 0
br i1 %17, label %18, label %19
18: ; preds = %13
store i32 -1, i32* %4
br label %20
19: ; preds = %13
store i32 0, i32* %4
br label %20
20: ; preds = %19, %18, %12
%21 = load i32, i32* %4
ret i32 %21
}

LLVM IR (-O2):
%struct.psmouse = type { i32 }
define i32 @ps2pp_cmd(%struct.psmouse* %0, i8* %1, i8 zeroext %2) {
%4 = tail call i64 @psmouse_sliced_command(%struct.psmouse* %0, i8 zeroext %2)
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %10
6: ; preds = %3
%7 = tail call i64 @psmouse_command(%struct.psmouse* %0, i8* %1, i32 1003)
%8 = icmp ne i64 %7, 0
%9 = sext i1 %8 to i32
br label %10
10: ; preds = %6, %3
%11 = phi i32 [ -1, %3 ], [ %9, %6 ]
ret i32 %11
}