#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*/ exit(int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ snprintf(char *, int, char *, char *, char const *);
void error(const char *msg, int nr) {
  char errorbuffer[256];
  char formatnr[] = "%s: %i: %s";
  char formatnonr[] = "%s: %s";
  if (nr == 0) {
    snprintf(errorbuffer, 256, formatnonr, "voihttpd", msg);
    perror(errorbuffer);
  } else {
    snprintf(errorbuffer, 256, formatnr, "voihttpd", msg);
    perror(errorbuffer);
    exit(nr);
  }
}


x86 assembly (clang, -O0):
<error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x130,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    0xeb7(%rip),%rax
mov    %rax,-0x11b(%rbp)
mov    0xeb1(%rip),%ax
mov    %ax,-0x113(%rbp)
mov    0xea6(%rip),%al
mov    %al,-0x111(%rbp)
mov    0xe9b(%rip),%eax
mov    %eax,-0x122(%rbp)
mov    0xe92(%rip),%ax
mov    %ax,-0x11e(%rbp)
mov    0xe87(%rip),%al
mov    %al,-0x11c(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    11ce <error+0x9e>
lea    -0x110(%rbp),%rdi
lea    -0x122(%rbp),%rdx
mov    -0x8(%rbp),%r8
mov    $0x100,%esi
lea    0xe5a(%rip),%rcx
call   1030 <snprintf@plt>
lea    -0x110(%rbp),%rdi
call   1040 <perror@plt>
jmp    1205 <error+0xd5>
lea    -0x110(%rbp),%rdi
lea    -0x11b(%rbp),%rdx
mov    -0x8(%rbp),%r8
mov    $0x100,%esi
lea    0xe26(%rip),%rcx
call   1030 <snprintf@plt>
lea    -0x110(%rbp),%rdi
call   1040 <perror@plt>
mov    -0xc(%rbp),%edi
call   1050 <exit@plt>
add    $0x130,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<error>:
push   %r14
push   %rbx
sub    $0x128,%rsp
mov    %rdi,%r8
movabs $0x203a6925203a7325,%rax
69 3a 20
mov    %rax,0x10(%rsp)
movl   $0x732520,0x17(%rsp)
movl   $0x732520,0xb(%rsp)
movl   $0x203a7325,0x8(%rsp)
20
test   %esi,%esi
jne    1199 <error+0x69>
lea    0xea3(%rip),%rcx
lea    0x20(%rsp),%rbx
lea    0x8(%rsp),%rdx
mov    %rbx,%rdi
mov    $0x100,%esi
call   1030 <snprintf@plt>
mov    %rbx,%rdi
call   1040 <perror@plt>
add    $0x128,%rsp
pop    %rbx
pop    %r14
ret
mov    %esi,%ebx
lea    0xe70(%rip),%rcx
lea    0x20(%rsp),%r14
lea    0x10(%rsp),%rdx
mov    %r14,%rdi
mov    $0x100,%esi
call   1030 <snprintf@plt>
mov    %r14,%rdi
call   1040 <perror@plt>
mov    %ebx,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@__const.error.formatnr = [11 x i8] c"%s: %i: %s\00"
@__const.error.formatnonr = [7 x i8] c"%s: %s\00"
@.str = [9 x i8] c"voihttpd\00"
define void @error(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca [256 x i8]
%6 = alloca [11 x i8]
%7 = alloca [7 x i8]
store i8* %0, i8** %3
store i32 %1, i32* %4
%8 = bitcast [11 x i8]* %6 to i8*
%9 = bitcast [7 x i8]* %7 to i8*
%10 = load i32, i32* %4
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %19
12: ; preds = %2
%13 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%14 = getelementptr inbounds [7 x i8], [7 x i8]* %7, i64 0, i64 0
%15 = load i8*, i8** %3
%16 = call i32 @snprintf(i8* %13, i32 256, i8* %14, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %15)
%17 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%18 = call i32 @perror(i8* %17)
br label %28
19: ; preds = %2
%20 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%21 = getelementptr inbounds [11 x i8], [11 x i8]* %6, i64 0, i64 0
%22 = load i8*, i8** %3
%23 = call i32 @snprintf(i8* %20, i32 256, i8* %21, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %22)
%24 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%25 = call i32 @perror(i8* %24)
%26 = load i32, i32* %4
%27 = call i32 @exit(i32 %26)
unreachable
28: ; preds = %12
ret void
}

LLVM IR (-O2):
@__const.error.formatnr = [11 x i8] c"%s: %i: %s\00"
@__const.error.formatnonr = [7 x i8] c"%s: %s\00"
@.str = [9 x i8] c"voihttpd\00"
define void @error(i8* %0, i32 %1) {
%3 = alloca [256 x i8]
%4 = alloca [11 x i8]
%5 = alloca [7 x i8]
%6 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%7 = getelementptr inbounds [11 x i8], [11 x i8]* %4, i64 0, i64 0
%8 = getelementptr inbounds [7 x i8], [7 x i8]* %5, i64 0, i64 0
%9 = icmp eq i32 %1, 0
br i1 %9, label %10, label %13
10: ; preds = %2
%11 = call i32 @snprintf(i8* %6, i32 256, i8* %8, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %0)
%12 = call i32 @perror(i8* %6)
ret void
13: ; preds = %2
%14 = call i32 @snprintf(i8* %6, i32 256, i8* %7, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %0)
%15 = call i32 @perror(i8* %6)
%16 = call i32 @exit(i32 %1)
unreachable
}