#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*/ printf(char *);
void report_date_error(int err) {
  switch (err) {
  case 1:
    printf("The environment variable DATEMSK is not defined or null.\n");
    break;
  case 2:
    printf("The template file denoted by the DATEMSK environment variable "
           "cannot be opened.\n");
    break;
  case 3:
    printf("Information about the template file cannot retrieved.\n");
    break;
  case 4:
    printf("The template file is not a regular file.\n");
    break;
  case 5:
    printf("An I/O error occurred while reading the template file.\n");
    break;
  case 6:
    printf("Not enough memory available to execute the function.\n");
    break;
  case 7:
    printf("The template file contains no matching template.\n");
    break;
  case 8:
    printf(
        "The input date is invalid, but would match a template otherwise.\n");
    break;
  default:
    printf("Unknown error code.\n");
    break;
  }
}


x86 assembly (clang, -O0):
<report_date_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    $0x7,%eax
ja     11cc <report_date_error+0xbc>
mov    -0x10(%rbp),%rax
lea    0xec5(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
jmp    11d8 <report_date_error+0xc8>
lea    0xefe(%rip),%rdi
call   1030 <printf@plt>
jmp    11d8 <report_date_error+0xc8>
lea    0xf3e(%rip),%rdi
call   1030 <printf@plt>
jmp    11d8 <report_date_error+0xc8>
lea    0xf64(%rip),%rdi
call   1030 <printf@plt>
jmp    11d8 <report_date_error+0xc8>
lea    0xf7d(%rip),%rdi
call   1030 <printf@plt>
jmp    11d8 <report_date_error+0xc8>
lea    0xfa4(%rip),%rdi
call   1030 <printf@plt>
jmp    11d8 <report_date_error+0xc8>
lea    0xfc9(%rip),%rdi
call   1030 <printf@plt>
jmp    11d8 <report_date_error+0xc8>
lea    0xfea(%rip),%rdi
call   1030 <printf@plt>
jmp    11d8 <report_date_error+0xc8>
lea    0x101b(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<report_date_error>:
add    $0xffffffff,%edi
cmp    $0x7,%edi
ja     112e <report_date_error+0x1e>
movslq %edi,%rax
lea    0x10ba(%rip),%rcx
movslq (%rcx,%rax,4),%rdi
add    %rcx,%rdi
jmp    1030 <puts@plt>
lea    0x1091(%rip),%rdi
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [58 x i8] c"The environment variable DATEMSK is not defined or null.\0A\00"
@.str.1 = [81 x i8] c"The template file denoted by the DATEMSK environment variable cannot be opened.\0A\00"
@.str.2 = [55 x i8] c"Information about the template file cannot retrieved.\0A\00"
@.str.3 = [42 x i8] c"The template file is not a regular file.\0A\00"
@.str.4 = [56 x i8] c"An I/O error occurred while reading the template file.\0A\00"
@.str.5 = [54 x i8] c"Not enough memory available to execute the function.\0A\00"
@.str.6 = [50 x i8] c"The template file contains no matching template.\0A\00"
@.str.7 = [66 x i8] c"The input date is invalid, but would match a template otherwise.\0A\00"
@.str.8 = [21 x i8] c"Unknown error code.\0A\00"
define void @report_date_error(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
switch i32 %3, label %20 [
i32 1, label %4
i32 2, label %6
i32 3, label %8
i32 4, label %10
i32 5, label %12
i32 6, label %14
i32 7, label %16
i32 8, label %18
]
4: ; preds = %1
%5 = call i32 @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str, i64 0, i64 0))
br label %22
6: ; preds = %1
%7 = call i32 @printf(i8* getelementptr inbounds ([81 x i8], [81 x i8]* @.str.1, i64 0, i64 0))
br label %22
8: ; preds = %1
%9 = call i32 @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.2, i64 0, i64 0))
br label %22
10: ; preds = %1
%11 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.3, i64 0, i64 0))
br label %22
12: ; preds = %1
%13 = call i32 @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.4, i64 0, i64 0))
br label %22
14: ; preds = %1
%15 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.5, i64 0, i64 0))
br label %22
16: ; preds = %1
%17 = call i32 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.6, i64 0, i64 0))
br label %22
18: ; preds = %1
%19 = call i32 @printf(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.7, i64 0, i64 0))
br label %22
20: ; preds = %1
%21 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.8, i64 0, i64 0))
br label %22
22: ; preds = %20, %18, %16, %14, %12, %10, %8, %6, %4
ret void
}

LLVM IR (-O2):
@str = [65 x i8] c"The input date is invalid, but would match a template otherwise.\00"
@str.9 = [49 x i8] c"The template file contains no matching template.\00"
@str.10 = [53 x i8] c"Not enough memory available to execute the function.\00"
@str.11 = [55 x i8] c"An I/O error occurred while reading the template file.\00"
@str.12 = [41 x i8] c"The template file is not a regular file.\00"
@str.13 = [54 x i8] c"Information about the template file cannot retrieved.\00"
@str.14 = [80 x i8] c"The template file denoted by the DATEMSK environment variable cannot be opened.\00"
@str.15 = [57 x i8] c"The environment variable DATEMSK is not defined or null.\00"
@str.16 = [20 x i8] c"Unknown error code.\00"
@reltable.report_date_error = [8 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([57 x i8]* @str.15 to i64), i64 ptrtoint ([8 x i32]* @reltable.report_date_error to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([80 x i8]* @str.14 to i64), i64 ptrtoint ([8 x i32]* @reltable.report_date_error to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([54 x i8]* @str.13 to i64), i64 ptrtoint ([8 x i32]* @reltable.report_date_error to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([41 x i8]* @str.12 to i64), i64 ptrtoint ([8 x i32]* @reltable.report_date_error to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([55 x i8]* @str.11 to i64), i64 ptrtoint ([8 x i32]* @reltable.report_date_error to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([53 x i8]* @str.10 to i64), i64 ptrtoint ([8 x i32]* @reltable.report_date_error to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([49 x i8]* @str.9 to i64), i64 ptrtoint ([8 x i32]* @reltable.report_date_error to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([65 x i8]* @str to i64), i64 ptrtoint ([8 x i32]* @reltable.report_date_error to i64)) to i32)]
define void @report_date_error(i32 %0) {
%2 = add i32 %0, -1
%3 = icmp ult i32 %2, 8
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = sext i32 %2 to i64
%6 = shl i64 %5, 2
%7 = call i8* @llvm.load.relative.i64(i8* bitcast ([8 x i32]* @reltable.report_date_error to i8*), i64 %6)
br label %8
8: ; preds = %1, %4
%9 = phi i8* [ %7, %4 ], [ getelementptr inbounds ([20 x i8], [20 x i8]* @str.16, i64 0, i64 0), %1 ]
%10 = tail call i32 @puts(i8* dereferenceable(1) %9)
ret void
}