#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 errno;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printErr(char *);
int /*<<< orphan*/ sprintf(char *, char *, char const *, char *);
char *strerror(int);
void fatalSys(char const *str) {
  char buf[1024];
  int i = errno;
  sprintf(buf, "%.256s: %.256s", str, strerror(i));
  printErr(buf);
  sprintf(buf, "pppoe-discovery: %.256s: %.256s", str, strerror(i));
  exit(1);
}


x86 assembly (clang, -O0):
<fatalSys>:
push   %rbp
mov    %rsp,%rbp
sub    $0x440,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2e8a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x414(%rbp)
lea    -0x410(%rbp),%rax
mov    %rax,-0x438(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x430(%rbp)
mov    -0x414(%rbp),%edi
call   1060 <strerror@plt>
mov    -0x438(%rbp),%rdi
mov    -0x430(%rbp),%rdx
mov    %rax,%rcx
lea    0xe77(%rip),%rsi
call   1040 <sprintf@plt>
lea    -0x410(%rbp),%rdi
call   1030 <printErr@plt>
lea    -0x410(%rbp),%rax
mov    %rax,-0x428(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x420(%rbp)
mov    -0x414(%rbp),%edi
call   1060 <strerror@plt>
mov    -0x428(%rbp),%rdi
mov    -0x420(%rbp),%rdx
mov    %rax,%rcx
lea    0xe19(%rip),%rsi
call   1040 <sprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<fatalSys>:
push   %rbp
push   %r14
push   %rbx
sub    $0x400,%rsp
mov    %rdi,%rbx
mov    0x2e8b(%rip),%rax
mov    (%rax),%ebp
mov    %ebp,%edi
call   1060 <strerror@plt>
lea    0xeac(%rip),%rsi
mov    %rsp,%r14
mov    %r14,%rdi
mov    %rbx,%rdx
mov    %rax,%rcx
call   1040 <sprintf@plt>
mov    %r14,%rdi
call   1030 <printErr@plt>
mov    %ebp,%edi
call   1060 <strerror@plt>
lea    0xe74(%rip),%rsi
mov    %r14,%rdi
mov    %rbx,%rdx
mov    %rax,%rcx
call   1040 <sprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@errno = global i32 0
@.str = [15 x i8] c"%.256s: %.256s\00"
@.str.1 = [32 x i8] c"pppoe-discovery: %.256s: %.256s\00"
define void @fatalSys(i8* %0) {
%2 = alloca i8*
%3 = alloca [1024 x i8]
%4 = alloca i32
store i8* %0, i8** %2
%5 = load i32, i32* @errno
store i32 %5, i32* %4
%6 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%7 = load i8*, i8** %2
%8 = load i32, i32* %4
%9 = call i8* @strerror(i32 %8)
%10 = call i32 @sprintf(i8* %6, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %7, i8* %9)
%11 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%12 = call i32 @printErr(i8* %11)
%13 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%14 = load i8*, i8** %2
%15 = load i32, i32* %4
%16 = call i8* @strerror(i32 %15)
%17 = call i32 @sprintf(i8* %13, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i8* %14, i8* %16)
%18 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@errno = global i32 0
@.str = [15 x i8] c"%.256s: %.256s\00"
@.str.1 = [32 x i8] c"pppoe-discovery: %.256s: %.256s\00"
define void @fatalSys(i8* %0) {
%2 = alloca [1024 x i8]
%3 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%4 = load i32, i32* @errno
%5 = tail call i8* @strerror(i32 %4)
%6 = call i32 @sprintf(i8* %3, i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %5)
%7 = call i32 @printErr(i8* %3)
%8 = call i8* @strerror(i32 %4)
%9 = call i32 @sprintf(i8* %3, i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i8* %0, i8* %8)
%10 = call i32 @exit(i32 1)
unreachable
}