#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 errno;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stderr;
char *strerror(int);
void br_int_err_handler(char *where, char *problem) {
  int tmperrno = errno;
  fprintf(stderr, "error: ");
  if (tmperrno)
    fprintf(stderr, "[%s] ", strerror(tmperrno));
  if (problem)
    fprintf(stderr, "%s ", problem);
  if (where)
    fprintf(stderr, "in %s", where);
  if (!where && !problem && !tmperrno)
    fprintf(stderr, "(unknown error)");
  fprintf(stderr, "\n");
}


x86 assembly (clang, -O0):
<br_int_err_handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2ea1(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    0x2e9d(%rip),%rax
mov    (%rax),%edi
lea    0xeb4(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
cmpl   $0x0,-0x14(%rbp)
je     1185 <br_int_err_handler+0x65>
mov    0x2e7c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%edi
call   1040 <strerror@plt>
mov    -0x18(%rbp),%edi
mov    %rax,%rdx
lea    0xe8a(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
cmpq   $0x0,-0x10(%rbp)
je     11ab <br_int_err_handler+0x8b>
mov    0x2e49(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xe6a(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
cmpq   $0x0,-0x8(%rbp)
je     11d1 <br_int_err_handler+0xb1>
mov    0x2e23(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xe48(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
cmpq   $0x0,-0x8(%rbp)
jne    1208 <br_int_err_handler+0xe8>
cmpq   $0x0,-0x10(%rbp)
jne    1208 <br_int_err_handler+0xe8>
cmpl   $0x0,-0x14(%rbp)
jne    1208 <br_int_err_handler+0xe8>
mov    0x2de8(%rip),%rax
mov    (%rax),%edi
lea    0xe17(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2dd1(%rip),%rax
mov    (%rax),%edi
lea    0xe10(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<br_int_err_handler>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rsi,%rbx
mov    %rdi,%r14
mov    0x2ea3(%rip),%rax
mov    (%rax),%ebp
mov    0x2ea2(%rip),%r12
mov    (%r12),%edi
lea    0xeb7(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
test   %ebp,%ebp
je     1173 <br_int_err_handler+0x53>
mov    (%r12),%r15d
mov    %ebp,%edi
call   1040 <strerror@plt>
lea    0xea2(%rip),%rsi
mov    %r15d,%edi
mov    %rax,%rdx
xor    %eax,%eax
call   1030 <fprintf@plt>
test   %rbx,%rbx
je     118d <br_int_err_handler+0x6d>
mov    (%r12),%edi
lea    0xe8b(%rip),%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1030 <fprintf@plt>
test   %r14,%r14
je     11a9 <br_int_err_handler+0x89>
mov    (%r12),%edi
lea    0xe75(%rip),%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1030 <fprintf@plt>
jmp    11c4 <br_int_err_handler+0xa4>
test   %rbx,%rbx
jne    11c4 <br_int_err_handler+0xa4>
test   %ebp,%ebp
jne    11c4 <br_int_err_handler+0xa4>
mov    (%r12),%edi
lea    0xe5b(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%r12),%edi
lea    0xe59(%rip),%rsi
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@errno = global i32 0
@stderr = global i32 0
@.str = [8 x i8] c"error: \00"
@.str.1 = [6 x i8] c"[%s] \00"
@.str.2 = [4 x i8] c"%s \00"
@.str.3 = [6 x i8] c"in %s\00"
@.str.4 = [16 x i8] c"(unknown error)\00"
@.str.5 = [2 x i8] c"\0A\00"
define void @br_int_err_handler(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i32, i32* @errno
store i32 %6, i32* %5
%7 = load i32, i32* @stderr
%8 = call i32 (i32, i8*, ...) @fprintf(i32 %7, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%9 = load i32, i32* %5
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %16
11: ; preds = %2
%12 = load i32, i32* @stderr
%13 = load i32, i32* %5
%14 = call i8* @strerror(i32 %13)
%15 = call i32 (i32, i8*, ...) @fprintf(i32 %12, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %14)
br label %16
16: ; preds = %11, %2
%17 = load i8*, i8** %4
%18 = icmp ne i8* %17, null
br i1 %18, label %19, label %23
19: ; preds = %16
%20 = load i32, i32* @stderr
%21 = load i8*, i8** %4
%22 = call i32 (i32, i8*, ...) @fprintf(i32 %20, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %21)
br label %23
23: ; preds = %19, %16
%24 = load i8*, i8** %3
%25 = icmp ne i8* %24, null
br i1 %25, label %26, label %30
26: ; preds = %23
%27 = load i32, i32* @stderr
%28 = load i8*, i8** %3
%29 = call i32 (i32, i8*, ...) @fprintf(i32 %27, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8* %28)
br label %30
30: ; preds = %26, %23
%31 = load i8*, i8** %3
%32 = icmp ne i8* %31, null
br i1 %32, label %42, label %33
33: ; preds = %30
%34 = load i8*, i8** %4
%35 = icmp ne i8* %34, null
br i1 %35, label %42, label %36
36: ; preds = %33
%37 = load i32, i32* %5
%38 = icmp ne i32 %37, 0
br i1 %38, label %42, label %39
39: ; preds = %36
%40 = load i32, i32* @stderr
%41 = call i32 (i32, i8*, ...) @fprintf(i32 %40, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0))
br label %42
42: ; preds = %39, %36, %33, %30
%43 = load i32, i32* @stderr
%44 = call i32 (i32, i8*, ...) @fprintf(i32 %43, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@errno = global i32 0
@stderr = global i32 0
@.str = [8 x i8] c"error: \00"
@.str.1 = [6 x i8] c"[%s] \00"
@.str.2 = [4 x i8] c"%s \00"
@.str.3 = [6 x i8] c"in %s\00"
@.str.4 = [16 x i8] c"(unknown error)\00"
@.str.5 = [2 x i8] c"\0A\00"
define void @br_int_err_handler(i8* %0, i8* %1) {
%3 = load i32, i32* @errno
%4 = load i32, i32* @stderr
%5 = tail call i32 (i32, i8*, ...) @fprintf(i32 %4, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%6 = icmp ne i32 %3, 0
br i1 %6, label %7, label %11
7: ; preds = %2
%8 = load i32, i32* @stderr
%9 = tail call i8* @strerror(i32 %3)
%10 = tail call i32 (i32, i8*, ...) @fprintf(i32 %8, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %9)
br label %11
11: ; preds = %7, %2
%12 = icmp ne i8* %1, null
br i1 %12, label %13, label %16
13: ; preds = %11
%14 = load i32, i32* @stderr
%15 = tail call i32 (i32, i8*, ...) @fprintf(i32 %14, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %1)
br label %16
16: ; preds = %13, %11
%17 = icmp eq i8* %0, null
br i1 %17, label %21, label %18
18: ; preds = %16
%19 = load i32, i32* @stderr
%20 = tail call i32 (i32, i8*, ...) @fprintf(i32 %19, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8* %0)
br label %26
21: ; preds = %16
%22 = select i1 %12, i1 true, i1 %6
br i1 %22, label %26, label %23
23: ; preds = %21
%24 = load i32, i32* @stderr
%25 = tail call i32 (i32, i8*, ...) @fprintf(i32 %24, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0))
br label %26
26: ; preds = %18, %23, %21
%27 = load i32, i32* @stderr
%28 = tail call i32 (i32, i8*, ...) @fprintf(i32 %27, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
ret void
}