#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 aufs_ibusy {
  scalar_t__ ino;
  scalar_t__ h_ino;
  int /*<<< orphan*/ bindex;
};

/* Variables and functions */
int /*<<< orphan*/ AUFS_CTL_IBUSY;
scalar_t__ AUFS_ROOT_INO;
scalar_t__ errno;
int ioctl(int, int /*<<< orphan*/, struct aufs_ibusy *);
int /*<<< orphan*/ printf(char *, unsigned long long, int /*<<< orphan*/,
                          unsigned long long);
scalar_t__ strtoul(char *, int /*<<< orphan*/ *, int /*<<< orphan*/);
int do_ibusy(char *inum, int fd, struct aufs_ibusy *ibusy) {
  int err;
  err = -1;
  errno = 0;
  ibusy->ino = strtoul(inum, NULL, 0);
  if (errno)
    goto out;
  err = 0;
  if (ibusy->ino == AUFS_ROOT_INO)
    goto out;
  err = ioctl(fd, AUFS_CTL_IBUSY, ibusy);
  if (!err && ibusy->h_ino)
    printf("i%llu\tb%d\thi%llu\n", (unsigned long long)ibusy->ino,
           ibusy->bindex, (unsigned long long)ibusy->h_ino);
out:
  return err;
}


x86 assembly (clang, -O0):
<do_ibusy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0xffffffff,-0x1c(%rbp)
mov    0x2e7f(%rip),%rax
movq   $0x0,(%rax)
mov    -0x8(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1050 <strtoul@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    0x2e58(%rip),%rax
cmpq   $0x0,(%rax)
je     1187 <do_ibusy+0x57>
jmp    1202 <do_ibusy+0xd2>
movl   $0x0,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    0x2e4c(%rip),%rcx
cmp    (%rcx),%rax
jne    11aa <do_ibusy+0x7a>
jmp    1202 <do_ibusy+0xd2>
mov    -0xc(%rbp),%edi
mov    0x2e2c(%rip),%rax
mov    (%rax),%esi
mov    -0x18(%rbp),%rdx
call   1040 <ioctl@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jne    11fd <do_ibusy+0xcd>
mov    -0x18(%rbp),%rax
cmpq   $0x0,0x8(%rax)
je     11fd <do_ibusy+0xcd>
mov    -0x18(%rbp),%rax
mov    (%rax),%rsi
mov    -0x18(%rbp),%rax
mov    0x10(%rax),%edx
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%rcx
lea    0xe08(%rip),%rdi
call   1030 <printf@plt>
jmp    1202 <do_ibusy+0xd2>
mov    -0x1c(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_ibusy>:
push   %rbp
push   %r14
push   %rbx
mov    %rdx,%rbx
mov    %esi,%r14d
mov    0x2e8f(%rip),%rbp
movq   $0x0,0x0(%rbp)
xor    %esi,%esi
xor    %edx,%edx
call   1050 <strtoul@plt>
mov    %rax,%rcx
mov    %rax,(%rbx)
mov    $0xffffffff,%eax
cmpq   $0x0,0x0(%rbp)
jne    118c <do_ibusy+0x5c>
mov    0x2e7d(%rip),%rax
cmp    (%rax),%rcx
jne    1174 <do_ibusy+0x44>
xor    %eax,%eax
jmp    118c <do_ibusy+0x5c>
mov    0x2e65(%rip),%rax
mov    (%rax),%esi
mov    %r14d,%edi
mov    %rbx,%rdx
call   1040 <ioctl@plt>
test   %eax,%eax
je     1191 <do_ibusy+0x61>
pop    %rbx
pop    %r14
pop    %rbp
ret
mov    0x8(%rbx),%rcx
test   %rcx,%rcx
je     1170 <do_ibusy+0x40>
mov    (%rbx),%rsi
mov    0x10(%rbx),%edx
lea    0xe59(%rip),%rdi
call   1030 <printf@plt>
jmp    1170 <do_ibusy+0x40>

LLVM IR (-O0):
%struct.aufs_ibusy = type { i64, i64, i32 }
@errno = global i64 0
@AUFS_ROOT_INO = global i64 0
@AUFS_CTL_IBUSY = global i32 0
@.str = [18 x i8] c"i%llu\09b%d\09hi%llu\0A\00"
define i32 @do_ibusy(i8* %0, i32 %1, %struct.aufs_ibusy* %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca %struct.aufs_ibusy*
%7 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store %struct.aufs_ibusy* %2, %struct.aufs_ibusy** %6
store i32 -1, i32* %7
store i64 0, i64* @errno
%8 = load i8*, i8** %4
%9 = call i64 @strtoul(i8* %8, i32* null, i32 0)
%10 = load %struct.aufs_ibusy*, %struct.aufs_ibusy** %6
%11 = getelementptr inbounds %struct.aufs_ibusy, %struct.aufs_ibusy* %10, i32 0, i32 0
store i64 %9, i64* %11
%12 = load i64, i64* @errno
%13 = icmp ne i64 %12, 0
br i1 %13, label %14, label %15
14: ; preds = %3
br label %46
15: ; preds = %3
store i32 0, i32* %7
%16 = load %struct.aufs_ibusy*, %struct.aufs_ibusy** %6
%17 = getelementptr inbounds %struct.aufs_ibusy, %struct.aufs_ibusy* %16, i32 0, i32 0
%18 = load i64, i64* %17
%19 = load i64, i64* @AUFS_ROOT_INO
%20 = icmp eq i64 %18, %19
br i1 %20, label %21, label %22
21: ; preds = %15
br label %46
22: ; preds = %15
%23 = load i32, i32* %5
%24 = load i32, i32* @AUFS_CTL_IBUSY
%25 = load %struct.aufs_ibusy*, %struct.aufs_ibusy** %6
%26 = call i32 @ioctl(i32 %23, i32 %24, %struct.aufs_ibusy* %25)
store i32 %26, i32* %7
%27 = load i32, i32* %7
%28 = icmp ne i32 %27, 0
br i1 %28, label %45, label %29
29: ; preds = %22
%30 = load %struct.aufs_ibusy*, %struct.aufs_ibusy** %6
%31 = getelementptr inbounds %struct.aufs_ibusy, %struct.aufs_ibusy* %30, i32 0, i32 1
%32 = load i64, i64* %31
%33 = icmp ne i64 %32, 0
br i1 %33, label %34, label %45
34: ; preds = %29
%35 = load %struct.aufs_ibusy*, %struct.aufs_ibusy** %6
%36 = getelementptr inbounds %struct.aufs_ibusy, %struct.aufs_ibusy* %35, i32 0, i32 0
%37 = load i64, i64* %36
%38 = load %struct.aufs_ibusy*, %struct.aufs_ibusy** %6
%39 = getelementptr inbounds %struct.aufs_ibusy, %struct.aufs_ibusy* %38, i32 0, i32 2
%40 = load i32, i32* %39
%41 = load %struct.aufs_ibusy*, %struct.aufs_ibusy** %6
%42 = getelementptr inbounds %struct.aufs_ibusy, %struct.aufs_ibusy* %41, i32 0, i32 1
%43 = load i64, i64* %42
%44 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i64 %37, i32 %40, i64 %43)
br label %45
45: ; preds = %34, %29, %22
br label %46
46: ; preds = %45, %21, %14
%47 = load i32, i32* %7
ret i32 %47
}

LLVM IR (-O2):
%struct.aufs_ibusy = type { i64, i64, i32 }
@errno = global i64 0
@AUFS_ROOT_INO = global i64 0
@AUFS_CTL_IBUSY = global i32 0
@.str = [18 x i8] c"i%llu\09b%d\09hi%llu\0A\00"
define i32 @do_ibusy(i8* nocapture %0, i32 %1, %struct.aufs_ibusy* %2) {
store i64 0, i64* @errno
%4 = tail call i64 @strtoul(i8* nocapture %0, i32* null, i32 0)
%5 = getelementptr inbounds %struct.aufs_ibusy, %struct.aufs_ibusy* %2, i64 0, i32 0
store i64 %4, i64* %5
%6 = load i64, i64* @errno
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %24
8: ; preds = %3
%9 = load i64, i64* @AUFS_ROOT_INO
%10 = icmp eq i64 %4, %9
br i1 %10, label %24, label %11
11: ; preds = %8
%12 = load i32, i32* @AUFS_CTL_IBUSY
%13 = tail call i32 @ioctl(i32 %1, i32 %12, %struct.aufs_ibusy* %2)
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %24
15: ; preds = %11
%16 = getelementptr inbounds %struct.aufs_ibusy, %struct.aufs_ibusy* %2, i64 0, i32 1
%17 = load i64, i64* %16
%18 = icmp eq i64 %17, 0
br i1 %18, label %24, label %19
19: ; preds = %15
%20 = load i64, i64* %5
%21 = getelementptr inbounds %struct.aufs_ibusy, %struct.aufs_ibusy* %2, i64 0, i32 2
%22 = load i32, i32* %21
%23 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i64 %20, i32 %22, i64 %17)
br label %24
24: ; preds = %11, %15, %19, %8, %3
%25 = phi i32 [ -1, %3 ], [ 0, %8 ], [ %13, %11 ], [ 0, %19 ], [ 0, %15 ]
ret i32 %25
}