#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 /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int EXIT_SUCCESS;
int /*<<< orphan*/ check_fifo(int /*<<< orphan*/ *, int, int, int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ test_whatever(char *, int, int, int);
int test_fifo(int queue_size, int workers, int iterations) {
  FILE *out;
  test_whatever("-fifo", queue_size, workers, iterations);
  out = fopen("smp4.out", "r");
  do {
    if (!check_fifo(out, queue_size, workers, iterations))
      exit(EXIT_FAILURE);
  } while (0);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<test_fifo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    -0xc(%rbp),%ecx
lea    0xe9f(%rip),%rdi
call   1040 <test_whatever@plt>
lea    0xe99(%rip),%rdi
lea    0xe9b(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    -0xc(%rbp),%ecx
call   1030 <check_fifo@plt>
cmp    $0x0,%eax
jne    11a6 <test_fifo+0x66>
mov    0x2e41(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>
jmp    11ab <test_fifo+0x6b>
mov    0x2e26(%rip),%rax
mov    (%rax),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_fifo>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %esi,%ebp
mov    %edi,%ebx
lea    0xeae(%rip),%rdi
mov    %ebx,%esi
mov    %ebp,%edx
mov    %r14d,%ecx
call   1040 <test_whatever@plt>
lea    0xea1(%rip),%rdi
lea    0xea3(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,%rdi
mov    %ebx,%esi
mov    %ebp,%edx
mov    %r14d,%ecx
call   1030 <check_fifo@plt>
test   %eax,%eax
je     1192 <test_fifo+0x52>
mov    0x2e4d(%rip),%rax
mov    (%rax),%eax
pop    %rbx
pop    %r14
pop    %rbp
ret
mov    0x2e47(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"-fifo\00"
@.str.1 = [9 x i8] c"smp4.out\00"
@.str.2 = [2 x i8] c"r\00"
@EXIT_FAILURE = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @test_fifo(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32*
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i32, i32* %4
%9 = load i32, i32* %5
%10 = load i32, i32* %6
%11 = call i32 @test_whatever(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %8, i32 %9, i32 %10)
%12 = call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %12, i32** %7
br label %13
13: ; preds = %3
%14 = load i32*, i32** %7
%15 = load i32, i32* %4
%16 = load i32, i32* %5
%17 = load i32, i32* %6
%18 = call i32 @check_fifo(i32* %14, i32 %15, i32 %16, i32 %17)
%19 = icmp ne i32 %18, 0
br i1 %19, label %23, label %20
20: ; preds = %13
%21 = load i32, i32* @EXIT_FAILURE
%22 = call i32 @exit(i32 %21)
unreachable
23: ; preds = %13
br label %24
24: ; preds = %23
%25 = load i32, i32* @EXIT_SUCCESS
ret i32 %25
}

LLVM IR (-O2):
@.str = [6 x i8] c"-fifo\00"
@.str.1 = [9 x i8] c"smp4.out\00"
@.str.2 = [2 x i8] c"r\00"
@EXIT_FAILURE = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @test_fifo(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 @test_whatever(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %1, i32 %2)
%5 = tail call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%6 = tail call i32 @check_fifo(i32* %5, i32 %0, i32 %1, i32 %2)
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %3
%9 = load i32, i32* @EXIT_FAILURE
%10 = tail call i32 @exit(i32 %9)
unreachable
11: ; preds = %3
%12 = load i32, i32* @EXIT_SUCCESS
ret i32 %12
}