#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*/ fprintf(int /*<<< orphan*/, char *, int, int);
int /*<<< orphan*/ stderr;
int check_resp(int ret, int expected_ret, int err, int expected_err) {
  if (ret != expected_ret) {
    fprintf(stderr, "Unexpected ret %d (%d expected)\n", ret, expected_ret);
    return -1;
  }
  if (err != expected_err) {
    fprintf(stderr, "Unexpected errno %d (%d expected)\n", err, expected_err);
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<check_resp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
je     1157 <check_resp+0x47>
mov    0x2ea9(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%edx
mov    -0xc(%rbp),%ecx
lea    0xeba(%rip),%rsi
call   1030 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1191 <check_resp+0x81>
mov    -0x10(%rbp),%eax
cmp    -0x14(%rbp),%eax
je     118a <check_resp+0x7a>
mov    0x2e76(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
lea    0xea8(%rip),%rsi
call   1030 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1191 <check_resp+0x81>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_resp>:
push   %rax
cmp    %esi,%edi
jne    112d <check_resp+0x1d>
xor    %eax,%eax
cmp    %ecx,%edx
je     1151 <check_resp+0x41>
mov    0x2ebe(%rip),%rax
mov    (%rax),%edi
lea    0xef6(%rip),%rsi
jmp    1147 <check_resp+0x37>
mov    %esi,%r8d
mov    %edi,%eax
mov    0x2ea7(%rip),%rcx
mov    (%rcx),%edi
lea    0xebe(%rip),%rsi
mov    %eax,%edx
mov    %r8d,%ecx
call   1030 <fprintf@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [33 x i8] c"Unexpected ret %d (%d expected)\0A\00"
@.str.1 = [35 x i8] c"Unexpected errno %d (%d expected)\0A\00"
define i32 @check_resp(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* %7
%12 = icmp ne i32 %10, %11
br i1 %12, label %13, label %18
13: ; preds = %4
%14 = load i32, i32* @stderr
%15 = load i32, i32* %6
%16 = load i32, i32* %7
%17 = call i32 @fprintf(i32 %14, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 %15, i32 %16)
store i32 -1, i32* %5
br label %28
18: ; preds = %4
%19 = load i32, i32* %8
%20 = load i32, i32* %9
%21 = icmp ne i32 %19, %20
br i1 %21, label %22, label %27
22: ; preds = %18
%23 = load i32, i32* @stderr
%24 = load i32, i32* %8
%25 = load i32, i32* %9
%26 = call i32 @fprintf(i32 %23, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i32 %24, i32 %25)
store i32 -1, i32* %5
br label %28
27: ; preds = %18
store i32 0, i32* %5
br label %28
28: ; preds = %27, %22, %13
%29 = load i32, i32* %5
ret i32 %29
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [33 x i8] c"Unexpected ret %d (%d expected)\0A\00"
@.str.1 = [35 x i8] c"Unexpected errno %d (%d expected)\0A\00"
define i32 @check_resp(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = icmp eq i32 %0, %1
br i1 %5, label %9, label %6
6: ; preds = %4
%7 = load i32, i32* @stderr
%8 = tail call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %1)
br label %14
9: ; preds = %4
%10 = icmp eq i32 %2, %3
br i1 %10, label %14, label %11
11: ; preds = %9
%12 = load i32, i32* @stderr
%13 = tail call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i32 %2, i32 %3)
br label %14
14: ; preds = %9, %11, %6
%15 = phi i32 [ -1, %6 ], [ -1, %11 ], [ 0, %9 ]
ret i32 %15
}