#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 */
typedef int /*<<< orphan*/ buf;

/* Variables and functions */
int BUFSIZ;
int /*<<< orphan*/ auth_finish();
int /*<<< orphan*/ errno;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ network_anticonfirm();
int /*<<< orphan*/ snprintf(char *, int, char *, char const *, ...);
char *strerror(int /*<<< orphan*/);
int /*<<< orphan*/ strlen(char *);
int /*<<< orphan*/ write(int, char *, int /*<<< orphan*/);
void fatal(int f, const char *msg, int syserr) {
  char buf[BUFSIZ];
  network_anticonfirm();
  if (!syserr) {
    snprintf(buf, sizeof(buf), "mrlogind: %s.\r\n", msg);
  } else {
    snprintf(buf, sizeof(buf), "mrlogind: %s: %s.\r\n", msg, strerror(errno));
  }
  write(f, buf, strlen(buf));
  auth_finish();
  exit(1);
}


x86 assembly (clang, -O0):
<fatal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    0x2e57(%rip),%rax
mov    (%rax),%eax
mov    %rax,-0x38(%rbp)
mov    %rsp,%rcx
mov    %rcx,-0x20(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x30(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x28(%rbp)
mov    $0x0,%al
call   1070 <network_anticonfirm@plt>
cmpl   $0x0,-0x14(%rbp)
jne    11e4 <fatal+0x74>
mov    -0x30(%rbp),%rdi
mov    -0x38(%rbp),%rax
mov    %eax,%esi
mov    -0x10(%rbp),%rcx
lea    0xe28(%rip),%rdx
mov    $0x0,%al
call   1060 <snprintf@plt>
jmp    121d <fatal+0xad>
mov    -0x38(%rbp),%rax
mov    %eax,-0x44(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    0x2dde(%rip),%rax
mov    (%rax),%edi
call   1090 <strerror@plt>
mov    -0x30(%rbp),%rdi
mov    -0x44(%rbp),%esi
mov    -0x40(%rbp),%rcx
mov    %rax,%r8
lea    0xdfa(%rip),%rdx
mov    $0x0,%al
call   1060 <snprintf@plt>
mov    -0x30(%rbp),%rdi
mov    -0x4(%rbp),%eax
mov    %eax,-0x48(%rbp)
call   1050 <strlen@plt>
mov    -0x48(%rbp),%edi
mov    -0x30(%rbp),%rsi
mov    %eax,%edx
call   1040 <write@plt>
mov    $0x0,%al
call   1030 <auth_finish@plt>
mov    $0x1,%edi
call   1080 <exit@plt>

x86 assembly (clang, -O2):
<fatal>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %edx,%r13d
mov    %rsi,%r15
mov    %edi,%r14d
mov    0x2e52(%rip),%rax
mov    (%rax),%r12d
mov    %rsp,%rbx
mov    %r12,%rax
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
xor    %eax,%eax
call   1070 <network_anticonfirm@plt>
test   %r13d,%r13d
jne    11ca <fatal+0x5a>
lea    0xe48(%rip),%rdx
mov    %rbx,%rdi
mov    %r12d,%esi
mov    %r15,%rcx
xor    %eax,%eax
call   1060 <snprintf@plt>
jmp    11f2 <fatal+0x82>
mov    0x2e07(%rip),%rax
mov    (%rax),%edi
call   1090 <strerror@plt>
lea    0xe31(%rip),%rdx
mov    %rbx,%rdi
mov    %r12d,%esi
mov    %r15,%rcx
mov    %rax,%r8
xor    %eax,%eax
call   1060 <snprintf@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    %r14d,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1040 <write@plt>
xor    %eax,%eax
call   1030 <auth_finish@plt>
mov    $0x1,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@BUFSIZ = global i32 0
@.str = [16 x i8] c"mrlogind: %s.\0D\0A\00"
@.str.1 = [20 x i8] c"mrlogind: %s: %s.\0D\0A\00"
@errno = global i32 0
define void @fatal(i32 %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i64
store i32 %0, i32* %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%9 = load i32, i32* @BUFSIZ
%10 = zext i32 %9 to i64
%11 = call i8* @llvm.stacksave()
store i8* %11, i8** %7
%12 = alloca i8, i64 %10
store i64 %10, i64* %8
%13 = call i32 (...) @network_anticonfirm()
%14 = load i32, i32* %6
%15 = icmp ne i32 %14, 0
br i1 %15, label %20, label %16
16: ; preds = %3
%17 = trunc i64 %10 to i32
%18 = load i8*, i8** %5
%19 = call i32 (i8*, i32, i8*, i8*, ...) @snprintf(i8* %12, i32 %17, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %18)
br label %26
20: ; preds = %3
%21 = trunc i64 %10 to i32
%22 = load i8*, i8** %5
%23 = load i32, i32* @errno
%24 = call i8* @strerror(i32 %23)
%25 = call i32 (i8*, i32, i8*, i8*, ...) @snprintf(i8* %12, i32 %21, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i8* %22, i8* %24)
br label %26
26: ; preds = %20, %16
%27 = load i32, i32* %4
%28 = call i32 @strlen(i8* %12)
%29 = call i32 @write(i32 %27, i8* %12, i32 %28)
%30 = call i32 (...) @auth_finish()
%31 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@BUFSIZ = global i32 0
@.str = [16 x i8] c"mrlogind: %s.\0D\0A\00"
@.str.1 = [20 x i8] c"mrlogind: %s: %s.\0D\0A\00"
@errno = global i32 0
define void @fatal(i32 %0, i8* %1, i32 %2) {
%4 = load i32, i32* @BUFSIZ
%5 = zext i32 %4 to i64
%6 = alloca i8, i64 %5
%7 = tail call i32 (...) @network_anticonfirm()
%8 = icmp eq i32 %2, 0
br i1 %8, label %9, label %11
9: ; preds = %3
%10 = call i32 (i8*, i32, i8*, i8*, ...) @snprintf(i8* %6, i32 %4, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %1)
br label %15
11: ; preds = %3
%12 = load i32, i32* @errno
%13 = tail call i8* @strerror(i32 %12)
%14 = call i32 (i8*, i32, i8*, i8*, ...) @snprintf(i8* %6, i32 %4, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i8* %1, i8* %13)
br label %15
15: ; preds = %11, %9
%16 = call i32 @strlen(i8* %6)
%17 = call i32 @write(i32 %0, i8* %6, i32 %16)
%18 = call i32 (...) @auth_finish()
%19 = call i32 @exit(i32 1)
unreachable
}