#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 *, char *, char *, char *);
int default_handler(int level, char *tm, char *line) {
  static char *prefix[] = {"!!! SEVERE: ", "!!! ERROR: ", "Warning: ", "", "",
                           "  ",           "    "};
  printf("[%s] %s%s\n", tm, prefix[level], line);
  return 0;
}


x86 assembly (clang, -O0):
<default_handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rsi
movslq -0x4(%rbp),%rcx
lea    0x2efe(%rip),%rax
mov    (%rax,%rcx,8),%rdx
mov    -0x18(%rbp),%rcx
lea    0xee7(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<default_handler>:
push   %rax
mov    %rdx,%rcx
movslq %edi,%rax
lea    0xee2(%rip),%rdi
movslq (%rdi,%rax,4),%rdx
add    %rdi,%rdx
lea    0xf18(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@default_handler.prefix = internal global [7 x i8*] [i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i32 0, i32 0)]
@.str = [13 x i8] c"!!! SEVERE: \00"
@.str.1 = [12 x i8] c"!!! ERROR: \00"
@.str.2 = [10 x i8] c"Warning: \00"
@.str.3 = [1 x i8] zeroinitializer
@.str.4 = [3 x i8] c" \00"
@.str.5 = [5 x i8] c" \00"
@.str.6 = [11 x i8] c"[%s] %s%s\0A\00"
define i32 @default_handler(i32 %0, i8* %1, i8* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
store i32 %0, i32* %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%7 = load i8*, i8** %5
%8 = load i32, i32* %4
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds [7 x i8*], [7 x i8*]* @default_handler.prefix, i64 0, i64 %9
%11 = load i8*, i8** %10
%12 = load i8*, i8** %6
%13 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), i8* %7, i8* %11, i8* %12)
ret i32 0
}

LLVM IR (-O2):
@reltable.default_handler = internal unnamed_addr constant [7 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([13 x i8]* @.str to i64), i64 ptrtoint ([7 x i32]* @reltable.default_handler to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([12 x i8]* @.str.1 to i64), i64 ptrtoint ([7 x i32]* @reltable.default_handler to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.2 to i64), i64 ptrtoint ([7 x i32]* @reltable.default_handler to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([1 x i8]* @.str.3 to i64), i64 ptrtoint ([7 x i32]* @reltable.default_handler to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([1 x i8]* @.str.3 to i64), i64 ptrtoint ([7 x i32]* @reltable.default_handler to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.4 to i64), i64 ptrtoint ([7 x i32]* @reltable.default_handler to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.5 to i64), i64 ptrtoint ([7 x i32]* @reltable.default_handler to i64)) to i32)]
@.str = [13 x i8] c"!!! SEVERE: \00"
@.str.1 = [12 x i8] c"!!! ERROR: \00"
@.str.2 = [10 x i8] c"Warning: \00"
@.str.3 = [1 x i8] zeroinitializer
@.str.4 = [3 x i8] c" \00"
@.str.5 = [5 x i8] c" \00"
@.str.6 = [11 x i8] c"[%s] %s%s\0A\00"
define i32 @default_handler(i32 %0, i8* %1, i8* %2) {
%4 = sext i32 %0 to i64
%5 = shl i64 %4, 2
%6 = call i8* @llvm.load.relative.i64(i8* bitcast ([7 x i32]* @reltable.default_handler to i8*), i64 %5)
%7 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), i8* %1, i8* %6, i8* %2)
ret i32 0
}