#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 scalar_t__ off_t;

/* Variables and functions */
int /*<<< orphan*/ fflush(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, char *, char *);
int expect_off(off_t expected, off_t ret) {
  printf("\tOFF Expected %s, Got %s\n", expected == 0 ? "SUCCESS" : "FAILURE",
         ret >= 0 ? "SUCCESS" : "FAILURE");
  fflush(NULL);
  if ((ret == (off_t)-1) && expected == 0) {
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<expect_off>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rcx
lea    0xee7(%rip),%rsi
lea    0xed8(%rip),%rax
cmp    $0x0,%rcx
cmove  %rax,%rsi
mov    -0x18(%rbp),%rcx
lea    0xecd(%rip),%rdx
lea    0xebe(%rip),%rax
cmp    $0x0,%rcx
cmovge %rax,%rdx
lea    0xe95(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1040 <fflush@plt>
cmpq   $0xffffffffffffffff,-0x18(%rbp)
jne    119b <expect_off+0x7b>
cmpq   $0x0,-0x10(%rbp)
jne    119b <expect_off+0x7b>
movl   $0xffffffff,-0x4(%rbp)
jmp    11a2 <expect_off+0x82>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<expect_off>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
test   %rdi,%rdi
lea    0xeea(%rip),%rax
lea    0xeeb(%rip),%rdx
mov    %rdx,%rsi
cmove  %rax,%rsi
sete   %bpl
test   %rbx,%rbx
cmovns %rax,%rdx
lea    0xeb0(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <fflush@plt>
cmp    $0xffffffffffffffff,%rbx
sete   %al
and    %bpl,%al
movzbl %al,%eax
neg    %eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [26 x i8] c"\09OFF Expected %s, Got %s\0A\00"
@.str.1 = [8 x i8] c"SUCCESS\00"
@.str.2 = [8 x i8] c"FAILURE\00"
define i32 @expect_off(i64 %0, i64 %1) {
%3 = alloca i32
%4 = alloca i64
%5 = alloca i64
store i64 %0, i64* %4
store i64 %1, i64* %5
%6 = load i64, i64* %4
%7 = icmp eq i64 %6, 0
%8 = zext i1 %7 to i64
%9 = select i1 %7, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0)
%10 = load i64, i64* %5
%11 = icmp sge i64 %10, 0
%12 = zext i1 %11 to i64
%13 = select i1 %11, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0)
%14 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* %9, i8* %13)
%15 = call i32 @fflush(i32* null)
%16 = load i64, i64* %5
%17 = icmp eq i64 %16, -1
br i1 %17, label %18, label %22
18: ; preds = %2
%19 = load i64, i64* %4
%20 = icmp eq i64 %19, 0
br i1 %20, label %21, label %22
21: ; preds = %18
store i32 -1, i32* %3
br label %23
22: ; preds = %18, %2
store i32 0, i32* %3
br label %23
23: ; preds = %22, %21
%24 = load i32, i32* %3
ret i32 %24
}

LLVM IR (-O2):
@.str = [26 x i8] c"\09OFF Expected %s, Got %s\0A\00"
@.str.1 = [8 x i8] c"SUCCESS\00"
@.str.2 = [8 x i8] c"FAILURE\00"
define i32 @expect_off(i64 %0, i64 %1) {
%3 = icmp eq i64 %0, 0
%4 = select i1 %3, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0)
%5 = icmp sgt i64 %1, -1
%6 = select i1 %5, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0)
%7 = tail call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* %4, i8* %6)
%8 = tail call i32 @fflush(i32* null)
%9 = icmp eq i64 %1, -1
%10 = and i1 %3, %9
%11 = sext i1 %10 to i32
ret i32 %11
}