#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 */
scalar_t__ EAGAIN;
scalar_t__ errno;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int, char *, scalar_t__,
                           char *);
int /*<<< orphan*/ stderr;
char *strerror(scalar_t__);
void read_err(int cpu, char *ifn) {
  if (errno != EAGAIN)
    fprintf(stderr, "Thread %d failed read of %s: %d/%s\n", cpu, ifn, errno,
            strerror(errno));
}


x86 assembly (clang, -O0):
<read_err>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2ea2(%rip),%rax
mov    (%rax),%rax
mov    0x2e88(%rip),%rcx
cmp    (%rcx),%rax
je     119d <read_err+0x7d>
mov    0x2e90(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x28(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    0x2e6e(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
mov    0x2e60(%rip),%rax
mov    (%rax),%rdi
call   1040 <strerror@plt>
mov    -0x28(%rbp),%edi
mov    -0x24(%rbp),%edx
mov    -0x20(%rbp),%rcx
mov    -0x18(%rbp),%r8
mov    %rax,%r9
lea    0xe68(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_err>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    0x2eaa(%rip),%rax
mov    (%rax),%rbx
mov    0x2e90(%rip),%rax
cmp    (%rax),%rbx
jne    1148 <read_err+0x28>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %rsi,%r14
mov    %edi,%ebp
mov    0x2e8c(%rip),%rax
mov    (%rax),%r15d
mov    %rbx,%rdi
call   1040 <strerror@plt>
lea    0xe9a(%rip),%rsi
mov    %r15d,%edi
mov    %ebp,%edx
mov    %r14,%rcx
mov    %rbx,%r8
mov    %rax,%r9
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <fprintf@plt>

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

LLVM IR (-O2):
@errno = global i64 0
@EAGAIN = global i64 0
@stderr = global i32 0
@.str = [36 x i8] c"Thread %d failed read of %s: %d/%s\0A\00"
define void @read_err(i32 %0, i8* %1) {
%3 = load i64, i64* @errno
%4 = load i64, i64* @EAGAIN
%5 = icmp eq i64 %3, %4
br i1 %5, label %10, label %6
6: ; preds = %2
%7 = load i32, i32* @stderr
%8 = tail call i8* @strerror(i64 %3)
%9 = tail call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %0, i8* %1, i64 %3, i8* %8)
br label %10
10: ; preds = %6, %2
ret void
}