#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*/ SPC_FREE();
int /*<<< orphan*/ SPC_INIT();
int /*<<< orphan*/ SPC_MSG(int, char *, ...);
int /*<<< orphan*/ getTimeStamp(char *);
int /*<<< orphan*/ printf(char *, char *);
int main() {
  char ts[30];
  getTimeStamp(ts);
  printf("TS: %s\n", ts);
  SPC_INIT();
  SPC_MSG(0, "LOGINF MESSAGE");
  SPC_MSG(1, "LOGWAN MESSAGE");
  SPC_MSG(2, "LOGERR MESSAGE");
  SPC_MSG(3, "LOGDBG MESSAGE");
  SPC_MSG(10, "TYPE ERROR MESSAGE");
  SPC_MSG(3, "%d + %c = %s", 1, '2', "3");
  SPC_FREE();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
call   1040 <getTimeStamp@plt>
lea    -0x30(%rbp),%rsi
lea    0xe8d(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1060 <SPC_INIT@plt>
xor    %edi,%edi
lea    0xe80(%rip),%rsi
mov    $0x0,%al
call   1050 <SPC_MSG@plt>
mov    $0x1,%edi
lea    0xe7c(%rip),%rsi
mov    $0x0,%al
call   1050 <SPC_MSG@plt>
mov    $0x2,%edi
lea    0xe78(%rip),%rsi
mov    $0x0,%al
call   1050 <SPC_MSG@plt>
mov    $0x3,%edi
lea    0xe74(%rip),%rsi
mov    $0x0,%al
call   1050 <SPC_MSG@plt>
mov    $0xa,%edi
lea    0xe70(%rip),%rsi
mov    $0x0,%al
call   1050 <SPC_MSG@plt>
mov    $0x3,%edi
lea    0xe70(%rip),%rsi
mov    $0x1,%edx
mov    $0x32,%ecx
lea    0xe6c(%rip),%r8
mov    $0x0,%al
call   1050 <SPC_MSG@plt>
mov    $0x0,%al
call   1070 <SPC_FREE@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1040 <getTimeStamp@plt>
lea    0xe99(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
call   1060 <SPC_INIT@plt>
lea    0xe8b(%rip),%rsi
xor    %edi,%edi
xor    %eax,%eax
call   1050 <SPC_MSG@plt>
lea    0xe8a(%rip),%rsi
mov    $0x1,%edi
xor    %eax,%eax
call   1050 <SPC_MSG@plt>
lea    0xe86(%rip),%rsi
mov    $0x2,%edi
xor    %eax,%eax
call   1050 <SPC_MSG@plt>
lea    0xe82(%rip),%rsi
mov    $0x3,%edi
xor    %eax,%eax
call   1050 <SPC_MSG@plt>
lea    0xe7e(%rip),%rsi
mov    $0xa,%edi
xor    %eax,%eax
call   1050 <SPC_MSG@plt>
lea    0xe7e(%rip),%rsi
lea    0xe84(%rip),%r8
mov    $0x3,%edi
mov    $0x1,%edx
mov    $0x32,%ecx
xor    %eax,%eax
call   1050 <SPC_MSG@plt>
xor    %eax,%eax
call   1070 <SPC_FREE@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [8 x i8] c"TS: %s\0A\00"
@.str.1 = [15 x i8] c"LOGINF MESSAGE\00"
@.str.2 = [15 x i8] c"LOGWAN MESSAGE\00"
@.str.3 = [15 x i8] c"LOGERR MESSAGE\00"
@.str.4 = [15 x i8] c"LOGDBG MESSAGE\00"
@.str.5 = [19 x i8] c"TYPE ERROR MESSAGE\00"
@.str.6 = [13 x i8] c"%d + %c = %s\00"
@.str.7 = [2 x i8] c"3\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [30 x i8]
store i32 0, i32* %1
%3 = getelementptr inbounds [30 x i8], [30 x i8]* %2, i64 0, i64 0
%4 = call i32 @getTimeStamp(i8* %3)
%5 = getelementptr inbounds [30 x i8], [30 x i8]* %2, i64 0, i64 0
%6 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = call i32 (...) @SPC_INIT()
%8 = call i32 (i32, i8*, ...) @SPC_MSG(i32 0, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%9 = call i32 (i32, i8*, ...) @SPC_MSG(i32 1, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
%10 = call i32 (i32, i8*, ...) @SPC_MSG(i32 2, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
%11 = call i32 (i32, i8*, ...) @SPC_MSG(i32 3, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0))
%12 = call i32 (i32, i8*, ...) @SPC_MSG(i32 10, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0))
%13 = call i32 (i32, i8*, ...) @SPC_MSG(i32 3, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0), i32 1, i32 50, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%14 = call i32 (...) @SPC_FREE()
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"TS: %s\0A\00"
@.str.1 = [15 x i8] c"LOGINF MESSAGE\00"
@.str.2 = [15 x i8] c"LOGWAN MESSAGE\00"
@.str.3 = [15 x i8] c"LOGERR MESSAGE\00"
@.str.4 = [15 x i8] c"LOGDBG MESSAGE\00"
@.str.5 = [19 x i8] c"TYPE ERROR MESSAGE\00"
@.str.6 = [13 x i8] c"%d + %c = %s\00"
@.str.7 = [2 x i8] c"3\00"
define i32 @main() {
%1 = alloca [30 x i8]
%2 = getelementptr inbounds [30 x i8], [30 x i8]* %1, i64 0, i64 0
%3 = call i32 @getTimeStamp(i8* %2)
%4 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %2)
%5 = call i32 (...) @SPC_INIT()
%6 = call i32 (i32, i8*, ...) @SPC_MSG(i32 0, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 (i32, i8*, ...) @SPC_MSG(i32 1, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 (i32, i8*, ...) @SPC_MSG(i32 2, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
%9 = call i32 (i32, i8*, ...) @SPC_MSG(i32 3, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0))
%10 = call i32 (i32, i8*, ...) @SPC_MSG(i32 10, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0))
%11 = call i32 (i32, i8*, ...) @SPC_MSG(i32 3, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0), i32 1, i32 50, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%12 = call i32 (...) @SPC_FREE()
ret i32 0
}