#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 */
scalar_t__ atoi(char *);
int /*<<< orphan*/ sprintf(char *, char *, unsigned long);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int /*<<< orphan*/ strncpy(char *, char *, int);
void event_lutos(unsigned long encoding, char *str, bool *isStart) {
  char str_enc[8192];
  char buf[8192];
  char date[8192];
  char hhmm[8192];
  char start[8192];
  strcpy(str, "");
  strcpy(buf, "");
  sprintf(str_enc, "%lu", encoding);
  strncpy(date, str_enc, 8);
  date[8] = '\0';
  strncpy(hhmm, str_enc + 8, 4);
  hhmm[12] = '\0';
  strcpy(start, str_enc + 12);
  strcat(buf, date);
  strcat(buf, "T");
  strcat(buf, hhmm);
  strcat(buf, "00");
  if (isStart != NULL) {
    if (atoi(start) == 0) {
      *isStart = true;
    } else {
      *isStart = false;
    }
  }
  strcpy(str, buf);
}


x86 assembly (clang, -O0):
<event_lutos>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa020,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe96(%rip),%rsi
call   1040 <strcpy@plt>
lea    -0x4020(%rbp),%rdi
lea    0xe83(%rip),%rsi
call   1040 <strcpy@plt>
lea    -0x2020(%rbp),%rdi
mov    -0x8(%rbp),%rdx
lea    0xe64(%rip),%rsi
call   1070 <sprintf@plt>
lea    -0x6020(%rbp),%rdi
lea    -0x2020(%rbp),%rsi
mov    $0x8,%edx
call   1030 <strncpy@plt>
movb   $0x0,-0x6018(%rbp)
lea    -0x8020(%rbp),%rdi
lea    -0x2020(%rbp),%rsi
add    $0x8,%rsi
mov    $0x4,%edx
call   1030 <strncpy@plt>
movb   $0x0,-0x8014(%rbp)
lea    -0xa020(%rbp),%rdi
lea    -0x2020(%rbp),%rsi
add    $0xc,%rsi
call   1040 <strcpy@plt>
lea    -0x4020(%rbp),%rdi
lea    -0x6020(%rbp),%rsi
call   1060 <strcat@plt>
lea    -0x4020(%rbp),%rdi
lea    0xde9(%rip),%rsi
call   1060 <strcat@plt>
lea    -0x4020(%rbp),%rdi
lea    -0x8020(%rbp),%rsi
call   1060 <strcat@plt>
lea    -0x4020(%rbp),%rdi
lea    0xdc5(%rip),%rsi
call   1060 <strcat@plt>
cmpq   $0x0,-0x18(%rbp)
je     1285 <event_lutos+0x135>
lea    -0xa020(%rbp),%rdi
call   1050 <atoi@plt>
cmp    $0x0,%rax
jne    1276 <event_lutos+0x126>
mov    -0x18(%rbp),%rax
movl   $0x1,(%rax)
jmp    1280 <event_lutos+0x130>
mov    -0x18(%rbp),%rax
movl   $0x0,(%rax)
jmp    1285 <event_lutos+0x135>
mov    -0x10(%rbp),%rdi
lea    -0x4020(%rbp),%rsi
call   1040 <strcpy@plt>
add    $0xa020,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<event_lutos>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xa000,%rsp
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
lea    0xe98(%rip),%r13
mov    %rsi,%rdi
mov    %r13,%rsi
call   1040 <strcpy@plt>
lea    0x8000(%rsp),%r12
mov    %r12,%rdi
mov    %r13,%rsi
call   1040 <strcpy@plt>
lea    0xe6b(%rip),%rsi
mov    %rsp,%r13
mov    %r13,%rdi
mov    %rbx,%rdx
call   1070 <sprintf@plt>
lea    0x6000(%rsp),%rbx
mov    %rbx,%rdi
mov    %r13,%rsi
mov    $0x8,%edx
call   1030 <strncpy@plt>
movb   $0x0,0x6008(%rsp)
lea    0x8(%rsp),%rsi
lea    0x4000(%rsp),%r13
mov    %r13,%rdi
mov    $0x4,%edx
call   1030 <strncpy@plt>
movb   $0x0,0x400c(%rsp)
lea    0xc(%rsp),%rsi
lea    0x2000(%rsp),%rdi
call   1040 <strcpy@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1060 <strcat@plt>
lea    0xdfb(%rip),%rsi
mov    %r12,%rdi
call   1060 <strcat@plt>
mov    %r12,%rdi
mov    %r13,%rsi
call   1060 <strcat@plt>
lea    0xde3(%rip),%rsi
mov    %r12,%rdi
call   1060 <strcat@plt>
test   %r14,%r14
je     1248 <event_lutos+0xf8>
lea    0x2000(%rsp),%rdi
call   1050 <atoi@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
mov    %ecx,(%r14)
lea    0x8000(%rsp),%rsi
mov    %r15,%rdi
call   1040 <strcpy@plt>
add    $0xa000,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
@.str.1 = [4 x i8] c"%lu\00"
@.str.2 = [2 x i8] c"T\00"
@.str.3 = [3 x i8] c"00\00"
define void @event_lutos(i64 %0, i8* %1, i32* %2) {
%4 = alloca i64
%5 = alloca i8*
%6 = alloca i32*
%7 = alloca [8192 x i8]
%8 = alloca [8192 x i8]
%9 = alloca [8192 x i8]
%10 = alloca [8192 x i8]
%11 = alloca [8192 x i8]
store i64 %0, i64* %4
store i8* %1, i8** %5
store i32* %2, i32** %6
%12 = load i8*, i8** %5
%13 = call i32 @strcpy(i8* %12, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%14 = getelementptr inbounds [8192 x i8], [8192 x i8]* %8, i64 0, i64 0
%15 = call i32 @strcpy(i8* %14, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%16 = getelementptr inbounds [8192 x i8], [8192 x i8]* %7, i64 0, i64 0
%17 = load i64, i64* %4
%18 = call i32 @sprintf(i8* %16, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i64 %17)
%19 = getelementptr inbounds [8192 x i8], [8192 x i8]* %9, i64 0, i64 0
%20 = getelementptr inbounds [8192 x i8], [8192 x i8]* %7, i64 0, i64 0
%21 = call i32 @strncpy(i8* %19, i8* %20, i32 8)
%22 = getelementptr inbounds [8192 x i8], [8192 x i8]* %9, i64 0, i64 8
store i8 0, i8* %22
%23 = getelementptr inbounds [8192 x i8], [8192 x i8]* %10, i64 0, i64 0
%24 = getelementptr inbounds [8192 x i8], [8192 x i8]* %7, i64 0, i64 0
%25 = getelementptr inbounds i8, i8* %24, i64 8
%26 = call i32 @strncpy(i8* %23, i8* %25, i32 4)
%27 = getelementptr inbounds [8192 x i8], [8192 x i8]* %10, i64 0, i64 12
store i8 0, i8* %27
%28 = getelementptr inbounds [8192 x i8], [8192 x i8]* %11, i64 0, i64 0
%29 = getelementptr inbounds [8192 x i8], [8192 x i8]* %7, i64 0, i64 0
%30 = getelementptr inbounds i8, i8* %29, i64 12
%31 = call i32 @strcpy(i8* %28, i8* %30)
%32 = getelementptr inbounds [8192 x i8], [8192 x i8]* %8, i64 0, i64 0
%33 = getelementptr inbounds [8192 x i8], [8192 x i8]* %9, i64 0, i64 0
%34 = call i32 @strcat(i8* %32, i8* %33)
%35 = getelementptr inbounds [8192 x i8], [8192 x i8]* %8, i64 0, i64 0
%36 = call i32 @strcat(i8* %35, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%37 = getelementptr inbounds [8192 x i8], [8192 x i8]* %8, i64 0, i64 0
%38 = getelementptr inbounds [8192 x i8], [8192 x i8]* %10, i64 0, i64 0
%39 = call i32 @strcat(i8* %37, i8* %38)
%40 = getelementptr inbounds [8192 x i8], [8192 x i8]* %8, i64 0, i64 0
%41 = call i32 @strcat(i8* %40, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%42 = load i32*, i32** %6
%43 = icmp ne i32* %42, null
br i1 %43, label %44, label %53
44: ; preds = %3
%45 = getelementptr inbounds [8192 x i8], [8192 x i8]* %11, i64 0, i64 0
%46 = call i64 @atoi(i8* %45)
%47 = icmp eq i64 %46, 0
br i1 %47, label %48, label %50
48: ; preds = %44
%49 = load i32*, i32** %6
store i32 1, i32* %49
br label %52
50: ; preds = %44
%51 = load i32*, i32** %6
store i32 0, i32* %51
br label %52
52: ; preds = %50, %48
br label %53
53: ; preds = %52, %3
%54 = load i8*, i8** %5
%55 = getelementptr inbounds [8192 x i8], [8192 x i8]* %8, i64 0, i64 0
%56 = call i32 @strcpy(i8* %54, i8* %55)
ret void
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
@.str.1 = [4 x i8] c"%lu\00"
@.str.2 = [2 x i8] c"T\00"
@.str.3 = [3 x i8] c"00\00"
define void @event_lutos(i64 %0, i8* %1, i32* writeonly %2) {
%4 = alloca [8192 x i8]
%5 = alloca [8192 x i8]
%6 = alloca [8192 x i8]
%7 = alloca [8192 x i8]
%8 = alloca [8192 x i8]
%9 = getelementptr inbounds [8192 x i8], [8192 x i8]* %4, i64 0, i64 0
%10 = getelementptr inbounds [8192 x i8], [8192 x i8]* %5, i64 0, i64 0
%11 = getelementptr inbounds [8192 x i8], [8192 x i8]* %6, i64 0, i64 0
%12 = getelementptr inbounds [8192 x i8], [8192 x i8]* %7, i64 0, i64 0
%13 = getelementptr inbounds [8192 x i8], [8192 x i8]* %8, i64 0, i64 0
%14 = tail call i32 @strcpy(i8* %1, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%15 = call i32 @strcpy(i8* %10, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%16 = call i32 @sprintf(i8* %9, i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i64 %0)
%17 = call i32 @strncpy(i8* %11, i8* %9, i32 8)
%18 = getelementptr inbounds [8192 x i8], [8192 x i8]* %6, i64 0, i64 8
store i8 0, i8* %18
%19 = getelementptr inbounds [8192 x i8], [8192 x i8]* %4, i64 0, i64 8
%20 = call i32 @strncpy(i8* %12, i8* %19, i32 4)
%21 = getelementptr inbounds [8192 x i8], [8192 x i8]* %7, i64 0, i64 12
store i8 0, i8* %21
%22 = getelementptr inbounds [8192 x i8], [8192 x i8]* %4, i64 0, i64 12
%23 = call i32 @strcpy(i8* %13, i8* %22)
%24 = call i32 @strcat(i8* %10, i8* %11)
%25 = call i32 @strcat(i8* %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%26 = call i32 @strcat(i8* %10, i8* %12)
%27 = call i32 @strcat(i8* %10, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%28 = icmp eq i32* %2, null
br i1 %28, label %33, label %29
29: ; preds = %3
%30 = call i64 @atoi(i8* %13)
%31 = icmp eq i64 %30, 0
%32 = zext i1 %31 to i32
store i32 %32, i32* %2
br label %33
33: ; preds = %29, %3
%34 = call i32 @strcpy(i8* %1, i8* %10)
ret void
}