#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 *);
void printlogleadup(int level) {
  if (level == 0) {
    printf("%s", "=== DEBUG === ");
  } else if (level == 1) {
    printf("%s", "\x1B[32m=== INFO  === \x1B[0m");
  } else if (level == 2) {
    printf("%s", "\x1B[33m=== WARN  === \x1B[0m");
  } else if (level == 3) {
    printf("%s", "\x1B[31m=== ERROR === \x1B[0m");
  } else {
    return;
  }
}


x86 assembly (clang, -O0):
<printlogleadup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    113d <printlogleadup+0x2d>
lea    0xed4(%rip),%rdi
lea    0xed0(%rip),%rsi
call   1030 <printf@plt>
jmp    11b7 <printlogleadup+0xa7>
cmpl   $0x1,-0x4(%rbp)
jne    115f <printlogleadup+0x4f>
lea    0xeb2(%rip),%rdi
lea    0xebd(%rip),%rsi
call   1030 <printf@plt>
jmp    11b2 <printlogleadup+0xa2>
cmpl   $0x2,-0x4(%rbp)
jne    1181 <printlogleadup+0x71>
lea    0xe90(%rip),%rdi
lea    0xeb3(%rip),%rsi
call   1030 <printf@plt>
jmp    11ad <printlogleadup+0x9d>
cmpl   $0x3,-0x4(%rbp)
jne    11a3 <printlogleadup+0x93>
lea    0xe6e(%rip),%rdi
lea    0xea9(%rip),%rsi
call   1030 <printf@plt>
jmp    11a8 <printlogleadup+0x98>
jmp    11b7 <printlogleadup+0xa7>
jmp    11ad <printlogleadup+0x9d>
jmp    11b2 <printlogleadup+0xa2>
jmp    11b7 <printlogleadup+0xa7>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printlogleadup>:
cmp    $0x3,%edi
ja     1132 <printlogleadup+0x22>
movslq %edi,%rax
lea    0xf3d(%rip),%rcx
movslq (%rcx,%rax,4),%rsi
add    %rcx,%rsi
lea    0xed3(%rip),%rdi
jmp    1030 <printf@plt>
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [15 x i8] c"=== DEBUG === \00"
@.str.2 = [24 x i8] c"\1B[32m=== INFO === \1B[0m\00"
@.str.3 = [24 x i8] c"\1B[33m=== WARN === \1B[0m\00"
@.str.4 = [24 x i8] c"\1B[31m=== ERROR === \1B[0m\00"
define void @printlogleadup(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
br label %26
7: ; preds = %1
%8 = load i32, i32* %2
%9 = icmp eq i32 %8, 1
br i1 %9, label %10, label %12
10: ; preds = %7
%11 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0))
br label %25
12: ; preds = %7
%13 = load i32, i32* %2
%14 = icmp eq i32 %13, 2
br i1 %14, label %15, label %17
15: ; preds = %12
%16 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0))
br label %24
17: ; preds = %12
%18 = load i32, i32* %2
%19 = icmp eq i32 %18, 3
br i1 %19, label %20, label %22
20: ; preds = %17
%21 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0))
br label %23
22: ; preds = %17
br label %26
23: ; preds = %20
br label %24
24: ; preds = %23, %15
br label %25
25: ; preds = %24, %10
br label %26
26: ; preds = %22, %25, %5
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [15 x i8] c"=== DEBUG === \00"
@.str.2 = [24 x i8] c"\1B[32m=== INFO === \1B[0m\00"
@.str.3 = [24 x i8] c"\1B[33m=== WARN === \1B[0m\00"
@.str.4 = [24 x i8] c"\1B[31m=== ERROR === \1B[0m\00"
@reltable.printlogleadup = [4 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([15 x i8]* @.str.1 to i64), i64 ptrtoint ([4 x i32]* @reltable.printlogleadup to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([24 x i8]* @.str.2 to i64), i64 ptrtoint ([4 x i32]* @reltable.printlogleadup to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([24 x i8]* @.str.3 to i64), i64 ptrtoint ([4 x i32]* @reltable.printlogleadup to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([24 x i8]* @.str.4 to i64), i64 ptrtoint ([4 x i32]* @reltable.printlogleadup to i64)) to i32)]
define void @printlogleadup(i32 %0) {
%2 = icmp ult i32 %0, 4
br i1 %2, label %3, label %8
3: ; preds = %1
%4 = sext i32 %0 to i64
%5 = shl i64 %4, 2
%6 = call i8* @llvm.load.relative.i64(i8* bitcast ([4 x i32]* @reltable.printlogleadup to i8*), i64 %5)
%7 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %6)
br label %8
8: ; preds = %1, %3
ret void
}