#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 uinput_user_dev {
  int *absmin;
  int *absmax;
};

/* Variables and functions */
int /*<<< orphan*/ UI_SET_ABSBIT;
scalar_t__ ioctl(int, int /*<<< orphan*/, int);
int /*<<< orphan*/ perror(char *);
void ioctl_set_absbit(int fd, struct uinput_user_dev *p_uinp, int axis, int low,
                      int high) {
  {
    if (ioctl(fd, UI_SET_ABSBIT, axis))
      perror("ioctl "
             "UI_SET_ABSBIT"
             " "
             "axis");
  };
  p_uinp->absmin[axis] = low;
  p_uinp->absmax[axis] = high;
}


x86 assembly (clang, -O0):
<ioctl_set_absbit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2e95(%rip),%rax
mov    (%rax),%esi
mov    -0x14(%rbp),%edx
call   1030 <ioctl@plt>
cmp    $0x0,%rax
je     1163 <ioctl_set_absbit+0x43>
lea    0xea2(%rip),%rdi
call   1040 <perror@plt>
mov    -0x18(%rbp),%edx
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movslq -0x14(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x1c(%rbp),%edx
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movslq -0x14(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ioctl_set_absbit>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %r8d,%r14d
mov    %ecx,%r15d
mov    %edx,%ebp
mov    %rsi,%rbx
mov    0x2e9f(%rip),%rax
mov    (%rax),%esi
call   1030 <ioctl@plt>
test   %rax,%rax
jne    1162 <ioctl_set_absbit+0x42>
mov    (%rbx),%rax
movslq %ebp,%rcx
mov    %r15d,(%rax,%rcx,4)
mov    0x8(%rbx),%rax
mov    %r14d,(%rax,%rcx,4)
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xe97(%rip),%rdi
call   1040 <perror@plt>
jmp    1145 <ioctl_set_absbit+0x25>

LLVM IR (-O0):
%struct.uinput_user_dev = type { i32*, i32* }
@UI_SET_ABSBIT = global i32 0
@.str = [25 x i8] c"ioctl UI_SET_ABSBIT axis\00"
define void @ioctl_set_absbit(i32 %0, %struct.uinput_user_dev* %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca i32
%7 = alloca %struct.uinput_user_dev*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 %0, i32* %6
store %struct.uinput_user_dev* %1, %struct.uinput_user_dev** %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i32 %4, i32* %10
%11 = load i32, i32* %6
%12 = load i32, i32* @UI_SET_ABSBIT
%13 = load i32, i32* %8
%14 = call i64 @ioctl(i32 %11, i32 %12, i32 %13)
%15 = icmp ne i64 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %5
%17 = call i32 @perror(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
br label %18
18: ; preds = %16, %5
%19 = load i32, i32* %9
%20 = load %struct.uinput_user_dev*, %struct.uinput_user_dev** %7
%21 = getelementptr inbounds %struct.uinput_user_dev, %struct.uinput_user_dev* %20, i32 0, i32 0
%22 = load i32*, i32** %21
%23 = load i32, i32* %8
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i32, i32* %22, i64 %24
store i32 %19, i32* %25
%26 = load i32, i32* %10
%27 = load %struct.uinput_user_dev*, %struct.uinput_user_dev** %7
%28 = getelementptr inbounds %struct.uinput_user_dev, %struct.uinput_user_dev* %27, i32 0, i32 1
%29 = load i32*, i32** %28
%30 = load i32, i32* %8
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds i32, i32* %29, i64 %31
store i32 %26, i32* %32
ret void
}

LLVM IR (-O2):
%struct.uinput_user_dev = type { i32*, i32* }
@UI_SET_ABSBIT = global i32 0
@.str = [25 x i8] c"ioctl UI_SET_ABSBIT axis\00"
define void @ioctl_set_absbit(i32 %0, %struct.uinput_user_dev* nocapture %1, i32 %2, i32 %3, i32 %4) {
%6 = load i32, i32* @UI_SET_ABSBIT
%7 = tail call i64 @ioctl(i32 %0, i32 %6, i32 %2)
%8 = icmp eq i64 %7, 0
br i1 %8, label %11, label %9
9: ; preds = %5
%10 = tail call i32 @perror(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
br label %11
11: ; preds = %9, %5
%12 = getelementptr inbounds %struct.uinput_user_dev, %struct.uinput_user_dev* %1, i64 0, i32 0
%13 = load i32*, i32** %12
%14 = sext i32 %2 to i64
%15 = getelementptr inbounds i32, i32* %13, i64 %14
store i32 %3, i32* %15
%16 = getelementptr inbounds %struct.uinput_user_dev, %struct.uinput_user_dev* %1, i64 0, i32 1
%17 = load i32*, i32** %16
%18 = getelementptr inbounds i32, i32* %17, i64 %14
store i32 %4, i32* %18
ret void
}