#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*/ dbgmem_dump_blocks();
int /*<<< orphan*/ logger_append_prefix(char *);
int /*<<< orphan*/ logger_clear_prefix();
int /*<<< orphan*/ logger_set_prepend_date();
int /*<<< orphan*/ logger_set_prepend_time();
int /*<<< orphan*/ logger_unset_prepend_date();
int /*<<< orphan*/ logger_unset_prepend_time();
scalar_t__ logger_write(int, char *);
scalar_t__ strlen(char *);
int main(int argc, char *argv[]) {
  int res = 0;
  logger_clear_prefix();
  logger_append_prefix("Testing ");
  logger_append_prefix("Logger : ");
  if (logger_write(1, ("testing\n")) != strlen("Testing Logger : testing\n")) {
    res = 1;
  }
  logger_clear_prefix();
  logger_set_prepend_date();
  logger_unset_prepend_time();
  if (logger_write(1, ("testing\n")) != strlen("AAAA/MM/DD testing\n")) {
    res = 1;
  }
  logger_unset_prepend_date();
  logger_set_prepend_time();
  if (logger_write(1, ("testing\n")) != strlen("HH:MM:SS testing\n")) {
    res = 1;
  }
  logger_set_prepend_date();
  logger_set_prepend_time();
  if (logger_write(1, ("testing\n")) !=
      strlen("AAAA/MM/DD HH:MM:SS testing\n")) {
    res = 1;
  }
  logger_append_prefix("Testing ");
  logger_append_prefix("Logger : ");
  if (logger_write(1, ("testing\n")) !=
      strlen("AAAA/MM/DD HH:MM:SS Testing Logger : testing\n")) {
    res = 1;
  }
  dbgmem_dump_blocks();
  return res;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    $0x0,%al
call   10a0 <logger_clear_prefix@plt>
lea    0xe45(%rip),%rdi
call   10b0 <logger_append_prefix@plt>
lea    0xe42(%rip),%rdi
call   10b0 <logger_append_prefix@plt>
mov    $0x1,%edi
lea    0xe91(%rip),%rsi
call   1050 <logger_write@plt>
mov    %rax,-0x20(%rbp)
lea    0xe70(%rip),%rdi
call   1030 <strlen@plt>
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
cmp    %rcx,%rax
je     1204 <main+0x74>
movl   $0x1,-0x14(%rbp)
mov    $0x0,%al
call   10a0 <logger_clear_prefix@plt>
mov    $0x0,%al
call   1070 <logger_set_prepend_date@plt>
mov    $0x0,%al
call   1080 <logger_unset_prepend_time@plt>
mov    $0x1,%edi
lea    0xe44(%rip),%rsi
call   1050 <logger_write@plt>
mov    %rax,-0x28(%rbp)
lea    0xdde(%rip),%rdi
call   1030 <strlen@plt>
mov    %rax,%rcx
mov    -0x28(%rbp),%rax
cmp    %rcx,%rax
je     1251 <main+0xc1>
movl   $0x1,-0x14(%rbp)
mov    $0x0,%al
call   1060 <logger_unset_prepend_date@plt>
mov    $0x0,%al
call   1040 <logger_set_prepend_time@plt>
mov    $0x1,%edi
lea    0xdfe(%rip),%rsi
call   1050 <logger_write@plt>
mov    %rax,-0x30(%rbp)
lea    0xdb7(%rip),%rdi
call   1030 <strlen@plt>
mov    %rax,%rcx
mov    -0x30(%rbp),%rax
cmp    %rcx,%rax
je     1297 <main+0x107>
movl   $0x1,-0x14(%rbp)
mov    $0x0,%al
call   1070 <logger_set_prepend_date@plt>
mov    $0x0,%al
call   1040 <logger_set_prepend_time@plt>
mov    $0x1,%edi
lea    0xdb8(%rip),%rsi
call   1050 <logger_write@plt>
mov    %rax,-0x38(%rbp)
lea    0xd66(%rip),%rdi
call   1030 <strlen@plt>
mov    %rax,%rcx
mov    -0x38(%rbp),%rax
cmp    %rcx,%rax
je     12dd <main+0x14d>
movl   $0x1,-0x14(%rbp)
lea    0xd1c(%rip),%rdi
call   10b0 <logger_append_prefix@plt>
lea    0xd19(%rip),%rdi
call   10b0 <logger_append_prefix@plt>
mov    $0x1,%edi
lea    0xd68(%rip),%rsi
call   1050 <logger_write@plt>
mov    %rax,-0x40(%rbp)
lea    0xd33(%rip),%rdi
call   1030 <strlen@plt>
mov    %rax,%rcx
mov    -0x40(%rbp),%rax
cmp    %rcx,%rax
je     132d <main+0x19d>
movl   $0x1,-0x14(%rbp)
mov    $0x0,%al
call   1090 <dbgmem_dump_blocks@plt>
mov    -0x14(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
xor    %eax,%eax
call   1090 <logger_clear_prefix@plt>
lea    0xe67(%rip),%r14
mov    %r14,%rdi
call   10a0 <logger_append_prefix@plt>
lea    0xe61(%rip),%r15
mov    %r15,%rdi
call   10a0 <logger_append_prefix@plt>
lea    0xe5c(%rip),%r12
mov    $0x1,%edi
mov    %r12,%rsi
call   1040 <logger_write@plt>
mov    %rax,%r13
xor    $0x19,%r13
xor    %eax,%eax
call   1090 <logger_clear_prefix@plt>
xor    %eax,%eax
call   1060 <logger_set_prepend_date@plt>
xor    %eax,%eax
call   1070 <logger_unset_prepend_time@plt>
mov    $0x1,%edi
mov    %r12,%rsi
call   1040 <logger_write@plt>
mov    %rax,%rbp
xor    $0x13,%rbp
xor    %eax,%eax
call   1050 <logger_unset_prepend_date@plt>
xor    %eax,%eax
call   1030 <logger_set_prepend_time@plt>
mov    $0x1,%edi
mov    %r12,%rsi
call   1040 <logger_write@plt>
mov    %rax,%rbx
xor    $0x11,%rbx
or     %rbp,%rbx
xor    %eax,%eax
call   1060 <logger_set_prepend_date@plt>
xor    %eax,%eax
call   1030 <logger_set_prepend_time@plt>
mov    $0x1,%edi
mov    %r12,%rsi
call   1040 <logger_write@plt>
mov    %rax,%rbp
xor    $0x1c,%rbp
mov    %r14,%rdi
call   10a0 <logger_append_prefix@plt>
mov    %r15,%rdi
call   10a0 <logger_append_prefix@plt>
mov    $0x1,%edi
mov    %r12,%rsi
call   1040 <logger_write@plt>
xor    $0x2d,%rax
or     %rbp,%rax
or     %rbx,%rax
xor    %ebx,%ebx
or     %r13,%rax
setne  %bl
xor    %eax,%eax
call   1080 <dbgmem_dump_blocks@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [9 x i8] c"Testing \00"
@.str.1 = [10 x i8] c"Logger : \00"
@.str.2 = [9 x i8] c"testing\0A\00"
@.str.3 = [26 x i8] c"Testing Logger : testing\0A\00"
@.str.4 = [20 x i8] c"AAAA/MM/DD testing\0A\00"
@.str.5 = [18 x i8] c"HH:MM:SS testing\0A\00"
@.str.6 = [29 x i8] c"AAAA/MM/DD HH:MM:SS testing\0A\00"
@.str.7 = [46 x i8] c"AAAA/MM/DD HH:MM:SS Testing Logger : testing\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
%7 = call i32 (...) @logger_clear_prefix()
%8 = call i32 @logger_append_prefix(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @logger_append_prefix(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%10 = call i64 @logger_write(i32 1, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%11 = call i64 @strlen(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
%12 = icmp ne i64 %10, %11
br i1 %12, label %13, label %14
13: ; preds = %2
store i32 1, i32* %6
br label %14
14: ; preds = %13, %2
%15 = call i32 (...) @logger_clear_prefix()
%16 = call i32 (...) @logger_set_prepend_date()
%17 = call i32 (...) @logger_unset_prepend_time()
%18 = call i64 @logger_write(i32 1, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%19 = call i64 @strlen(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0))
%20 = icmp ne i64 %18, %19
br i1 %20, label %21, label %22
21: ; preds = %14
store i32 1, i32* %6
br label %22
22: ; preds = %21, %14
%23 = call i32 (...) @logger_unset_prepend_date()
%24 = call i32 (...) @logger_set_prepend_time()
%25 = call i64 @logger_write(i32 1, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%26 = call i64 @strlen(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0))
%27 = icmp ne i64 %25, %26
br i1 %27, label %28, label %29
28: ; preds = %22
store i32 1, i32* %6
br label %29
29: ; preds = %28, %22
%30 = call i32 (...) @logger_set_prepend_date()
%31 = call i32 (...) @logger_set_prepend_time()
%32 = call i64 @logger_write(i32 1, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%33 = call i64 @strlen(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.6, i64 0, i64 0))
%34 = icmp ne i64 %32, %33
br i1 %34, label %35, label %36
35: ; preds = %29
store i32 1, i32* %6
br label %36
36: ; preds = %35, %29
%37 = call i32 @logger_append_prefix(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%38 = call i32 @logger_append_prefix(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%39 = call i64 @logger_write(i32 1, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%40 = call i64 @strlen(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.7, i64 0, i64 0))
%41 = icmp ne i64 %39, %40
br i1 %41, label %42, label %43
42: ; preds = %36
store i32 1, i32* %6
br label %43
43: ; preds = %42, %36
%44 = call i32 (...) @dbgmem_dump_blocks()
%45 = load i32, i32* %6
ret i32 %45
}

LLVM IR (-O2):
@.str = [9 x i8] c"Testing \00"
@.str.1 = [10 x i8] c"Logger : \00"
@.str.2 = [9 x i8] c"testing\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @logger_clear_prefix()
%4 = tail call i32 @logger_append_prefix(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 @logger_append_prefix(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%6 = tail call i64 @logger_write(i32 1, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%7 = icmp ne i64 %6, 25
%8 = tail call i32 (...) @logger_clear_prefix()
%9 = tail call i32 (...) @logger_set_prepend_date()
%10 = tail call i32 (...) @logger_unset_prepend_time()
%11 = tail call i64 @logger_write(i32 1, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%12 = icmp ne i64 %11, 19
%13 = tail call i32 (...) @logger_unset_prepend_date()
%14 = tail call i32 (...) @logger_set_prepend_time()
%15 = tail call i64 @logger_write(i32 1, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%16 = icmp ne i64 %15, 17
%17 = tail call i32 (...) @logger_set_prepend_date()
%18 = tail call i32 (...) @logger_set_prepend_time()
%19 = tail call i64 @logger_write(i32 1, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%20 = icmp ne i64 %19, 28
%21 = tail call i32 @logger_append_prefix(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%22 = tail call i32 @logger_append_prefix(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%23 = tail call i64 @logger_write(i32 1, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%24 = icmp ne i64 %23, 45
%25 = select i1 %24, i1 true, i1 %20
%26 = select i1 %25, i1 true, i1 %16
%27 = select i1 %26, i1 true, i1 %12
%28 = select i1 %27, i1 true, i1 %7
%29 = zext i1 %28 to i32
%30 = tail call i32 (...) @dbgmem_dump_blocks()
ret i32 %29
}