#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 ksft_exit_fail();
int ksft_exit_pass();
int mqueue_lat_test();
int /*<<< orphan*/ printf(char *);
int main(int argc, char **argv) {
  int ret;
  printf("Mqueue latency :                          ");
  ret = mqueue_lat_test();
  if (ret < 0) {
    printf("[FAILED]\n");
    return ksft_exit_fail();
  }
  printf("[OK]\n");
  return ksft_exit_pass();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xea3(%rip),%rdi
call   1060 <printf@plt>
mov    $0x0,%al
call   1030 <mqueue_lat_test@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    1191 <main+0x51>
lea    0xeae(%rip),%rdi
call   1060 <printf@plt>
mov    $0x0,%al
call   1050 <ksft_exit_fail@plt>
mov    %eax,-0x4(%rbp)
jmp    11a7 <main+0x67>
lea    0xe9d(%rip),%rdi
call   1060 <printf@plt>
mov    $0x0,%al
call   1040 <ksft_exit_pass@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xea8(%rip),%rdi
call   1070 <printf@plt>
xor    %eax,%eax
call   1030 <mqueue_lat_test@plt>
test   %eax,%eax
js     117c <main+0x2c>
lea    0xebc(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
pop    %rcx
jmp    1050 <ksft_exit_pass@plt>
lea    0xead(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
pop    %rcx
jmp    1060 <ksft_exit_fail@plt>

LLVM IR (-O0):
@.str = [43 x i8] c"Mqueue latency : \00"
@.str.1 = [10 x i8] c"[FAILED]\0A\00"
@.str.2 = [6 x i8] c"[OK]\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0))
%8 = call i32 (...) @mqueue_lat_test()
store i32 %8, i32* %6
%9 = load i32, i32* %6
%10 = icmp slt i32 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %2
%12 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%13 = call i32 (...) @ksft_exit_fail()
store i32 %13, i32* %3
br label %17
14: ; preds = %2
%15 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%16 = call i32 (...) @ksft_exit_pass()
store i32 %16, i32* %3
br label %17
17: ; preds = %14, %11
%18 = load i32, i32* %3
ret i32 %18
}

LLVM IR (-O2):
@.str = [43 x i8] c"Mqueue latency : \00"
@str = [5 x i8] c"[OK]\00"
@str.3 = [9 x i8] c"[FAILED]\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 (...) @mqueue_lat_test()
%5 = icmp slt i32 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %2
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.3, i64 0, i64 0))
%8 = tail call i32 (...) @ksft_exit_fail()
br label %12
9: ; preds = %2
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0))
%11 = tail call i32 (...) @ksft_exit_pass()
br label %12
12: ; preds = %9, %6
%13 = phi i32 [ %8, %6 ], [ %11, %9 ]
ret i32 %13
}