#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 tm_mday;
  int tm_mon;
  int tm_year;
  int tm_hour;
  int tm_min;
  int tm_sec;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fwrite(char *, int /*<<< orphan*/, int,
                          int /*<<< orphan*/ *);
int getppid();
struct tm *gmtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ sprintf(char *, char *, int, int, int, int, int, int, int,
                           char *);
int /*<<< orphan*/ strlen(char *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
void write_log_aux(FILE *file, char *str) {
  char line[200];
  time_t actual_time_;
  struct tm *actual_time;
  time(&actual_time_);
  actual_time = gmtime(&actual_time_);
  sprintf(line, "CAIXA %d - %.02d/%.02d/%.02d - %.02d:%.02d:%.02d - %s\n",
          getppid(), actual_time->tm_mday, (actual_time->tm_mon + 1),
          (actual_time->tm_year - 100), actual_time->tm_hour,
          actual_time->tm_min, actual_time->tm_sec, str);
  fwrite(line, strlen(line), 1, file);
}


x86 assembly (clang, -O0):
<write_log_aux>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
sub    $0x118,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
lea    -0xe4(%rbp),%rdi
call   1040 <time@plt>
lea    -0xe4(%rbp),%rdi
call   1050 <gmtime@plt>
mov    %rax,-0xf0(%rbp)
lea    -0xe0(%rbp),%rax
mov    %rax,-0x100(%rbp)
mov    $0x0,%al
call   1070 <getppid@plt>
mov    -0x100(%rbp),%rdi
mov    %eax,%edx
mov    -0xf0(%rbp),%rax
mov    (%rax),%ecx
mov    -0xf0(%rbp),%rax
mov    0x4(%rax),%r8d
add    $0x1,%r8d
mov    -0xf0(%rbp),%rax
mov    0x8(%rax),%r9d
sub    $0x64,%r9d
mov    -0xf0(%rbp),%rax
mov    0xc(%rax),%ebx
mov    -0xf0(%rbp),%rax
mov    0x10(%rax),%r11d
mov    -0xf0(%rbp),%rax
mov    0x14(%rax),%r10d
mov    -0x18(%rbp),%rax
lea    0xdfd(%rip),%rsi
mov    %ebx,(%rsp)
mov    %r11d,0x8(%rsp)
mov    %r10d,0x10(%rsp)
mov    %rax,0x18(%rsp)
call   1060 <sprintf@plt>
lea    -0xe0(%rbp),%rax
mov    %rax,-0xf8(%rbp)
lea    -0xe0(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0xf8(%rbp),%rdi
mov    %eax,%esi
mov    -0x10(%rbp),%rcx
mov    $0x1,%edx
call   1080 <fwrite@plt>
add    $0x118,%rsp
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_log_aux>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0xd8,%rsp
mov    %rsi,%r15
mov    %rdi,%r14
lea    0xc(%rsp),%rbx
mov    %rbx,%rdi
call   1040 <time@plt>
mov    %rbx,%rdi
call   1050 <gmtime@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1070 <getppid@plt>
mov    (%rbx),%ecx
mov    0x4(%rbx),%r8d
add    $0x1,%r8d
mov    0x8(%rbx),%r9d
add    $0xffffff9c,%r9d
mov    0xc(%rbx),%r10d
mov    0x10(%rbx),%r11d
mov    0x14(%rbx),%ebx
lea    0xe49(%rip),%rsi
lea    0x10(%rsp),%r12
mov    %r12,%rdi
mov    %eax,%edx
push   %r15
push   %rbx
push   %r11
push   %r10
call   1060 <sprintf@plt>
add    $0x20,%rsp
mov    %r12,%rdi
call   1030 <strlen@plt>
mov    %r12,%rdi
mov    %eax,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1080 <fwrite@plt>
add    $0xd8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.tm = type { i32, i32, i32, i32, i32, i32 }
@.str = [55 x i8] c"CAIXA %d - %.02d/%.02d/%.02d - %.02d:%.02d:%.02d - %s\0A\00"
define void @write_log_aux(i32* %0, i8* %1) {
%3 = alloca i32*
%4 = alloca i8*
%5 = alloca [200 x i8]
%6 = alloca i32
%7 = alloca %struct.tm*
store i32* %0, i32** %3
store i8* %1, i8** %4
%8 = call i32 @time(i32* %6)
%9 = call %struct.tm* @gmtime(i32* %6)
store %struct.tm* %9, %struct.tm** %7
%10 = getelementptr inbounds [200 x i8], [200 x i8]* %5, i64 0, i64 0
%11 = call i32 (...) @getppid()
%12 = load %struct.tm*, %struct.tm** %7
%13 = getelementptr inbounds %struct.tm, %struct.tm* %12, i32 0, i32 0
%14 = load i32, i32* %13
%15 = load %struct.tm*, %struct.tm** %7
%16 = getelementptr inbounds %struct.tm, %struct.tm* %15, i32 0, i32 1
%17 = load i32, i32* %16
%18 = add nsw i32 %17, 1
%19 = load %struct.tm*, %struct.tm** %7
%20 = getelementptr inbounds %struct.tm, %struct.tm* %19, i32 0, i32 2
%21 = load i32, i32* %20
%22 = sub nsw i32 %21, 100
%23 = load %struct.tm*, %struct.tm** %7
%24 = getelementptr inbounds %struct.tm, %struct.tm* %23, i32 0, i32 3
%25 = load i32, i32* %24
%26 = load %struct.tm*, %struct.tm** %7
%27 = getelementptr inbounds %struct.tm, %struct.tm* %26, i32 0, i32 4
%28 = load i32, i32* %27
%29 = load %struct.tm*, %struct.tm** %7
%30 = getelementptr inbounds %struct.tm, %struct.tm* %29, i32 0, i32 5
%31 = load i32, i32* %30
%32 = load i8*, i8** %4
%33 = call i32 @sprintf(i8* %10, i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str, i64 0, i64 0), i32 %11, i32 %14, i32 %18, i32 %22, i32 %25, i32 %28, i32 %31, i8* %32)
%34 = getelementptr inbounds [200 x i8], [200 x i8]* %5, i64 0, i64 0
%35 = getelementptr inbounds [200 x i8], [200 x i8]* %5, i64 0, i64 0
%36 = call i32 @strlen(i8* %35)
%37 = load i32*, i32** %3
%38 = call i32 @fwrite(i8* %34, i32 %36, i32 1, i32* %37)
ret void
}

LLVM IR (-O2):
%struct.tm = type { i32, i32, i32, i32, i32, i32 }
@.str = [55 x i8] c"CAIXA %d - %.02d/%.02d/%.02d - %.02d:%.02d:%.02d - %s\0A\00"
define void @write_log_aux(i32* nocapture %0, i8* %1) {
%3 = alloca [200 x i8]
%4 = alloca i32
%5 = getelementptr inbounds [200 x i8], [200 x i8]* %3, i64 0, i64 0
%6 = bitcast i32* %4 to i8*
%7 = call i32 @time(i32* %4)
%8 = call %struct.tm* @gmtime(i32* %4)
%9 = call i32 (...) @getppid()
%10 = getelementptr inbounds %struct.tm, %struct.tm* %8, i64 0, i32 0
%11 = load i32, i32* %10
%12 = getelementptr inbounds %struct.tm, %struct.tm* %8, i64 0, i32 1
%13 = load i32, i32* %12
%14 = add nsw i32 %13, 1
%15 = getelementptr inbounds %struct.tm, %struct.tm* %8, i64 0, i32 2
%16 = load i32, i32* %15
%17 = add nsw i32 %16, -100
%18 = getelementptr inbounds %struct.tm, %struct.tm* %8, i64 0, i32 3
%19 = load i32, i32* %18
%20 = getelementptr inbounds %struct.tm, %struct.tm* %8, i64 0, i32 4
%21 = load i32, i32* %20
%22 = getelementptr inbounds %struct.tm, %struct.tm* %8, i64 0, i32 5
%23 = load i32, i32* %22
%24 = call i32 @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @.str, i64 0, i64 0), i32 %9, i32 %11, i32 %14, i32 %17, i32 %19, i32 %21, i32 %23, i8* %1)
%25 = call i32 @strlen(i8* %5)
%26 = call i32 @fwrite(i8* %5, i32 %25, i32 1, i32* %0)
ret void
}