#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*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stderr;
char *strerror(int);
void hlp_report_error(int error_no) {
  if (error_no > 0)
    fprintf(stderr, "Error %d: %s\n", error_no, strerror(error_no));
  else
    fprintf(stderr, "Unknown error.\n");
}


x86 assembly (clang, -O0):
<hlp_report_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jle    116b <hlp_report_error+0x4b>
mov    0x2ea4(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <strerror@plt>
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%edx
mov    %rax,%rcx
lea    0xea1(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    1182 <hlp_report_error+0x62>
mov    0x2e6e(%rip),%rax
mov    (%rax),%edi
lea    0xe93(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hlp_report_error>:
push   %rbp
push   %rbx
push   %rax
mov    0x2eb6(%rip),%rax
mov    (%rax),%ebp
test   %edi,%edi
jle    1152 <hlp_report_error+0x32>
mov    %edi,%ebx
call   1040 <strerror@plt>
lea    0xec2(%rip),%rsi
mov    %ebp,%edi
mov    %ebx,%edx
mov    %rax,%rcx
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <fprintf@plt>
lea    0xeb5(%rip),%rsi
mov    %ebp,%edi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [14 x i8] c"Error %d: %s\0A\00"
@.str.1 = [16 x i8] c"Unknown error.\0A\00"
define void @hlp_report_error(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sgt i32 %3, 0
br i1 %4, label %5, label %11
5: ; preds = %1
%6 = load i32, i32* @stderr
%7 = load i32, i32* %2
%8 = load i32, i32* %2
%9 = call i8* @strerror(i32 %8)
%10 = call i32 (i32, i8*, ...) @fprintf(i32 %6, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %7, i8* %9)
br label %14
11: ; preds = %1
%12 = load i32, i32* @stderr
%13 = call i32 (i32, i8*, ...) @fprintf(i32 %12, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
br label %14
14: ; preds = %11, %5
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [14 x i8] c"Error %d: %s\0A\00"
@.str.1 = [16 x i8] c"Unknown error.\0A\00"
define void @hlp_report_error(i32 %0) {
%2 = icmp sgt i32 %0, 0
%3 = load i32, i32* @stderr
br i1 %2, label %4, label %7
4: ; preds = %1
%5 = tail call i8* @strerror(i32 %0)
%6 = tail call i32 (i32, i8*, ...) @fprintf(i32 %3, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %0, i8* %5)
br label %9
7: ; preds = %1
%8 = tail call i32 (i32, i8*, ...) @fprintf(i32 %3, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
br label %9
9: ; preds = %7, %4
ret void
}