#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 */
typedef int pid_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ strcmp(char *, char *);
void print_server_msg(pid_t pid, char status, char msg[], int i_info,
                      char s_info[]) {
  printf(" #%5d |", pid);
  if (status == 0)
    printf(" SUCCESS |");
  else if (status == 1)
    printf(" INFO    |");
  else
    printf(" ERROR   |");
  printf(" %s", msg);
  if (i_info != 0)
    printf(" %d", i_info);
  if (strcmp(s_info, "") != 0)
    printf(" %s", s_info);
  printf("\n");
}


x86 assembly (clang, -O0):
<print_server_msg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %sil,%al
mov    %edi,-0x4(%rbp)
mov    %al,-0x5(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8,-0x20(%rbp)
mov    -0x4(%rbp),%esi
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsbl -0x5(%rbp),%eax
cmp    $0x0,%eax
jne    116d <print_server_msg+0x4d>
lea    0xea7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11a0 <print_server_msg+0x80>
movsbl -0x5(%rbp),%eax
cmp    $0x1,%eax
jne    118d <print_server_msg+0x6d>
lea    0xe92(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    119b <print_server_msg+0x7b>
lea    0xe8a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11a0 <print_server_msg+0x80>
mov    -0x10(%rbp),%rsi
lea    0xe7e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x0,-0x14(%rbp)
je     11cd <print_server_msg+0xad>
mov    -0x14(%rbp),%esi
lea    0xe67(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%rdi
lea    0xe5a(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     11f9 <print_server_msg+0xd9>
mov    -0x20(%rbp),%rsi
lea    0xe37(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe31(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_server_msg>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %r8,%r14
mov    %ecx,%ebp
mov    %rdx,%r15
mov    %esi,%ebx
mov    %edi,%esi
lea    0xeb6(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    $0x1,%bl
lea    0xeb8(%rip),%rax
lea    0xebc(%rip),%rcx
cmove  %rax,%rcx
test   %bl,%bl
lea    0xe99(%rip),%rdi
cmovne %rcx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xea8(%rip),%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
test   %ebp,%ebp
je     119f <print_server_msg+0x6f>
lea    0xe97(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe8a(%rip),%rsi
mov    %r14,%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
je     11c4 <print_server_msg+0x94>
lea    0xe6f(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [8 x i8] c" #%5d |\00"
@.str.1 = [11 x i8] c" SUCCESS |\00"
@.str.2 = [11 x i8] c" INFO |\00"
@.str.3 = [11 x i8] c" ERROR |\00"
@.str.4 = [4 x i8] c" %s\00"
@.str.5 = [4 x i8] c" %d\00"
@.str.6 = [1 x i8] zeroinitializer
@.str.7 = [2 x i8] c"\0A\00"
define void @print_server_msg(i32 %0, i8 signext %1, i8* %2, i32 %3, i8* %4) {
%6 = alloca i32
%7 = alloca i8
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i8*
store i32 %0, i32* %6
store i8 %1, i8* %7
store i8* %2, i8** %8
store i32 %3, i32* %9
store i8* %4, i8** %10
%11 = load i32, i32* %6
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = load i8, i8* %7
%14 = sext i8 %13 to i32
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %5
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
br label %27
18: ; preds = %5
%19 = load i8, i8* %7
%20 = sext i8 %19 to i32
%21 = icmp eq i32 %20, 1
br i1 %21, label %22, label %24
22: ; preds = %18
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
br label %26
24: ; preds = %18
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
br label %26
26: ; preds = %24, %22
br label %27
27: ; preds = %26, %16
%28 = load i8*, i8** %8
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* %28)
%30 = load i32, i32* %9
%31 = icmp ne i32 %30, 0
br i1 %31, label %32, label %35
32: ; preds = %27
%33 = load i32, i32* %9
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 %33)
br label %35
35: ; preds = %32, %27
%36 = load i8*, i8** %10
%37 = call i64 @strcmp(i8* %36, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.6, i64 0, i64 0))
%38 = icmp ne i64 %37, 0
br i1 %38, label %39, label %42
39: ; preds = %35
%40 = load i8*, i8** %10
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* %40)
br label %42
42: ; preds = %39, %35
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c" #%5d |\00"
@.str.1 = [11 x i8] c" SUCCESS |\00"
@.str.2 = [11 x i8] c" INFO |\00"
@.str.3 = [11 x i8] c" ERROR |\00"
@.str.4 = [4 x i8] c" %s\00"
@.str.5 = [4 x i8] c" %d\00"
@.str.6 = [1 x i8] zeroinitializer
define void @print_server_msg(i32 %0, i8 signext %1, i8* %2, i32 %3, i8* %4) {
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %0)
%7 = icmp eq i8 %1, 1
%8 = select i1 %7, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0)
%9 = icmp eq i8 %1, 0
%10 = select i1 %9, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* %8
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) %10)
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* %2)
%13 = icmp eq i32 %3, 0
br i1 %13, label %16, label %14
14: ; preds = %5
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 %3)
br label %16
16: ; preds = %14, %5
%17 = tail call i64 @strcmp(i8* %4, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.6, i64 0, i64 0))
%18 = icmp eq i64 %17, 0
br i1 %18, label %21, label %19
19: ; preds = %16
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* %4)
br label %21
21: ; preds = %19, %16
%22 = tail call i32 @putchar(i32 10)
ret void
}