#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*/ check_executed_fifo(int /*<<< orphan*/ *, int, int);
int /*<<< orphan*/ check_rudimentary(int /*<<< orphan*/ *, int, int, int);
int /*<<< orphan*/ rewind(int /*<<< orphan*/ *);
int check_fifo(FILE *in, int queue_size, int workers, int iterations) {
  if (!check_rudimentary(in, workers, queue_size, iterations))
    return 0;
  rewind(in);
  if (!check_executed_fifo(in, workers, iterations))
    return 0;
  return 1;
}


x86 assembly (clang, -O0):
<check_fifo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    -0x1c(%rbp),%ecx
call   1050 <check_rudimentary@plt>
cmp    $0x0,%eax
jne    116c <check_fifo+0x3c>
movl   $0x0,-0x4(%rbp)
jmp    11a0 <check_fifo+0x70>
mov    -0x10(%rbp),%rdi
call   1030 <rewind@plt>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%esi
mov    -0x1c(%rbp),%edx
call   1040 <check_executed_fifo@plt>
cmp    $0x0,%eax
jne    1199 <check_fifo+0x69>
movl   $0x0,-0x4(%rbp)
jmp    11a0 <check_fifo+0x70>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_fifo>:
push   %rbp
push   %r14
push   %rbx
mov    %ecx,%r14d
mov    %edx,%ebp
mov    %esi,%edx
mov    %rdi,%rbx
mov    %ebp,%esi
call   1050 <check_rudimentary@plt>
test   %eax,%eax
je     1169 <check_fifo+0x39>
mov    %rbx,%rdi
call   1030 <rewind@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %r14d,%edx
call   1040 <check_executed_fifo@plt>
mov    %eax,%ecx
xor    %eax,%eax
test   %ecx,%ecx
setne  %al
jmp    116b <check_fifo+0x3b>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @check_fifo(i32* %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32* %0, i32** %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
%10 = load i32*, i32** %6
%11 = load i32, i32* %8
%12 = load i32, i32* %7
%13 = load i32, i32* %9
%14 = call i32 @check_rudimentary(i32* %10, i32 %11, i32 %12, i32 %13)
%15 = icmp ne i32 %14, 0
br i1 %15, label %17, label %16
16: ; preds = %4
store i32 0, i32* %5
br label %27
17: ; preds = %4
%18 = load i32*, i32** %6
%19 = call i32 @rewind(i32* %18)
%20 = load i32*, i32** %6
%21 = load i32, i32* %8
%22 = load i32, i32* %9
%23 = call i32 @check_executed_fifo(i32* %20, i32 %21, i32 %22)
%24 = icmp ne i32 %23, 0
br i1 %24, label %26, label %25
25: ; preds = %17
store i32 0, i32* %5
br label %27
26: ; preds = %17
store i32 1, i32* %5
br label %27
27: ; preds = %26, %25, %16
%28 = load i32, i32* %5
ret i32 %28
}

LLVM IR (-O2):
define i32 @check_fifo(i32* %0, i32 %1, i32 %2, i32 %3) {
%5 = tail call i32 @check_rudimentary(i32* %0, i32 %2, i32 %1, i32 %3)
%6 = icmp eq i32 %5, 0
br i1 %6, label %12, label %7
7: ; preds = %4
%8 = tail call i32 @rewind(i32* %0)
%9 = tail call i32 @check_executed_fifo(i32* %0, i32 %2, i32 %3)
%10 = icmp ne i32 %9, 0
%11 = zext i1 %10 to i32
br label %12
12: ; preds = %7, %4
%13 = phi i32 [ 0, %4 ], [ %11, %7 ]
ret i32 %13
}