#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 */
typedef int uint32_t;

/* Variables and functions */
int /*<<< orphan*/ ioctl_reap_cq(int, int, int, int, int /*<<< orphan*/);
int ioctl_reap_inquiry(int, int);
int /*<<< orphan*/ ioctl_tst_ring_dbl(int, int);
int /*<<< orphan*/ send_nvme_read(int, int, void *);
int /*<<< orphan*/ send_nvme_read_mb(int, int, void *, int);
int /*<<< orphan*/ test_meta_buf(int, int);
void test_contig_threeio_irq(int fd, void *addr0, void *addr1, void *addr2) {
  static uint32_t meta_index = 10;
  int num, sq_id, assoc_cq_id;
  sq_id = 32;
  assoc_cq_id = 21;
  test_meta_buf(fd, meta_index);
  send_nvme_read_mb(fd, sq_id, addr0, meta_index);
  ioctl_tst_ring_dbl(fd, sq_id);
  sq_id = 33;
  assoc_cq_id = 22;
  send_nvme_read(fd, sq_id, addr1);
  ioctl_tst_ring_dbl(fd, sq_id);
  sq_id = 34;
  assoc_cq_id = 23;
  num = ioctl_reap_inquiry(fd, assoc_cq_id);
  send_nvme_read(fd, sq_id, addr2);
  ioctl_tst_ring_dbl(fd, sq_id);
  while (ioctl_reap_inquiry(fd, assoc_cq_id) != num + 1)
    ;
  ioctl_reap_cq(fd, assoc_cq_id, 1, 16, 0);
  meta_index++;
}


x86 assembly (clang, -O0):
<test_contig_threeio_irq>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movl   $0x20,-0x28(%rbp)
movl   $0x15,-0x2c(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2ec2(%rip),%esi
call   1060 <test_meta_buf@plt>
mov    -0x4(%rbp),%edi
mov    -0x28(%rbp),%esi
mov    -0x10(%rbp),%rdx
mov    0x2ead(%rip),%ecx
call   1070 <send_nvme_read_mb@plt>
mov    -0x4(%rbp),%edi
mov    -0x28(%rbp),%esi
call   1080 <ioctl_tst_ring_dbl@plt>
movl   $0x21,-0x28(%rbp)
movl   $0x16,-0x2c(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x28(%rbp),%esi
mov    -0x18(%rbp),%rdx
call   1030 <send_nvme_read@plt>
mov    -0x4(%rbp),%edi
mov    -0x28(%rbp),%esi
call   1080 <ioctl_tst_ring_dbl@plt>
movl   $0x22,-0x28(%rbp)
movl   $0x17,-0x2c(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x2c(%rbp),%esi
call   1040 <ioctl_reap_inquiry@plt>
mov    %eax,-0x24(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x28(%rbp),%esi
mov    -0x20(%rbp),%rdx
call   1030 <send_nvme_read@plt>
mov    -0x4(%rbp),%edi
mov    -0x28(%rbp),%esi
call   1080 <ioctl_tst_ring_dbl@plt>
mov    -0x4(%rbp),%edi
mov    -0x2c(%rbp),%esi
call   1040 <ioctl_reap_inquiry@plt>
mov    -0x24(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
je     122f <test_contig_threeio_irq+0xcf>
jmp    1211 <test_contig_threeio_irq+0xb1>
mov    -0x4(%rbp),%edi
mov    -0x2c(%rbp),%esi
mov    $0x1,%edx
mov    $0x10,%ecx
xor    %r8d,%r8d
call   1050 <ioctl_reap_cq@plt>
mov    0x2e03(%rip),%eax
add    $0x1,%eax
mov    %eax,0x2dfa(%rip)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_contig_threeio_irq>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rsi,%rbp
mov    %edi,%ebx
mov    0x2ed8(%rip),%esi
call   1060 <test_meta_buf@plt>
mov    0x2ecd(%rip),%ecx
mov    %ebx,%edi
mov    $0x20,%esi
mov    %rbp,%rdx
call   1070 <send_nvme_read_mb@plt>
mov    %ebx,%edi
mov    $0x20,%esi
call   1080 <ioctl_tst_ring_dbl@plt>
mov    %ebx,%edi
mov    $0x21,%esi
mov    %r15,%rdx
call   1030 <send_nvme_read@plt>
mov    %ebx,%edi
mov    $0x21,%esi
call   1080 <ioctl_tst_ring_dbl@plt>
mov    %ebx,%edi
mov    $0x17,%esi
call   1040 <ioctl_reap_inquiry@plt>
mov    %eax,%ebp
mov    %ebx,%edi
mov    $0x22,%esi
mov    %r14,%rdx
call   1030 <send_nvme_read@plt>
mov    %ebx,%edi
mov    $0x22,%esi
call   1080 <ioctl_tst_ring_dbl@plt>
add    $0x1,%ebp
cs nopw 0x0(%rax,%rax,1)
nop
mov    %ebx,%edi
mov    $0x17,%esi
call   1040 <ioctl_reap_inquiry@plt>
cmp    %ebp,%eax
jne    11f0 <test_contig_threeio_irq+0x90>
mov    %ebx,%edi
mov    $0x17,%esi
mov    $0x1,%edx
mov    $0x10,%ecx
xor    %r8d,%r8d
call   1050 <ioctl_reap_cq@plt>
addl   $0x1,0x2e30(%rip)
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@test_contig_threeio_irq.meta_index = internal global i32 10
define void @test_contig_threeio_irq(i32 %0, i8* %1, i8* %2, i8* %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i32 %0, i32* %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i8* %3, i8** %8
store i32 32, i32* %10
store i32 21, i32* %11
%12 = load i32, i32* %5
%13 = load i32, i32* @test_contig_threeio_irq.meta_index
%14 = call i32 @test_meta_buf(i32 %12, i32 %13)
%15 = load i32, i32* %5
%16 = load i32, i32* %10
%17 = load i8*, i8** %6
%18 = load i32, i32* @test_contig_threeio_irq.meta_index
%19 = call i32 @send_nvme_read_mb(i32 %15, i32 %16, i8* %17, i32 %18)
%20 = load i32, i32* %5
%21 = load i32, i32* %10
%22 = call i32 @ioctl_tst_ring_dbl(i32 %20, i32 %21)
store i32 33, i32* %10
store i32 22, i32* %11
%23 = load i32, i32* %5
%24 = load i32, i32* %10
%25 = load i8*, i8** %7
%26 = call i32 @send_nvme_read(i32 %23, i32 %24, i8* %25)
%27 = load i32, i32* %5
%28 = load i32, i32* %10
%29 = call i32 @ioctl_tst_ring_dbl(i32 %27, i32 %28)
store i32 34, i32* %10
store i32 23, i32* %11
%30 = load i32, i32* %5
%31 = load i32, i32* %11
%32 = call i32 @ioctl_reap_inquiry(i32 %30, i32 %31)
store i32 %32, i32* %9
%33 = load i32, i32* %5
%34 = load i32, i32* %10
%35 = load i8*, i8** %8
%36 = call i32 @send_nvme_read(i32 %33, i32 %34, i8* %35)
%37 = load i32, i32* %5
%38 = load i32, i32* %10
%39 = call i32 @ioctl_tst_ring_dbl(i32 %37, i32 %38)
br label %40
40: ; preds = %47, %4
%41 = load i32, i32* %5
%42 = load i32, i32* %11
%43 = call i32 @ioctl_reap_inquiry(i32 %41, i32 %42)
%44 = load i32, i32* %9
%45 = add nsw i32 %44, 1
%46 = icmp ne i32 %43, %45
br i1 %46, label %47, label %48
47: ; preds = %40
br label %40
48: ; preds = %40
%49 = load i32, i32* %5
%50 = load i32, i32* %11
%51 = call i32 @ioctl_reap_cq(i32 %49, i32 %50, i32 1, i32 16, i32 0)
%52 = load i32, i32* @test_contig_threeio_irq.meta_index
%53 = add nsw i32 %52, 1
store i32 %53, i32* @test_contig_threeio_irq.meta_index
ret void
}

LLVM IR (-O2):
@test_contig_threeio_irq.meta_index = internal unnamed_addr global i32 10
define void @test_contig_threeio_irq(i32 %0, i8* %1, i8* %2, i8* %3) {
%5 = load i32, i32* @test_contig_threeio_irq.meta_index
%6 = tail call i32 @test_meta_buf(i32 %0, i32 %5)
%7 = load i32, i32* @test_contig_threeio_irq.meta_index
%8 = tail call i32 @send_nvme_read_mb(i32 %0, i32 32, i8* %1, i32 %7)
%9 = tail call i32 @ioctl_tst_ring_dbl(i32 %0, i32 32)
%10 = tail call i32 @send_nvme_read(i32 %0, i32 33, i8* %2)
%11 = tail call i32 @ioctl_tst_ring_dbl(i32 %0, i32 33)
%12 = tail call i32 @ioctl_reap_inquiry(i32 %0, i32 23)
%13 = tail call i32 @send_nvme_read(i32 %0, i32 34, i8* %3)
%14 = tail call i32 @ioctl_tst_ring_dbl(i32 %0, i32 34)
%15 = add nsw i32 %12, 1
br label %16
16: ; preds = %16, %4
%17 = tail call i32 @ioctl_reap_inquiry(i32 %0, i32 23)
%18 = icmp eq i32 %17, %15
br i1 %18, label %19, label %16
19: ; preds = %16
%20 = tail call i32 @ioctl_reap_cq(i32 %0, i32 23, i32 1, i32 16, i32 0)
%21 = load i32, i32* @test_contig_threeio_irq.meta_index
%22 = add nsw i32 %21, 1
store i32 %22, i32* @test_contig_threeio_irq.meta_index
ret void
}