#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*/ time_t;
struct tm {
  int dummy;
};

/* Variables and functions */
int getpid();
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, char *, int, char *);
int /*<<< orphan*/ strftime(char *, int, char *, struct tm *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
void _gigs_log(char *message) {
  time_t rawtime;
  struct tm *timeinfo;
  char timebuf[256];
  time(&rawtime);
  timeinfo = localtime(&rawtime);
  strftime(timebuf, 256, "%Y-%m-%dT%H:%M:%S%z", timeinfo);
  printf("time=\"%s\" pid=%d msg=\"%s\"\n", timebuf, getpid(), message);
}


x86 assembly (clang, -O0):
<_gigs_log>:
push   %rbp
mov    %rsp,%rbp
sub    $0x130,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0xc(%rbp),%rdi
call   1060 <time@plt>
lea    -0xc(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x18(%rbp)
lea    -0x120(%rbp),%rdi
mov    -0x18(%rbp),%rcx
mov    $0x100,%esi
lea    0xe74(%rip),%rdx
call   1070 <strftime@plt>
lea    -0x120(%rbp),%rax
mov    %rax,-0x128(%rbp)
mov    $0x0,%al
call   1040 <getpid@plt>
mov    -0x128(%rbp),%rsi
mov    %eax,%edx
mov    -0x8(%rbp),%rcx
lea    0xe5a(%rip),%rdi
call   1050 <printf@plt>
add    $0x130,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_gigs_log>:
push   %r14
push   %rbx
sub    $0x118,%rsp
mov    %rdi,%r14
lea    0xc(%rsp),%rbx
mov    %rbx,%rdi
call   1060 <time@plt>
mov    %rbx,%rdi
call   1030 <localtime@plt>
lea    0xe87(%rip),%rdx
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x100,%esi
mov    %rax,%rcx
call   1070 <strftime@plt>
xor    %eax,%eax
call   1040 <getpid@plt>
lea    0xe78(%rip),%rdi
mov    %rbx,%rsi
mov    %eax,%edx
mov    %r14,%rcx
call   1050 <printf@plt>
add    $0x118,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
@.str = [20 x i8] c"%Y-%m-%dT%H:%M:%S%z\00"
@.str.1 = [27 x i8] c"time=\22%s\22 pid=%d msg=\22%s\22\0A\00"
define void @_gigs_log(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca %struct.tm*
%5 = alloca [256 x i8]
store i8* %0, i8** %2
%6 = call i32 @time(i32* %3)
%7 = call %struct.tm* @localtime(i32* %3)
store %struct.tm* %7, %struct.tm** %4
%8 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%9 = load %struct.tm*, %struct.tm** %4
%10 = call i32 @strftime(i8* %8, i32 256, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), %struct.tm* %9)
%11 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%12 = call i32 (...) @getpid()
%13 = load i8*, i8** %2
%14 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i8* %11, i32 %12, i8* %13)
ret void
}

LLVM IR (-O2):
%struct.tm = type { i32 }
@.str = [20 x i8] c"%Y-%m-%dT%H:%M:%S%z\00"
@.str.1 = [27 x i8] c"time=\22%s\22 pid=%d msg=\22%s\22\0A\00"
define void @_gigs_log(i8* %0) {
%2 = alloca i32
%3 = alloca [256 x i8]
%4 = bitcast i32* %2 to i8*
%5 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%6 = call i32 @time(i32* %2)
%7 = call %struct.tm* @localtime(i32* %2)
%8 = call i32 @strftime(i8* %5, i32 256, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), %struct.tm* %7)
%9 = call i32 (...) @getpid()
%10 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i8* %5, i32 %9, i8* %0)
ret void
}