#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 /*<<< orphan*/ va_list;
struct tm {
  int tm_mday;
  int tm_mon;
  int tm_year;
  int tm_hour;
  int tm_min;
  int tm_sec;
};

/* Variables and functions */
struct tm *getTime();
int /*<<< orphan*/ printf(char *, int, int, int, int, int, int, char *);
void printMsg(va_list ap, char *level) {
  struct tm *timeinfo = getTime();
  printf("[%02d/%02d/%d %02d:%02d:%02d] - %s - ", timeinfo->tm_mday,
         timeinfo->tm_mon + 1, timeinfo->tm_year + 1900, timeinfo->tm_hour,
         timeinfo->tm_min, timeinfo->tm_sec, level);
}


x86 assembly (clang, -O0):
<printMsg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <getTime@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%esi
mov    -0x18(%rbp),%rax
mov    0x4(%rax),%edx
add    $0x1,%edx
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%ecx
add    $0x76c,%ecx
mov    -0x18(%rbp),%rax
mov    0xc(%rax),%r8d
mov    -0x18(%rbp),%rax
mov    0x10(%rax),%r9d
mov    -0x18(%rbp),%rax
mov    0x14(%rax),%r10d
mov    -0x10(%rbp),%rax
lea    0xe86(%rip),%rdi
mov    %r10d,(%rsp)
mov    %rax,0x8(%rsp)
call   1040 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printMsg>:
push   %rbx
mov    %rsi,%rbx
xor    %eax,%eax
call   1030 <getTime@plt>
mov    (%rax),%esi
mov    0x4(%rax),%edx
mov    $0x76c,%ecx
add    0x8(%rax),%ecx
add    $0x1,%edx
mov    0xc(%rax),%r8d
mov    0x10(%rax),%r9d
mov    0x14(%rax),%eax
lea    0xeb3(%rip),%rdi
push   %rbx
push   %rax
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.tm = type { i32, i32, i32, i32, i32, i32 }
@.str = [38 x i8] c"[%02d/%02d/%d %02d:%02d:%02d] - %s - \00"
define void @printMsg(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca %struct.tm*
store i32 %0, i32* %3
store i8* %1, i8** %4
%6 = call %struct.tm* (...) @getTime()
store %struct.tm* %6, %struct.tm** %5
%7 = load %struct.tm*, %struct.tm** %5
%8 = getelementptr inbounds %struct.tm, %struct.tm* %7, i32 0, i32 0
%9 = load i32, i32* %8
%10 = load %struct.tm*, %struct.tm** %5
%11 = getelementptr inbounds %struct.tm, %struct.tm* %10, i32 0, i32 1
%12 = load i32, i32* %11
%13 = add nsw i32 %12, 1
%14 = load %struct.tm*, %struct.tm** %5
%15 = getelementptr inbounds %struct.tm, %struct.tm* %14, i32 0, i32 2
%16 = load i32, i32* %15
%17 = add nsw i32 %16, 1900
%18 = load %struct.tm*, %struct.tm** %5
%19 = getelementptr inbounds %struct.tm, %struct.tm* %18, i32 0, i32 3
%20 = load i32, i32* %19
%21 = load %struct.tm*, %struct.tm** %5
%22 = getelementptr inbounds %struct.tm, %struct.tm* %21, i32 0, i32 4
%23 = load i32, i32* %22
%24 = load %struct.tm*, %struct.tm** %5
%25 = getelementptr inbounds %struct.tm, %struct.tm* %24, i32 0, i32 5
%26 = load i32, i32* %25
%27 = load i8*, i8** %4
%28 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i32 %9, i32 %13, i32 %17, i32 %20, i32 %23, i32 %26, i8* %27)
ret void
}

LLVM IR (-O2):
%struct.tm = type { i32, i32, i32, i32, i32, i32 }
@.str = [38 x i8] c"[%02d/%02d/%d %02d:%02d:%02d] - %s - \00"
define void @printMsg(i32 %0, i8* %1) {
%3 = tail call %struct.tm* (...) @getTime()
%4 = getelementptr inbounds %struct.tm, %struct.tm* %3, i64 0, i32 0
%5 = load i32, i32* %4
%6 = getelementptr inbounds %struct.tm, %struct.tm* %3, i64 0, i32 1
%7 = load i32, i32* %6
%8 = add nsw i32 %7, 1
%9 = getelementptr inbounds %struct.tm, %struct.tm* %3, i64 0, i32 2
%10 = load i32, i32* %9
%11 = add nsw i32 %10, 1900
%12 = getelementptr inbounds %struct.tm, %struct.tm* %3, i64 0, i32 3
%13 = load i32, i32* %12
%14 = getelementptr inbounds %struct.tm, %struct.tm* %3, i64 0, i32 4
%15 = load i32, i32* %14
%16 = getelementptr inbounds %struct.tm, %struct.tm* %3, i64 0, i32 5
%17 = load i32, i32* %16
%18 = tail call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i32 %5, i32 %8, i32 %11, i32 %13, i32 %15, i32 %17, i8* %1)
ret void
}