#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 */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
typedef scalar_t__ uint64_t;
struct TYPE_2__ {
  size_t len;
  scalar_t__ start;
};
struct uffdio_register {
  int /*<<< orphan*/ mode;
  TYPE_1__ range;
};

/* Variables and functions */
int /*<<< orphan*/ UFFDIO_REGISTER_MODE_MISSING;
int /*<<< orphan*/ UFFDIO_UNREGISTER;
int /*<<< orphan*/ ioctl(int, int /*<<< orphan*/, struct uffdio_register *);
void UnregisterUserfaultFd(void *cut_start, size_t cut_length, int uffd) {
  struct uffdio_register uffd_unregister;
  uffd_unregister.range.start = (uint64_t)cut_start;
  uffd_unregister.range.len = cut_length;
  uffd_unregister.mode = UFFDIO_REGISTER_MODE_MISSING;
  ioctl(uffd, UFFDIO_UNREGISTER, &uffd_unregister);
}


x86 assembly (clang, -O0):
<UnregisterUserfaultFd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    0x2ea6(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x30(%rbp)
mov    -0x14(%rbp),%edi
mov    0x2e9f(%rip),%rax
mov    (%rax),%esi
lea    -0x30(%rbp),%rdx
call   1030 <ioctl@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<UnregisterUserfaultFd>:
sub    $0x18,%rsp
mov    %edx,%eax
mov    %rdi,0x10(%rsp)
mov    %rsi,0x8(%rsp)
mov    0x2eb9(%rip),%rcx
mov    (%rcx),%ecx
mov    %ecx,(%rsp)
mov    0x2eb5(%rip),%rcx
mov    (%rcx),%esi
mov    %rsp,%rdx
mov    %eax,%edi
call   1030 <ioctl@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.uffdio_register = type { i32, %struct.TYPE_2__ }
%struct.TYPE_2__ = type { i64, i64 }
@UFFDIO_REGISTER_MODE_MISSING = global i32 0
@UFFDIO_UNREGISTER = global i32 0
define void @UnregisterUserfaultFd(i8* %0, i64 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i32
%7 = alloca %struct.uffdio_register
store i8* %0, i8** %4
store i64 %1, i64* %5
store i32 %2, i32* %6
%8 = load i8*, i8** %4
%9 = ptrtoint i8* %8 to i64
%10 = getelementptr inbounds %struct.uffdio_register, %struct.uffdio_register* %7, i32 0, i32 1
%11 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %10, i32 0, i32 1
store i64 %9, i64* %11
%12 = load i64, i64* %5
%13 = getelementptr inbounds %struct.uffdio_register, %struct.uffdio_register* %7, i32 0, i32 1
%14 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %13, i32 0, i32 0
store i64 %12, i64* %14
%15 = load i32, i32* @UFFDIO_REGISTER_MODE_MISSING
%16 = getelementptr inbounds %struct.uffdio_register, %struct.uffdio_register* %7, i32 0, i32 0
store i32 %15, i32* %16
%17 = load i32, i32* %6
%18 = load i32, i32* @UFFDIO_UNREGISTER
%19 = call i32 @ioctl(i32 %17, i32 %18, %struct.uffdio_register* %7)
ret void
}

LLVM IR (-O2):
%struct.uffdio_register = type { i32, %struct.TYPE_2__ }
%struct.TYPE_2__ = type { i64, i64 }
@UFFDIO_REGISTER_MODE_MISSING = global i32 0
@UFFDIO_UNREGISTER = global i32 0
define void @UnregisterUserfaultFd(i8* %0, i64 %1, i32 %2) {
%4 = alloca %struct.uffdio_register
%5 = bitcast %struct.uffdio_register* %4 to i8*
%6 = ptrtoint i8* %0 to i64
%7 = getelementptr inbounds %struct.uffdio_register, %struct.uffdio_register* %4, i64 0, i32 1, i32 1
store i64 %6, i64* %7
%8 = getelementptr inbounds %struct.uffdio_register, %struct.uffdio_register* %4, i64 0, i32 1, i32 0
store i64 %1, i64* %8
%9 = load i32, i32* @UFFDIO_REGISTER_MODE_MISSING
%10 = getelementptr inbounds %struct.uffdio_register, %struct.uffdio_register* %4, i64 0, i32 0
store i32 %9, i32* %10
%11 = load i32, i32* @UFFDIO_UNREGISTER
%12 = call i32 @ioctl(i32 %2, i32 %11, %struct.uffdio_register* %4)
ret void
}