#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*/ errno;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, char *, int,
                           char *);
int /*<<< orphan*/ stderr;
char *strerror(int /*<<< orphan*/);
int x_int(int err, int res, char *str, char *file, int line) {
  if (res == err) {
    fprintf(stderr, "%s error (%s, %d): %s\n", str, file, line,
            strerror(errno));
    exit(1);
  }
  return (res);
}


x86 assembly (clang, -O0):
<x_int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jne    11ae <x_int+0x7e>
mov    0x2e83(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x34(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    0x2e59(%rip),%rax
mov    (%rax),%edi
call   1050 <strerror@plt>
mov    -0x34(%rbp),%edi
mov    -0x30(%rbp),%rdx
mov    -0x28(%rbp),%rcx
mov    -0x20(%rbp),%r8d
mov    %rax,%r9
lea    0xe61(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>
mov    -0x8(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<x_int>:
cmp    %edi,%esi
je     1137 <x_int+0x7>
mov    %esi,%eax
ret
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %r8d,%r14d
mov    %rcx,%rbx
mov    %rdx,%rbp
mov    0x2e92(%rip),%rax
mov    (%rax),%r15d
mov    0x2e80(%rip),%rax
mov    (%rax),%edi
call   1050 <strerror@plt>
lea    0xe9a(%rip),%rsi
mov    %r15d,%edi
mov    %rbp,%rdx
mov    %rbx,%rcx
mov    %r14d,%r8d
mov    %rax,%r9
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [23 x i8] c"%s error (%s, %d): %s\0A\00"
@errno = global i32 0
define i32 @x_int(i32 %0, i32 %1, i8* %2, i8* %3, i32 %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i32
store i32 %0, i32* %6
store i32 %1, i32* %7
store i8* %2, i8** %8
store i8* %3, i8** %9
store i32 %4, i32* %10
%11 = load i32, i32* %7
%12 = load i32, i32* %6
%13 = icmp eq i32 %11, %12
br i1 %13, label %14, label %23
14: ; preds = %5
%15 = load i32, i32* @stderr
%16 = load i8*, i8** %8
%17 = load i8*, i8** %9
%18 = load i32, i32* %10
%19 = load i32, i32* @errno
%20 = call i8* @strerror(i32 %19)
%21 = call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %16, i8* %17, i32 %18, i8* %20)
%22 = call i32 @exit(i32 1)
unreachable
23: ; preds = %5
%24 = load i32, i32* %7
ret i32 %24
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [23 x i8] c"%s error (%s, %d): %s\0A\00"
@errno = global i32 0
define i32 @x_int(i32 %0, i32 returned %1, i8* %2, i8* %3, i32 %4) {
%6 = icmp eq i32 %1, %0
br i1 %6, label %7, label %13
7: ; preds = %5
%8 = load i32, i32* @stderr
%9 = load i32, i32* @errno
%10 = tail call i8* @strerror(i32 %9)
%11 = tail call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %2, i8* %3, i32 %4, i8* %10)
%12 = tail call i32 @exit(i32 1)
unreachable
13: ; preds = %5
ret i32 %1
}