#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 */
#define EOVERFLOW 128
int errno;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int, ...);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ stderr;
int IO_error(char *str) {
  char *s;
  int err;
  s = (str) ? str : "";
  err = errno;
  switch (err) {
  case EOVERFLOW:
    fprintf(stderr,
            "Error(%d): %s: Buffer overflow, stream bandwidth to high\n", err,
            s);
    break;
  default:
    fprintf(stderr, "Error(%d): ", err);
    perror(s);
    break;
  }
  return err;
}


x86 assembly (clang, -O0):
<IO_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1144 <IO_error+0x24>
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
jmp    1154 <IO_error+0x34>
lea    0xeee(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    1154 <IO_error+0x34>
mov    -0x20(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    0x2e75(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
sub    $0x80,%eax
jne    119e <IO_error+0x7e>
jmp    117b <IO_error+0x5b>
mov    0x2e5e(%rip),%rax
mov    (%rax),%edi
mov    -0x14(%rbp),%edx
mov    -0x10(%rbp),%rcx
lea    0xe6e(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    11c1 <IO_error+0xa1>
mov    0x2e3b(%rip),%rax
mov    (%rax),%edi
mov    -0x14(%rbp),%edx
lea    0xe89(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x10(%rbp),%rdi
call   1040 <perror@plt>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<IO_error>:
push   %rbp
push   %rbx
push   %rax
test   %rdi,%rdi
lea    0xf0c(%rip),%rbx
cmovne %rdi,%rbx
mov    0x2ea0(%rip),%rax
mov    (%rax),%ebp
mov    0x2e9f(%rip),%rax
mov    (%rax),%edi
cmp    $0x80,%ebp
jne    116a <IO_error+0x4a>
lea    0xeae(%rip),%rsi
mov    $0x80,%edx
mov    %rbx,%rcx
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
lea    0xec9(%rip),%rsi
mov    %ebp,%edx
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    %rbx,%rdi
call   1040 <perror@plt>
jmp    1161 <IO_error+0x41>

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
@errno = global i32 0
@stderr = global i32 0
@.str.1 = [58 x i8] c"Error(%d): %s: Buffer overflow, stream bandwidth to high\0A\00"
@.str.2 = [12 x i8] c"Error(%d): \00"
define i32 @IO_error(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = icmp ne i8* %5, null
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = load i8*, i8** %2
br label %10
9: ; preds = %1
br label %10
10: ; preds = %9, %7
%11 = phi i8* [ %8, %7 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), %9 ]
store i8* %11, i8** %3
%12 = load i32, i32* @errno
store i32 %12, i32* %4
%13 = load i32, i32* %4
switch i32 %13, label %19 [
i32 128, label %14
]
14: ; preds = %10
%15 = load i32, i32* @stderr
%16 = load i32, i32* %4
%17 = load i8*, i8** %3
%18 = call i32 (i32, i8*, i32, ...) @fprintf(i32 %15, i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.1, i64 0, i64 0), i32 %16, i8* %17)
br label %25
19: ; preds = %10
%20 = load i32, i32* @stderr
%21 = load i32, i32* %4
%22 = call i32 (i32, i8*, i32, ...) @fprintf(i32 %20, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %21)
%23 = load i8*, i8** %3
%24 = call i32 @perror(i8* %23)
br label %25
25: ; preds = %19, %14
%26 = load i32, i32* %4
ret i32 %26
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
@errno = global i32 0
@stderr = global i32 0
@.str.1 = [58 x i8] c"Error(%d): %s: Buffer overflow, stream bandwidth to high\0A\00"
@.str.2 = [12 x i8] c"Error(%d): \00"
define i32 @IO_error(i8* %0) {
%2 = icmp eq i8* %0, null
%3 = select i1 %2, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8* %0
%4 = load i32, i32* @errno
%5 = icmp eq i32 %4, 128
%6 = load i32, i32* @stderr
br i1 %5, label %7, label %9
7: ; preds = %1
%8 = tail call i32 (i32, i8*, i32, ...) @fprintf(i32 %6, i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.1, i64 0, i64 0), i32 128, i8* %3)
br label %12
9: ; preds = %1
%10 = tail call i32 (i32, i8*, i32, ...) @fprintf(i32 %6, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %4)
%11 = tail call i32 @perror(i8* %3)
br label %12
12: ; preds = %9, %7
ret i32 %4
}