#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*/ fputc(char, int /*<<< orphan*/);
int /*<<< orphan*/ fputs(char const *, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
char const *strerror(int /*<<< orphan*/);
void displayError(const char *on_what, int kill) {
  fputs(strerror(errno), stderr);
  fputs(": ", stderr);
  fputs(on_what, stderr);
  fputc('\n', stderr);
  if (kill)
    exit(1);
}


x86 assembly (clang, -O0):
<displayError>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    0x2e82(%rip),%rax
mov    (%rax),%edi
call   1060 <strerror@plt>
mov    %rax,%rdi
mov    0x2e79(%rip),%rax
mov    (%rax),%esi
call   1030 <fputs@plt>
mov    0x2e6b(%rip),%rax
mov    (%rax),%esi
lea    0xe82(%rip),%rdi
call   1030 <fputs@plt>
mov    -0x8(%rbp),%rdi
mov    0x2e52(%rip),%rax
mov    (%rax),%esi
call   1030 <fputs@plt>
mov    0x2e44(%rip),%rax
mov    (%rax),%esi
mov    $0xa,%edi
call   1040 <fputc@plt>
cmpl   $0x0,-0xc(%rbp)
je     11bc <displayError+0x7c>
mov    $0x1,%edi
call   1050 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<displayError>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%r14d
mov    %rdi,%rbx
mov    0x2e87(%rip),%rax
mov    (%rax),%edi
call   1060 <strerror@plt>
mov    0x2e81(%rip),%rbp
mov    0x0(%rbp),%esi
mov    %rax,%rdi
call   1030 <fputs@plt>
mov    0x0(%rbp),%esi
lea    0xe8c(%rip),%rdi
call   1030 <fputs@plt>
mov    0x0(%rbp),%esi
mov    %rbx,%rdi
call   1030 <fputs@plt>
mov    0x0(%rbp),%esi
mov    $0xa,%edi
call   1040 <fputc@plt>
test   %r14d,%r14d
jne    119b <displayError+0x5b>
pop    %rbx
pop    %r14
pop    %rbp
ret
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@errno = global i32 0
@stderr = global i32 0
@.str = [3 x i8] c": \00"
define void @displayError(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* @errno
%6 = call i8* @strerror(i32 %5)
%7 = load i32, i32* @stderr
%8 = call i32 @fputs(i8* %6, i32 %7)
%9 = load i32, i32* @stderr
%10 = call i32 @fputs(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = load i8*, i8** %3
%12 = load i32, i32* @stderr
%13 = call i32 @fputs(i8* %11, i32 %12)
%14 = load i32, i32* @stderr
%15 = call i32 @fputc(i8 signext 10, i32 %14)
%16 = load i32, i32* %4
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %2
%19 = call i32 @exit(i32 1)
unreachable
20: ; preds = %2
ret void
}

LLVM IR (-O2):
@errno = global i32 0
@stderr = global i32 0
@.str = [3 x i8] c": \00"
define void @displayError(i8* %0, i32 %1) {
%3 = load i32, i32* @errno
%4 = tail call i8* @strerror(i32 %3)
%5 = load i32, i32* @stderr
%6 = tail call i32 @fputs(i8* %4, i32 %5)
%7 = load i32, i32* @stderr
%8 = tail call i32 @fputs(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = load i32, i32* @stderr
%10 = tail call i32 @fputs(i8* %0, i32 %9)
%11 = load i32, i32* @stderr
%12 = tail call i32 @fputc(i8 signext 10, i32 %11)
%13 = icmp eq i32 %1, 0
br i1 %13, label %16, label %14
14: ; preds = %2
%15 = tail call i32 @exit(i32 1)
unreachable
16: ; preds = %2
ret void
}