#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 *, ...);
int /*<<< orphan*/ stderr;
char *strerror(int /*<<< orphan*/);
void bdes_err(int n, const char *s) {
  if (n > 0)
    (void)fprintf(stderr, "bdes (block %d): ", n);
  else
    (void)fprintf(stderr, "bdes: ");
  (void)fprintf(stderr, "%s\n", s ? s : strerror(errno));
  exit(1);
}


x86 assembly (clang, -O0):
<bdes_err>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x0,-0x4(%rbp)
jle    1168 <bdes_err+0x38>
mov    0x2e90(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%edx
lea    0xea4(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    117f <bdes_err+0x4f>
mov    0x2e71(%rip),%rax
mov    (%rax),%edi
lea    0xe9a(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2e5a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     11a3 <bdes_err+0x73>
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
jmp    11b5 <bdes_err+0x85>
mov    0x2e2e(%rip),%rax
mov    (%rax),%edi
call   1050 <strerror@plt>
mov    %rax,-0x20(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x20(%rbp),%rdx
lea    0xe56(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<bdes_err>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%edx
mov    0x2ea1(%rip),%rbp
mov    0x0(%rbp),%edi
test   %edx,%edx
jle    1156 <bdes_err+0x26>
lea    0xeb3(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
jmp    1164 <bdes_err+0x34>
lea    0xeb5(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    0x0(%rbp),%ebp
test   %rbx,%rbx
jne    117d <bdes_err+0x4d>
mov    0x2e65(%rip),%rax
mov    (%rax),%edi
call   1050 <strerror@plt>
mov    %rax,%rbx
lea    0xe95(%rip),%rsi
mov    %ebp,%edi
mov    %rbx,%rdx
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

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

LLVM IR (-O2):
@stderr = global i32 0
@.str = [18 x i8] c"bdes (block %d): \00"
@.str.1 = [7 x i8] c"bdes: \00"
@.str.2 = [4 x i8] c"%s\0A\00"
@errno = global i32 0
define void @bdes_err(i32 %0, i8* %1) {
%3 = icmp sgt i32 %0, 0
%4 = load i32, i32* @stderr
br i1 %3, label %5, label %7
5: ; preds = %2
%6 = tail call i32 (i32, i8*, ...) @fprintf(i32 %4, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %0)
br label %9
7: ; preds = %2
%8 = tail call i32 (i32, i8*, ...) @fprintf(i32 %4, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
br label %9
9: ; preds = %7, %5
%10 = load i32, i32* @stderr
%11 = icmp eq i8* %1, null
br i1 %11, label %12, label %15
12: ; preds = %9
%13 = load i32, i32* @errno
%14 = tail call i8* @strerror(i32 %13)
br label %15
15: ; preds = %9, %12
%16 = phi i8* [ %14, %12 ], [ %1, %9 ]
%17 = tail call i32 (i32, i8*, ...) @fprintf(i32 %10, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %16)
%18 = tail call i32 @exit(i32 1)
unreachable
}