#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 */
char *GetLogLevelName(int);
int /*<<< orphan*/ Log(char *, char *, int);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  printf("START log test \n");
  printf("Log level: %s\n", GetLogLevelName(3));
  Log("Test main", "log msg 1", 1);
  Log("Test main", "log msg 2", 2);
  Log("Test main", "log msg 3", 3);
  Log("Test main", "log msg 4", 4);
  Log("Test main", "log msg 5", 5);
  printf("END log test \n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
lea    0xec5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x3,%edi
call   1040 <GetLogLevelName@plt>
mov    %rax,%rsi
lea    0xebb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xebc(%rip),%rdi
lea    0xebf(%rip),%rsi
mov    $0x1,%edx
call   1050 <Log@plt>
lea    0xea4(%rip),%rdi
lea    0xeb1(%rip),%rsi
mov    $0x2,%edx
call   1050 <Log@plt>
lea    0xe8c(%rip),%rdi
lea    0xea3(%rip),%rsi
mov    $0x3,%edx
call   1050 <Log@plt>
lea    0xe74(%rip),%rdi
lea    0xe95(%rip),%rsi
mov    $0x4,%edx
call   1050 <Log@plt>
lea    0xe5c(%rip),%rdi
lea    0xe87(%rip),%rsi
mov    $0x5,%edx
call   1050 <Log@plt>
lea    0xe80(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xf03(%rip),%rdi
call   1030 <puts@plt>
mov    $0x3,%edi
call   1050 <GetLogLevelName@plt>
lea    0xea2(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xea0(%rip),%rbx
lea    0xea3(%rip),%rsi
mov    %rbx,%rdi
mov    $0x1,%edx
call   1060 <Log@plt>
lea    0xe99(%rip),%rsi
mov    %rbx,%rdi
mov    $0x2,%edx
call   1060 <Log@plt>
lea    0xe8f(%rip),%rsi
mov    %rbx,%rdi
mov    $0x3,%edx
call   1060 <Log@plt>
lea    0xe85(%rip),%rsi
mov    %rbx,%rdi
mov    $0x4,%edx
call   1060 <Log@plt>
lea    0xe7b(%rip),%rsi
mov    %rbx,%rdi
mov    $0x5,%edx
call   1060 <Log@plt>
lea    0xe81(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [17 x i8] c"START log test \0A\00"
@.str.1 = [15 x i8] c"Log level: %s\0A\00"
@.str.2 = [10 x i8] c"Test main\00"
@.str.3 = [10 x i8] c"log msg 1\00"
@.str.4 = [10 x i8] c"log msg 2\00"
@.str.5 = [10 x i8] c"log msg 3\00"
@.str.6 = [10 x i8] c"log msg 4\00"
@.str.7 = [10 x i8] c"log msg 5\00"
@.str.8 = [15 x i8] c"END log test \0A\00"
define i32 @main() {
%1 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%2 = call i8* @GetLogLevelName(i32 3)
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%4 = call i32 @Log(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32 1)
%5 = call i32 @Log(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i32 2)
%6 = call i32 @Log(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i32 3)
%7 = call i32 @Log(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i32 4)
%8 = call i32 @Log(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0), i32 5)
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.8, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [15 x i8] c"Log level: %s\0A\00"
@.str.2 = [10 x i8] c"Test main\00"
@.str.3 = [10 x i8] c"log msg 1\00"
@.str.4 = [10 x i8] c"log msg 2\00"
@.str.5 = [10 x i8] c"log msg 3\00"
@.str.6 = [10 x i8] c"log msg 4\00"
@.str.7 = [10 x i8] c"log msg 5\00"
@str = [16 x i8] c"START log test \00"
@str.9 = [14 x i8] c"END log test \00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
%2 = tail call i8* @GetLogLevelName(i32 3)
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%4 = tail call i32 @Log(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32 1)
%5 = tail call i32 @Log(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i32 2)
%6 = tail call i32 @Log(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i32 3)
%7 = tail call i32 @Log(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i32 4)
%8 = tail call i32 @Log(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0), i32 5)
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.9, i64 0, i64 0))
ret i32 0
}