#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 synaptics_send_cmd(struct psmouse *psmouse, unsigned char c,
                       unsigned char *param) {
  if (psmouse_sliced_command(psmouse, c))
    return -1;
  if (psmouse_command(psmouse, param, 0x03e9))
    return -1;
  return 0;
}


x86 assembly (clang, -O0):
<synaptics_send_cmd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %sil,%al
mov    %rdi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
movzbl -0x11(%rbp),%esi
call   1040 <psmouse_sliced_command@plt>
cmp    $0x0,%rax
je     1159 <synaptics_send_cmd+0x39>
movl   $0xffffffff,-0x4(%rbp)
jmp    1188 <synaptics_send_cmd+0x68>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    $0x3e9,%edx
call   1030 <psmouse_command@plt>
cmp    $0x0,%rax
je     1181 <synaptics_send_cmd+0x61>
movl   $0xffffffff,-0x4(%rbp)
jmp    1188 <synaptics_send_cmd+0x68>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<synaptics_send_cmd>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rdi,%rbx
call   1040 <psmouse_sliced_command@plt>
mov    %rax,%rcx
mov    $0xffffffff,%eax
test   %rcx,%rcx
jne    1151 <synaptics_send_cmd+0x31>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x3e9,%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 @synaptics_send_cmd(%struct.psmouse* %0, i8 zeroext %1, i8* %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* %6
%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** %7
%16 = call i64 @psmouse_command(%struct.psmouse* %14, i8* %15, i32 1001)
%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 @synaptics_send_cmd(%struct.psmouse* %0, i8 zeroext %1, i8* %2) {
%4 = tail call i64 @psmouse_sliced_command(%struct.psmouse* %0, i8 zeroext %1)
%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* %2, i32 1001)
%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
}