#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*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void die(int status, int errno) {
  switch (errno) {
  case 0:
    exit(status);
  case 1:
    fprintf(stderr, "getdate: The DATEMSK environment variable is not "
                    "defined,or its value is an empty string.\n");
    exit(status);
  case 2:
    fprintf(stderr, "getdate: The template file specified by DATEMSK cannot "
                    "beopened for reading.\n");
    exit(status);
  case 3:
    fprintf(stderr, "getdate: Failed to get file status information.\n");
    exit(status);
  case 4:
    fprintf(stderr, "getdate: The template file is not a regular file.\n");
    exit(status);
  case 5:
    fprintf(
        stderr,
        "getdate: An error was encountered while reading the template file.\n");
    exit(status);
  case 6:
    fprintf(
        stderr,
        "getdate: Memory allocation failed (not enough memory available).\n");
    exit(status);
  case 7:
    fprintf(stderr, "Date format is not recognized\n");
    exit(status);
  case 8:
    fprintf(stderr, "getdate: Invalid input specification.\n");
    exit(status);
  case 9:
    fprintf(stderr, "Something is wrong with the database.\n");
    exit(status);
  case 127:
    fprintf(stderr, "too many argument\n");
    exit(status);
  default:
    fprintf(stderr, "uncaught error, exiting\n");
    exit(status);
  }
}


x86 assembly (clang, -O0):
<die>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
test   %eax,%eax
je     11eb <die+0xcb>
jmp    1141 <die+0x21>
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
je     11f3 <die+0xd3>
jmp    1152 <die+0x32>
mov    -0xc(%rbp),%eax
sub    $0x2,%eax
je     1210 <die+0xf0>
jmp    1163 <die+0x43>
mov    -0xc(%rbp),%eax
sub    $0x3,%eax
je     122d <die+0x10d>
jmp    1174 <die+0x54>
mov    -0xc(%rbp),%eax
sub    $0x4,%eax
je     124a <die+0x12a>
jmp    1185 <die+0x65>
mov    -0xc(%rbp),%eax
sub    $0x5,%eax
je     1267 <die+0x147>
jmp    1196 <die+0x76>
mov    -0xc(%rbp),%eax
sub    $0x6,%eax
je     1284 <die+0x164>
jmp    11a7 <die+0x87>
mov    -0xc(%rbp),%eax
sub    $0x7,%eax
je     12a1 <die+0x181>
jmp    11b8 <die+0x98>
mov    -0xc(%rbp),%eax
sub    $0x8,%eax
je     12be <die+0x19e>
jmp    11c9 <die+0xa9>
mov    -0xc(%rbp),%eax
sub    $0x9,%eax
je     12db <die+0x1bb>
jmp    11da <die+0xba>
mov    -0xc(%rbp),%eax
sub    $0x7f,%eax
je     12f8 <die+0x1d8>
jmp    1315 <die+0x1f5>
mov    -0x4(%rbp),%edi
call   1040 <exit@plt>
mov    0x2de6(%rip),%rax
mov    (%rax),%edi
lea    0xdfd(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x4(%rbp),%edi
call   1040 <exit@plt>
mov    0x2dc9(%rip),%rax
mov    (%rax),%edi
lea    0xe3b(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x4(%rbp),%edi
call   1040 <exit@plt>
mov    0x2dac(%rip),%rax
mov    (%rax),%edi
lea    0xe6c(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x4(%rbp),%edi
call   1040 <exit@plt>
mov    0x2d8f(%rip),%rax
mov    (%rax),%edi
lea    0xe80(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x4(%rbp),%edi
call   1040 <exit@plt>
mov    0x2d72(%rip),%rax
mov    (%rax),%edi
lea    0xe96(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x4(%rbp),%edi
call   1040 <exit@plt>
mov    0x2d55(%rip),%rax
mov    (%rax),%edi
lea    0xebd(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x4(%rbp),%edi
call   1040 <exit@plt>
mov    0x2d38(%rip),%rax
mov    (%rax),%edi
lea    0xee2(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x4(%rbp),%edi
call   1040 <exit@plt>
mov    0x2d1b(%rip),%rax
mov    (%rax),%edi
lea    0xee4(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x4(%rbp),%edi
call   1040 <exit@plt>
mov    0x2cfe(%rip),%rax
mov    (%rax),%edi
lea    0xeee(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x4(%rbp),%edi
call   1040 <exit@plt>
mov    0x2ce1(%rip),%rax
mov    (%rax),%edi
lea    0xef8(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x4(%rbp),%edi
call   1040 <exit@plt>
mov    0x2cc4(%rip),%rax
mov    (%rax),%edi
lea    0xeee(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x4(%rbp),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<die>:
push   %rbx
mov    %edi,%ebx
cmp    $0x9,%esi
ja     1141 <die+0x21>
mov    %esi,%eax
lea    0xecf(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    %ebx,%edi
call   1040 <exit@plt>
mov    0x2e98(%rip),%rax
cmp    $0x7f,%esi
jne    1207 <die+0xe7>
mov    (%rax),%edi
lea    0x10ce(%rip),%rsi
jmp    1210 <die+0xf0>
mov    0x2e7a(%rip),%rax
mov    (%rax),%edi
lea    0xeb9(%rip),%rsi
jmp    1210 <die+0xf0>
mov    0x2e65(%rip),%rax
mov    (%rax),%edi
lea    0xeff(%rip),%rsi
jmp    1210 <die+0xf0>
mov    0x2e50(%rip),%rax
mov    (%rax),%edi
lea    0xf38(%rip),%rsi
jmp    1210 <die+0xf0>
mov    0x2e3e(%rip),%rax
mov    (%rax),%edi
lea    0xf57(%rip),%rsi
jmp    1210 <die+0xf0>
mov    0x2e2c(%rip),%rax
mov    (%rax),%edi
lea    0xf78(%rip),%rsi
jmp    1210 <die+0xf0>
mov    0x2e1a(%rip),%rax
mov    (%rax),%edi
lea    0xfaa(%rip),%rsi
jmp    1210 <die+0xf0>
mov    0x2e08(%rip),%rax
mov    (%rax),%edi
lea    0xfda(%rip),%rsi
jmp    1210 <die+0xf0>
mov    0x2df6(%rip),%rax
mov    (%rax),%edi
lea    0xfe7(%rip),%rsi
jmp    1210 <die+0xf0>
mov    0x2de4(%rip),%rax
mov    (%rax),%edi
lea    0xffc(%rip),%rsi
jmp    1210 <die+0xf0>
mov    (%rax),%edi
lea    0x102b(%rip),%rsi
call   1030 <fprintf@plt>
mov    %ebx,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [91 x i8] c"getdate: The DATEMSK environment variable is not defined,or its value is an empty string.\0A\00"
@.str.1 = [78 x i8] c"getdate: The template file specified by DATEMSK cannot beopened for reading.\0A\00"
@.str.2 = [49 x i8] c"getdate: Failed to get file status information.\0A\00"
@.str.3 = [51 x i8] c"getdate: The template file is not a regular file.\0A\00"
@.str.4 = [68 x i8] c"getdate: An error was encountered while reading the template file.\0A\00"
@.str.5 = [66 x i8] c"getdate: Memory allocation failed (not enough memory available).\0A\00"
@.str.6 = [31 x i8] c"Date format is not recognized\0A\00"
@.str.7 = [39 x i8] c"getdate: Invalid input specification.\0A\00"
@.str.8 = [39 x i8] c"Something is wrong with the database.\0A\00"
@.str.9 = [19 x i8] c"too many argument\0A\00"
@.str.10 = [25 x i8] c"uncaught error, exiting\0A\00"
define void @die(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
switch i32 %5, label %59 [
i32 0, label %6
i32 1, label %9
i32 2, label %14
i32 3, label %19
i32 4, label %24
i32 5, label %29
i32 6, label %34
i32 7, label %39
i32 8, label %44
i32 9, label %49
i32 127, label %54
]
6: ; preds = %2
%7 = load i32, i32* %3
%8 = call i32 @exit(i32 %7)
unreachable
9: ; preds = %2
%10 = load i32, i32* @stderr
%11 = call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([91 x i8], [91 x i8]* @.str, i64 0, i64 0))
%12 = load i32, i32* %3
%13 = call i32 @exit(i32 %12)
unreachable
14: ; preds = %2
%15 = load i32, i32* @stderr
%16 = call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([78 x i8], [78 x i8]* @.str.1, i64 0, i64 0))
%17 = load i32, i32* %3
%18 = call i32 @exit(i32 %17)
unreachable
19: ; preds = %2
%20 = load i32, i32* @stderr
%21 = call i32 @fprintf(i32 %20, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.2, i64 0, i64 0))
%22 = load i32, i32* %3
%23 = call i32 @exit(i32 %22)
unreachable
24: ; preds = %2
%25 = load i32, i32* @stderr
%26 = call i32 @fprintf(i32 %25, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.3, i64 0, i64 0))
%27 = load i32, i32* %3
%28 = call i32 @exit(i32 %27)
unreachable
29: ; preds = %2
%30 = load i32, i32* @stderr
%31 = call i32 @fprintf(i32 %30, i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str.4, i64 0, i64 0))
%32 = load i32, i32* %3
%33 = call i32 @exit(i32 %32)
unreachable
34: ; preds = %2
%35 = load i32, i32* @stderr
%36 = call i32 @fprintf(i32 %35, i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.5, i64 0, i64 0))
%37 = load i32, i32* %3
%38 = call i32 @exit(i32 %37)
unreachable
39: ; preds = %2
%40 = load i32, i32* @stderr
%41 = call i32 @fprintf(i32 %40, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.6, i64 0, i64 0))
%42 = load i32, i32* %3
%43 = call i32 @exit(i32 %42)
unreachable
44: ; preds = %2
%45 = load i32, i32* @stderr
%46 = call i32 @fprintf(i32 %45, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.7, i64 0, i64 0))
%47 = load i32, i32* %3
%48 = call i32 @exit(i32 %47)
unreachable
49: ; preds = %2
%50 = load i32, i32* @stderr
%51 = call i32 @fprintf(i32 %50, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.8, i64 0, i64 0))
%52 = load i32, i32* %3
%53 = call i32 @exit(i32 %52)
unreachable
54: ; preds = %2
%55 = load i32, i32* @stderr
%56 = call i32 @fprintf(i32 %55, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.9, i64 0, i64 0))
%57 = load i32, i32* %3
%58 = call i32 @exit(i32 %57)
unreachable
59: ; preds = %2
%60 = load i32, i32* @stderr
%61 = call i32 @fprintf(i32 %60, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.10, i64 0, i64 0))
%62 = load i32, i32* %3
%63 = call i32 @exit(i32 %62)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [91 x i8] c"getdate: The DATEMSK environment variable is not defined,or its value is an empty string.\0A\00"
@.str.1 = [78 x i8] c"getdate: The template file specified by DATEMSK cannot beopened for reading.\0A\00"
@.str.2 = [49 x i8] c"getdate: Failed to get file status information.\0A\00"
@.str.3 = [51 x i8] c"getdate: The template file is not a regular file.\0A\00"
@.str.4 = [68 x i8] c"getdate: An error was encountered while reading the template file.\0A\00"
@.str.5 = [66 x i8] c"getdate: Memory allocation failed (not enough memory available).\0A\00"
@.str.6 = [31 x i8] c"Date format is not recognized\0A\00"
@.str.7 = [39 x i8] c"getdate: Invalid input specification.\0A\00"
@.str.8 = [39 x i8] c"Something is wrong with the database.\0A\00"
@.str.9 = [19 x i8] c"too many argument\0A\00"
@.str.10 = [25 x i8] c"uncaught error, exiting\0A\00"
define void @die(i32 %0, i32 %1) {
switch i32 %1, label %45 [
i32 0, label %3
i32 1, label %5
i32 2, label %9
i32 3, label %13
i32 4, label %17
i32 5, label %21
i32 6, label %25
i32 7, label %29
i32 8, label %33
i32 9, label %37
i32 127, label %41
]
3: ; preds = %2
%4 = tail call i32 @exit(i32 %0)
unreachable
5: ; preds = %2
%6 = load i32, i32* @stderr
%7 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([91 x i8], [91 x i8]* @.str, i64 0, i64 0))
%8 = tail call i32 @exit(i32 %0)
unreachable
9: ; preds = %2
%10 = load i32, i32* @stderr
%11 = tail call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([78 x i8], [78 x i8]* @.str.1, i64 0, i64 0))
%12 = tail call i32 @exit(i32 %0)
unreachable
13: ; preds = %2
%14 = load i32, i32* @stderr
%15 = tail call i32 @fprintf(i32 %14, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.2, i64 0, i64 0))
%16 = tail call i32 @exit(i32 %0)
unreachable
17: ; preds = %2
%18 = load i32, i32* @stderr
%19 = tail call i32 @fprintf(i32 %18, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.3, i64 0, i64 0))
%20 = tail call i32 @exit(i32 %0)
unreachable
21: ; preds = %2
%22 = load i32, i32* @stderr
%23 = tail call i32 @fprintf(i32 %22, i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str.4, i64 0, i64 0))
%24 = tail call i32 @exit(i32 %0)
unreachable
25: ; preds = %2
%26 = load i32, i32* @stderr
%27 = tail call i32 @fprintf(i32 %26, i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.5, i64 0, i64 0))
%28 = tail call i32 @exit(i32 %0)
unreachable
29: ; preds = %2
%30 = load i32, i32* @stderr
%31 = tail call i32 @fprintf(i32 %30, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.6, i64 0, i64 0))
%32 = tail call i32 @exit(i32 %0)
unreachable
33: ; preds = %2
%34 = load i32, i32* @stderr
%35 = tail call i32 @fprintf(i32 %34, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.7, i64 0, i64 0))
%36 = tail call i32 @exit(i32 %0)
unreachable
37: ; preds = %2
%38 = load i32, i32* @stderr
%39 = tail call i32 @fprintf(i32 %38, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.8, i64 0, i64 0))
%40 = tail call i32 @exit(i32 %0)
unreachable
41: ; preds = %2
%42 = load i32, i32* @stderr
%43 = tail call i32 @fprintf(i32 %42, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.9, i64 0, i64 0))
%44 = tail call i32 @exit(i32 %0)
unreachable
45: ; preds = %2
%46 = load i32, i32* @stderr
%47 = tail call i32 @fprintf(i32 %46, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.10, i64 0, i64 0))
%48 = tail call i32 @exit(i32 %0)
unreachable
}