#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 */

/* Variables and functions */
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ ioctl_prep_cq(int, int, int, int);
int /*<<< orphan*/ printf(char *);
void test_prep_cq(int file_desc) {
  printf(
      "\nTEST 2.3.1: Preparing IO Contiguous CQ's with 100 elements each...\n");
  printf("\n\tCQ ID = 1\n");
  ioctl_prep_cq(file_desc, 1, 100, 1);
  printf("\nPress any key to continue..");
  getchar();
  printf("\n\tCQ ID = 2\n");
  ioctl_prep_cq(file_desc, 2, 100, 1);
  printf("\nPress any key to continue..");
  getchar();
  printf("\n\tCQ ID = 3\n");
  ioctl_prep_cq(file_desc, 3, 100, 1);
  printf("\nPress any key to continue..");
  getchar();
  printf("\n\tCQ ID = 4\n");
  ioctl_prep_cq(file_desc, 4, 100, 1);
  printf("\nPress any key to continue..");
  getchar();
  printf("\n\tCQ ID = 5\n");
  ioctl_prep_cq(file_desc, 5, 100, 1);
  printf("\nPress any key to continue..");
  getchar();
  printf("\n\tCQ ID = 6\n");
  ioctl_prep_cq(file_desc, 6, 100, 1);
  printf("\nPress any key to continue..");
  getchar();
  printf("\nTEST 2.3.2: Preparing Non-Contiguous IO CQ's with different "
         "sizes...\n");
  printf("\n\tCQ ID = 16\n");
  ioctl_prep_cq(file_desc, 16, 10, 0);
  printf("\nPress any key to continue..");
  getchar();
  printf("\n\tCQ ID = 15\n");
  ioctl_prep_cq(file_desc, 15, 15, 0);
  printf("\nPress any key to continue..");
  getchar();
}


x86 assembly (clang, -O0):
<test_prep_cq>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xebe(%rip),%rdi
call   1040 <printf@plt>
lea    0xef7(%rip),%rdi
call   1040 <printf@plt>
mov    -0x4(%rbp),%edi
mov    $0x1,%ecx
mov    $0x64,%edx
mov    %ecx,%esi
call   1030 <ioctl_prep_cq@plt>
lea    0xee4(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
lea    0xeee(%rip),%rdi
call   1040 <printf@plt>
mov    -0x4(%rbp),%edi
mov    $0x2,%esi
mov    $0x64,%edx
mov    $0x1,%ecx
call   1030 <ioctl_prep_cq@plt>
lea    0xeae(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
lea    0xec5(%rip),%rdi
call   1040 <printf@plt>
mov    -0x4(%rbp),%edi
mov    $0x3,%esi
mov    $0x64,%edx
mov    $0x1,%ecx
call   1030 <ioctl_prep_cq@plt>
lea    0xe78(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
lea    0xe9c(%rip),%rdi
call   1040 <printf@plt>
mov    -0x4(%rbp),%edi
mov    $0x4,%esi
mov    $0x64,%edx
mov    $0x1,%ecx
call   1030 <ioctl_prep_cq@plt>
lea    0xe42(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
lea    0xe73(%rip),%rdi
call   1040 <printf@plt>
mov    -0x4(%rbp),%edi
mov    $0x5,%esi
mov    $0x64,%edx
mov    $0x1,%ecx
call   1030 <ioctl_prep_cq@plt>
lea    0xe0c(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
lea    0xe4a(%rip),%rdi
call   1040 <printf@plt>
mov    -0x4(%rbp),%edi
mov    $0x6,%esi
mov    $0x64,%edx
mov    $0x1,%ecx
call   1030 <ioctl_prep_cq@plt>
lea    0xdd6(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
lea    0xe21(%rip),%rdi
call   1040 <printf@plt>
lea    0xe5c(%rip),%rdi
call   1040 <printf@plt>
mov    -0x4(%rbp),%edi
mov    $0x10,%esi
mov    $0xa,%edx
xor    %ecx,%ecx
call   1030 <ioctl_prep_cq@plt>
lea    0xd97(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
lea    0xe37(%rip),%rdi
call   1040 <printf@plt>
mov    -0x4(%rbp),%edi
mov    $0xf,%edx
xor    %ecx,%ecx
mov    %edx,%esi
call   1030 <ioctl_prep_cq@plt>
lea    0xd67(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_prep_cq>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
lea    0xed0(%rip),%rdi
call   1030 <puts@plt>
lea    0xf08(%rip),%rdi
call   1030 <puts@plt>
mov    %ebx,%edi
mov    $0x1,%esi
mov    $0x64,%edx
mov    $0x1,%ecx
call   1040 <ioctl_prep_cq@plt>
lea    0xe85(%rip),%r14
mov    %r14,%rdi
call   1050 <printf@plt>
xor    %eax,%eax
call   1060 <getchar@plt>
lea    0xedc(%rip),%rdi
call   1030 <puts@plt>
mov    %ebx,%edi
mov    $0x2,%esi
mov    $0x64,%edx
mov    $0x1,%ecx
call   1040 <ioctl_prep_cq@plt>
mov    %r14,%rdi
call   1050 <printf@plt>
xor    %eax,%eax
call   1060 <getchar@plt>
lea    0xeb7(%rip),%rdi
call   1030 <puts@plt>
mov    %ebx,%edi
mov    $0x3,%esi
mov    $0x64,%edx
mov    $0x1,%ecx
call   1040 <ioctl_prep_cq@plt>
mov    %r14,%rdi
call   1050 <printf@plt>
xor    %eax,%eax
call   1060 <getchar@plt>
lea    0xe92(%rip),%rdi
call   1030 <puts@plt>
mov    %ebx,%edi
mov    $0x4,%esi
mov    $0x64,%edx
mov    $0x1,%ecx
call   1040 <ioctl_prep_cq@plt>
mov    %r14,%rdi
call   1050 <printf@plt>
xor    %eax,%eax
call   1060 <getchar@plt>
lea    0xe6d(%rip),%rdi
call   1030 <puts@plt>
mov    %ebx,%edi
mov    $0x5,%esi
mov    $0x64,%edx
mov    $0x1,%ecx
call   1040 <ioctl_prep_cq@plt>
mov    %r14,%rdi
call   1050 <printf@plt>
xor    %eax,%eax
call   1060 <getchar@plt>
lea    0xe48(%rip),%rdi
call   1030 <puts@plt>
mov    %ebx,%edi
mov    $0x6,%esi
mov    $0x64,%edx
mov    $0x1,%ecx
call   1040 <ioctl_prep_cq@plt>
mov    %r14,%rdi
call   1050 <printf@plt>
xor    %eax,%eax
call   1060 <getchar@plt>
lea    0xe23(%rip),%rdi
call   1030 <puts@plt>
lea    0xe5d(%rip),%rdi
call   1030 <puts@plt>
mov    %ebx,%edi
mov    $0x10,%esi
mov    $0xa,%edx
xor    %ecx,%ecx
call   1040 <ioctl_prep_cq@plt>
mov    %r14,%rdi
call   1050 <printf@plt>
xor    %eax,%eax
call   1060 <getchar@plt>
lea    0xe3c(%rip),%rdi
call   1030 <puts@plt>
mov    %ebx,%edi
mov    $0xf,%esi
mov    $0xf,%edx
xor    %ecx,%ecx
call   1040 <ioctl_prep_cq@plt>
mov    %r14,%rdi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1060 <getchar@plt>

LLVM IR (-O0):
@.str = [69 x i8] c"\0ATEST 2.3.1: Preparing IO Contiguous CQ's with 100 elements each...\0A\00"
@.str.1 = [13 x i8] c"\0A\09CQ ID = 1\0A\00"
@.str.2 = [29 x i8] c"\0APress any key to continue..\00"
@.str.3 = [13 x i8] c"\0A\09CQ ID = 2\0A\00"
@.str.4 = [13 x i8] c"\0A\09CQ ID = 3\0A\00"
@.str.5 = [13 x i8] c"\0A\09CQ ID = 4\0A\00"
@.str.6 = [13 x i8] c"\0A\09CQ ID = 5\0A\00"
@.str.7 = [13 x i8] c"\0A\09CQ ID = 6\0A\00"
@.str.8 = [71 x i8] c"\0ATEST 2.3.2: Preparing Non-Contiguous IO CQ's with different sizes...\0A\00"
@.str.9 = [14 x i8] c"\0A\09CQ ID = 16\0A\00"
@.str.10 = [14 x i8] c"\0A\09CQ ID = 15\0A\00"
define void @test_prep_cq(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @printf(i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%5 = load i32, i32* %2
%6 = call i32 @ioctl_prep_cq(i32 %5, i32 1, i32 100, i32 1)
%7 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 (...) @getchar()
%9 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
%10 = load i32, i32* %2
%11 = call i32 @ioctl_prep_cq(i32 %10, i32 2, i32 100, i32 1)
%12 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
%13 = call i32 (...) @getchar()
%14 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0))
%15 = load i32, i32* %2
%16 = call i32 @ioctl_prep_cq(i32 %15, i32 3, i32 100, i32 1)
%17 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
%18 = call i32 (...) @getchar()
%19 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0))
%20 = load i32, i32* %2
%21 = call i32 @ioctl_prep_cq(i32 %20, i32 4, i32 100, i32 1)
%22 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
%23 = call i32 (...) @getchar()
%24 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0))
%25 = load i32, i32* %2
%26 = call i32 @ioctl_prep_cq(i32 %25, i32 5, i32 100, i32 1)
%27 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
%28 = call i32 (...) @getchar()
%29 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0))
%30 = load i32, i32* %2
%31 = call i32 @ioctl_prep_cq(i32 %30, i32 6, i32 100, i32 1)
%32 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
%33 = call i32 (...) @getchar()
%34 = call i32 @printf(i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str.8, i64 0, i64 0))
%35 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.9, i64 0, i64 0))
%36 = load i32, i32* %2
%37 = call i32 @ioctl_prep_cq(i32 %36, i32 16, i32 10, i32 0)
%38 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
%39 = call i32 (...) @getchar()
%40 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.10, i64 0, i64 0))
%41 = load i32, i32* %2
%42 = call i32 @ioctl_prep_cq(i32 %41, i32 15, i32 15, i32 0)
%43 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
%44 = call i32 (...) @getchar()
ret void
}

LLVM IR (-O2):
@.str.2 = [29 x i8] c"\0APress any key to continue..\00"
@str = [68 x i8] c"\0ATEST 2.3.1: Preparing IO Contiguous CQ's with 100 elements each...\00"
@str.11 = [12 x i8] c"\0A\09CQ ID = 1\00"
@str.12 = [12 x i8] c"\0A\09CQ ID = 2\00"
@str.13 = [12 x i8] c"\0A\09CQ ID = 3\00"
@str.14 = [12 x i8] c"\0A\09CQ ID = 4\00"
@str.15 = [12 x i8] c"\0A\09CQ ID = 5\00"
@str.16 = [12 x i8] c"\0A\09CQ ID = 6\00"
@str.17 = [70 x i8] c"\0ATEST 2.3.2: Preparing Non-Contiguous IO CQ's with different sizes...\00"
@str.18 = [13 x i8] c"\0A\09CQ ID = 16\00"
@str.19 = [13 x i8] c"\0A\09CQ ID = 15\00"
define void @test_prep_cq(i32 %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([68 x i8], [68 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.11, i64 0, i64 0))
%4 = tail call i32 @ioctl_prep_cq(i32 %0, i32 1, i32 100, i32 1)
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
%6 = tail call i32 (...) @getchar()
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.12, i64 0, i64 0))
%8 = tail call i32 @ioctl_prep_cq(i32 %0, i32 2, i32 100, i32 1)
%9 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
%10 = tail call i32 (...) @getchar()
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.13, i64 0, i64 0))
%12 = tail call i32 @ioctl_prep_cq(i32 %0, i32 3, i32 100, i32 1)
%13 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
%14 = tail call i32 (...) @getchar()
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.14, i64 0, i64 0))
%16 = tail call i32 @ioctl_prep_cq(i32 %0, i32 4, i32 100, i32 1)
%17 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
%18 = tail call i32 (...) @getchar()
%19 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.15, i64 0, i64 0))
%20 = tail call i32 @ioctl_prep_cq(i32 %0, i32 5, i32 100, i32 1)
%21 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
%22 = tail call i32 (...) @getchar()
%23 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.16, i64 0, i64 0))
%24 = tail call i32 @ioctl_prep_cq(i32 %0, i32 6, i32 100, i32 1)
%25 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
%26 = tail call i32 (...) @getchar()
%27 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([70 x i8], [70 x i8]* @str.17, i64 0, i64 0))
%28 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.18, i64 0, i64 0))
%29 = tail call i32 @ioctl_prep_cq(i32 %0, i32 16, i32 10, i32 0)
%30 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
%31 = tail call i32 (...) @getchar()
%32 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.19, i64 0, i64 0))
%33 = tail call i32 @ioctl_prep_cq(i32 %0, i32 15, i32 15, i32 0)
%34 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
%35 = tail call i32 (...) @getchar()
ret void
}