#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_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *);
void error(int error_num) {
  switch (error_num) {
  case 1:
    printf("\ncannot open configuration file - server terminated\n");
    break;
  case 2:
    printf("\nparameter problem - server terminated\n");
    break;
  case 3:
    printf("\ncannot run server - wrong number of command line arguments\n");
    printf("Usage: nwserver [-p <Port_number>] [-d <Document_Root>]\n");
    break;
  case 4:
    printf("\ncannot run server - wrong command line argument\n");
    printf("Usage: nwserver [-p <Port_number>] [-d <Document_Root>]\n");
    break;
  case 5:
    perror("nws - socket");
    break;
  case 6:
    perror("nws - bind");
    break;
  case 7:
    perror("nws - listen");
    break;
  case 8:
    perror("nws - signal");
    break;
  case 9:
    perror("nws - nws.log missing");
    break;
  case 10:
    perror("nws - setsockopt");
    break;
  case 11:
    perror("nws - exec");
    break;
  case 12:
    perror("nws - error.htm missing");
    break;
  default:
    printf("\nwrong error number - internal error - server terminated\n");
    break;
  };
  exit(EXIT_FAILURE);
}


x86 assembly (clang, -O0):
<error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0xb,%eax
ja     1248 <error+0x118>
mov    -0x10(%rbp),%rax
lea    0xea5(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xec5(%rip),%rdi
call   1030 <printf@plt>
jmp    1254 <error+0x124>
lea    0xee9(%rip),%rdi
call   1030 <printf@plt>
jmp    1254 <error+0x124>
lea    0xf00(%rip),%rdi
call   1030 <printf@plt>
lea    0xf31(%rip),%rdi
call   1030 <printf@plt>
jmp    1254 <error+0x124>
lea    0xf59(%rip),%rdi
call   1030 <printf@plt>
lea    0xf14(%rip),%rdi
call   1030 <printf@plt>
jmp    1254 <error+0x124>
lea    0xf6e(%rip),%rdi
call   1040 <perror@plt>
jmp    1254 <error+0x124>
lea    0xf6a(%rip),%rdi
call   1040 <perror@plt>
jmp    1254 <error+0x124>
lea    0xf64(%rip),%rdi
call   1040 <perror@plt>
jmp    1254 <error+0x124>
lea    0xf60(%rip),%rdi
call   1040 <perror@plt>
jmp    1254 <error+0x124>
lea    0xf5c(%rip),%rdi
call   1040 <perror@plt>
jmp    1254 <error+0x124>
lea    0xf61(%rip),%rdi
call   1040 <perror@plt>
jmp    1254 <error+0x124>
lea    0xf61(%rip),%rdi
call   1040 <perror@plt>
jmp    1254 <error+0x124>
lea    0xf5b(%rip),%rdi
call   1040 <perror@plt>
jmp    1254 <error+0x124>
lea    0xf62(%rip),%rdi
call   1030 <printf@plt>
mov    0x2d85(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<error>:
push   %rax
add    $0xffffffff,%edi
cmp    $0xb,%edi
ja     11a2 <error+0x72>
lea    0xec0(%rip),%rax
movslq (%rax,%rdi,4),%rcx
add    %rax,%rcx
jmp    *%rcx
lea    0xee0(%rip),%rdi
jmp    118f <error+0x5f>
lea    0xee4(%rip),%rdi
jmp    118f <error+0x5f>
lea    0xee6(%rip),%rdi
jmp    118f <error+0x5f>
lea    0xeea(%rip),%rdi
jmp    118f <error+0x5f>
lea    0xeee(%rip),%rdi
jmp    118f <error+0x5f>
lea    0xefb(%rip),%rdi
jmp    118f <error+0x5f>
lea    0xf03(%rip),%rdi
jmp    118f <error+0x5f>
lea    0xf05(%rip),%rdi
call   1040 <perror@plt>
mov    0x2e45(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
lea    0x1003(%rip),%rdi
jmp    11d9 <error+0xa9>
lea    0xf2b(%rip),%rdi
jmp    11bb <error+0x8b>
lea    0xef1(%rip),%rdi
call   1030 <puts@plt>
lea    0xf52(%rip),%rdi
jmp    11d9 <error+0xa9>
lea    0xfa8(%rip),%rdi
jmp    11d9 <error+0xa9>
lea    0xf78(%rip),%rdi
call   1030 <puts@plt>
jmp    1194 <error+0x64>

LLVM IR (-O0):
@.str = [53 x i8] c"\0Acannot open configuration file - server terminated\0A\00"
@.str.1 = [40 x i8] c"\0Aparameter problem - server terminated\0A\00"
@.str.2 = [61 x i8] c"\0Acannot run server - wrong number of command line arguments\0A\00"
@.str.3 = [57 x i8] c"Usage: nwserver [-p <Port_number>] [-d <Document_Root>]\0A\00"
@.str.4 = [50 x i8] c"\0Acannot run server - wrong command line argument\0A\00"
@.str.5 = [13 x i8] c"nws - socket\00"
@.str.6 = [11 x i8] c"nws - bind\00"
@.str.7 = [13 x i8] c"nws - listen\00"
@.str.8 = [13 x i8] c"nws - signal\00"
@.str.9 = [22 x i8] c"nws - nws.log missing\00"
@.str.10 = [17 x i8] c"nws - setsockopt\00"
@.str.11 = [11 x i8] c"nws - exec\00"
@.str.12 = [24 x i8] c"nws - error.htm missing\00"
@.str.13 = [58 x i8] c"\0Awrong error number - internal error - server terminated\0A\00"
@EXIT_FAILURE = global i32 0
define void @error(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
switch i32 %3, label %30 [
i32 1, label %4
i32 2, label %6
i32 3, label %8
i32 4, label %11
i32 5, label %14
i32 6, label %16
i32 7, label %18
i32 8, label %20
i32 9, label %22
i32 10, label %24
i32 11, label %26
i32 12, label %28
]
4: ; preds = %1
%5 = call i32 @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0))
br label %32
6: ; preds = %1
%7 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0))
br label %32
8: ; preds = %1
%9 = call i32 @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.2, i64 0, i64 0))
%10 = call i32 @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.3, i64 0, i64 0))
br label %32
11: ; preds = %1
%12 = call i32 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.4, i64 0, i64 0))
%13 = call i32 @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.3, i64 0, i64 0))
br label %32
14: ; preds = %1
%15 = call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0))
br label %32
16: ; preds = %1
%17 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0))
br label %32
18: ; preds = %1
%19 = call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0))
br label %32
20: ; preds = %1
%21 = call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0))
br label %32
22: ; preds = %1
%23 = call i32 @perror(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.9, i64 0, i64 0))
br label %32
24: ; preds = %1
%25 = call i32 @perror(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.10, i64 0, i64 0))
br label %32
26: ; preds = %1
%27 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.11, i64 0, i64 0))
br label %32
28: ; preds = %1
%29 = call i32 @perror(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.12, i64 0, i64 0))
br label %32
30: ; preds = %1
%31 = call i32 @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.13, i64 0, i64 0))
br label %32
32: ; preds = %30, %28, %26, %24, %22, %20, %18, %16, %14, %11, %8, %6, %4
%33 = load i32, i32* @EXIT_FAILURE
%34 = call i32 @exit(i32 %33)
unreachable
}

LLVM IR (-O2):
@.str.5 = [13 x i8] c"nws - socket\00"
@.str.6 = [11 x i8] c"nws - bind\00"
@.str.7 = [13 x i8] c"nws - listen\00"
@.str.8 = [13 x i8] c"nws - signal\00"
@.str.9 = [22 x i8] c"nws - nws.log missing\00"
@.str.10 = [17 x i8] c"nws - setsockopt\00"
@.str.11 = [11 x i8] c"nws - exec\00"
@.str.12 = [24 x i8] c"nws - error.htm missing\00"
@EXIT_FAILURE = global i32 0
@str = [49 x i8] c"\0Acannot run server - wrong command line argument\00"
@str.15 = [60 x i8] c"\0Acannot run server - wrong number of command line arguments\00"
@str.16 = [56 x i8] c"Usage: nwserver [-p <Port_number>] [-d <Document_Root>]\00"
@str.17 = [39 x i8] c"\0Aparameter problem - server terminated\00"
@str.18 = [52 x i8] c"\0Acannot open configuration file - server terminated\00"
@str.19 = [57 x i8] c"\0Awrong error number - internal error - server terminated\00"
define void @error(i32 %0) {
switch i32 %0, label %28 [
i32 1, label %2
i32 2, label %4
i32 3, label %6
i32 4, label %9
i32 5, label %12
i32 6, label %14
i32 7, label %16
i32 8, label %18
i32 9, label %20
i32 10, label %22
i32 11, label %24
i32 12, label %26
]
2: ; preds = %1
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @str.18, i64 0, i64 0))
br label %30
4: ; preds = %1
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str.17, i64 0, i64 0))
br label %30
6: ; preds = %1
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @str.15, i64 0, i64 0))
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([56 x i8], [56 x i8]* @str.16, i64 0, i64 0))
br label %30
9: ; preds = %1
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @str, i64 0, i64 0))
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([56 x i8], [56 x i8]* @str.16, i64 0, i64 0))
br label %30
12: ; preds = %1
%13 = tail call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0))
br label %30
14: ; preds = %1
%15 = tail call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0))
br label %30
16: ; preds = %1
%17 = tail call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0))
br label %30
18: ; preds = %1
%19 = tail call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0))
br label %30
20: ; preds = %1
%21 = tail call i32 @perror(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.9, i64 0, i64 0))
br label %30
22: ; preds = %1
%23 = tail call i32 @perror(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.10, i64 0, i64 0))
br label %30
24: ; preds = %1
%25 = tail call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.11, i64 0, i64 0))
br label %30
26: ; preds = %1
%27 = tail call i32 @perror(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.12, i64 0, i64 0))
br label %30
28: ; preds = %1
%29 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @str.19, i64 0, i64 0))
br label %30
30: ; preds = %28, %26, %24, %22, %20, %18, %16, %14, %12, %9, %6, %4, %2
%31 = load i32, i32* @EXIT_FAILURE
%32 = tail call i32 @exit(i32 %31)
unreachable
}