#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 *);
void debug_log(int level, char *string) {
  char *debug_level[] = {"INFO", "WARN", "CRIT", "FATL", "DEAD"};
  printf("QIC module debug_print (%s):%s", debug_level[level], string);
}


x86 assembly (clang, -O0):
<debug_log>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1040 <memset@plt>
lea    0xeba(%rip),%rax
mov    %rax,-0x40(%rbp)
lea    0xeb4(%rip),%rax
mov    %rax,-0x38(%rbp)
lea    0xeae(%rip),%rax
mov    %rax,-0x30(%rbp)
lea    0xea8(%rip),%rax
mov    %rax,-0x28(%rbp)
lea    0xea2(%rip),%rax
mov    %rax,-0x20(%rbp)
movslq -0x4(%rbp),%rax
mov    -0x40(%rbp,%rax,8),%rsi
mov    -0x10(%rbp),%rdx
lea    0xe8f(%rip),%rdi
call   1030 <printf@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<debug_log>:
mov    %rsi,%rdx
lea    0xee6(%rip),%rax
mov    %rax,-0x28(%rsp)
lea    0xedf(%rip),%rax
mov    %rax,-0x20(%rsp)
lea    0xed8(%rip),%rax
mov    %rax,-0x18(%rsp)
lea    0xed1(%rip),%rax
mov    %rax,-0x10(%rsp)
lea    0xeca(%rip),%rax
mov    %rax,-0x8(%rsp)
movslq %edi,%rax
mov    -0x28(%rsp,%rax,8),%rsi
lea    0xebb(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"INFO\00"
@.str.1 = [5 x i8] c"WARN\00"
@.str.2 = [5 x i8] c"CRIT\00"
@.str.3 = [5 x i8] c"FATL\00"
@.str.4 = [5 x i8] c"DEAD\00"
@.str.5 = [31 x i8] c"QIC module debug_print (%s):%s\00"
define void @debug_log(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca [5 x i8*]
store i32 %0, i32* %3
store i8* %1, i8** %4
%6 = bitcast [5 x i8*]* %5 to i8*
%7 = bitcast i8* %6 to [5 x i8*]*
%8 = getelementptr inbounds [5 x i8*], [5 x i8*]* %7, i32 0, i32 0
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i32 0, i32 0), i8** %8
%9 = getelementptr inbounds [5 x i8*], [5 x i8*]* %7, i32 0, i32 1
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i32 0, i32 0), i8** %9
%10 = getelementptr inbounds [5 x i8*], [5 x i8*]* %7, i32 0, i32 2
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i32 0, i32 0), i8** %10
%11 = getelementptr inbounds [5 x i8*], [5 x i8*]* %7, i32 0, i32 3
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i32 0, i32 0), i8** %11
%12 = getelementptr inbounds [5 x i8*], [5 x i8*]* %7, i32 0, i32 4
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i32 0, i32 0), i8** %12
%13 = load i32, i32* %3
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [5 x i8*], [5 x i8*]* %5, i64 0, i64 %14
%16 = load i8*, i8** %15
%17 = load i8*, i8** %4
%18 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.5, i64 0, i64 0), i8* %16, i8* %17)
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"INFO\00"
@.str.1 = [5 x i8] c"WARN\00"
@.str.2 = [5 x i8] c"CRIT\00"
@.str.3 = [5 x i8] c"FATL\00"
@.str.4 = [5 x i8] c"DEAD\00"
@.str.5 = [31 x i8] c"QIC module debug_print (%s):%s\00"
define void @debug_log(i32 %0, i8* %1) {
%3 = alloca [5 x i8*]
%4 = bitcast [5 x i8*]* %3 to i8*
%5 = getelementptr inbounds [5 x i8*], [5 x i8*]* %3, i64 0, i64 0
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8** %5
%6 = getelementptr inbounds [5 x i8*], [5 x i8*]* %3, i64 0, i64 1
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8** %6
%7 = getelementptr inbounds [5 x i8*], [5 x i8*]* %3, i64 0, i64 2
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8** %7
%8 = getelementptr inbounds [5 x i8*], [5 x i8*]* %3, i64 0, i64 3
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8** %8
%9 = getelementptr inbounds [5 x i8*], [5 x i8*]* %3, i64 0, i64 4
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i8** %9
%10 = sext i32 %0 to i64
%11 = getelementptr inbounds [5 x i8*], [5 x i8*]* %3, i64 0, i64 %10
%12 = load i8*, i8** %11
%13 = tail call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.5, i64 0, i64 0), i8* %12, i8* %1)
ret void
}