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

/* Variables and functions */
scalar_t__ EOF;
int EXIT_FAILURE;
int EXIT_SUCCESS;
scalar_t__ fflush(int /*<<< orphan*/);
struct tm *localtime(int *);
scalar_t__ printf(char *, char *);
int /*<<< orphan*/ stdout;
scalar_t__ strftime(char *, int, char *, struct tm *);
int time(int /*<<< orphan*/ *);
int put_infos(char *format) {
  char buf[256];
  time_t ct;
  struct tm *lt;
  if ((ct = time(NULL)) != -1 && (lt = localtime(&ct)) != NULL &&
      strftime(buf, sizeof(buf), format, lt) > 0 && printf("%s\n", buf) > 0 &&
      fflush(stdout) != EOF)
    return EXIT_SUCCESS;
  else
    return EXIT_FAILURE;
}


x86 assembly (clang, -O0):
<put_infos>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
mov    %rdi,-0x10(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %eax,-0x114(%rbp)
cmp    $0xffffffff,%eax
je     1206 <put_infos+0xb6>
lea    -0x114(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x120(%rbp)
cmp    $0x0,%rax
je     1206 <put_infos+0xb6>
lea    -0x110(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x120(%rbp),%rcx
mov    $0x100,%esi
call   1070 <strftime@plt>
cmp    $0x0,%rax
jle    1206 <put_infos+0xb6>
lea    -0x110(%rbp),%rsi
lea    0xe38(%rip),%rdi
call   1040 <printf@plt>
cmp    $0x0,%rax
jle    1206 <put_infos+0xb6>
mov    0x2df2(%rip),%rax
mov    (%rax),%edi
call   1060 <fflush@plt>
mov    0x2dfc(%rip),%rcx
cmp    (%rcx),%rax
je     1206 <put_infos+0xb6>
mov    0x2dcc(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1212 <put_infos+0xc2>
mov    0x2dcb(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<put_infos>:
push   %rbx
sub    $0x110,%rsp
mov    %rdi,%rbx
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,0xc(%rsp)
cmp    $0xffffffff,%eax
je     11c4 <put_infos+0x74>
lea    0xc(%rsp),%rdi
call   1030 <localtime@plt>
test   %rax,%rax
je     11c4 <put_infos+0x74>
lea    0x10(%rsp),%rdi
mov    $0x100,%esi
mov    %rbx,%rdx
mov    %rax,%rcx
call   1070 <strftime@plt>
test   %rax,%rax
jle    11c4 <put_infos+0x74>
lea    0xe65(%rip),%rdi
lea    0x10(%rsp),%rsi
call   1040 <printf@plt>
test   %rax,%rax
jle    11c4 <put_infos+0x74>
mov    0x2e1f(%rip),%rax
mov    (%rax),%edi
call   1060 <fflush@plt>
mov    0x2e29(%rip),%rcx
cmp    (%rcx),%rax
jne    11d6 <put_infos+0x86>
mov    0x2e0d(%rip),%rax
mov    (%rax),%eax
add    $0x110,%rsp
pop    %rbx
ret
mov    0x2deb(%rip),%rax
jmp    11cb <put_infos+0x7b>

LLVM IR (-O0):
%struct.tm = type { i32 }
@.str = [4 x i8] c"%s\0A\00"
@stdout = global i32 0
@EOF = global i64 0
@EXIT_SUCCESS = global i32 0
@EXIT_FAILURE = global i32 0
define i32 @put_infos(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca [256 x i8]
%5 = alloca i32
%6 = alloca %struct.tm*
store i8* %0, i8** %3
%7 = call i32 @time(i32* null)
store i32 %7, i32* %5
%8 = icmp ne i32 %7, -1
br i1 %8, label %9, label %29
9: ; preds = %1
%10 = call %struct.tm* @localtime(i32* %5)
store %struct.tm* %10, %struct.tm** %6
%11 = icmp ne %struct.tm* %10, null
br i1 %11, label %12, label %29
12: ; preds = %9
%13 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%14 = load i8*, i8** %3
%15 = load %struct.tm*, %struct.tm** %6
%16 = call i64 @strftime(i8* %13, i32 256, i8* %14, %struct.tm* %15)
%17 = icmp sgt i64 %16, 0
br i1 %17, label %18, label %29
18: ; preds = %12
%19 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%20 = call i64 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %19)
%21 = icmp sgt i64 %20, 0
br i1 %21, label %22, label %29
22: ; preds = %18
%23 = load i32, i32* @stdout
%24 = call i64 @fflush(i32 %23)
%25 = load i64, i64* @EOF
%26 = icmp ne i64 %24, %25
br i1 %26, label %27, label %29
27: ; preds = %22
%28 = load i32, i32* @EXIT_SUCCESS
store i32 %28, i32* %2
br label %31
29: ; preds = %22, %18, %12, %9, %1
%30 = load i32, i32* @EXIT_FAILURE
store i32 %30, i32* %2
br label %31
31: ; preds = %29, %27
%32 = load i32, i32* %2
ret i32 %32
}

LLVM IR (-O2):
%struct.tm = type { i32 }
@.str = [4 x i8] c"%s\0A\00"
@stdout = global i32 0
@EOF = global i64 0
@EXIT_SUCCESS = global i32 0
@EXIT_FAILURE = global i32 0
define i32 @put_infos(i8* %0) {
%2 = alloca [256 x i8]
%3 = alloca i32
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%5 = bitcast i32* %3 to i8*
%6 = tail call i32 @time(i32* null)
store i32 %6, i32* %3
%7 = icmp eq i32 %6, -1
br i1 %7, label %22, label %8
8: ; preds = %1
%9 = call %struct.tm* @localtime(i32* %3)
%10 = icmp eq %struct.tm* %9, null
br i1 %10, label %22, label %11
11: ; preds = %8
%12 = call i64 @strftime(i8* %4, i32 256, i8* %0, %struct.tm* %9)
%13 = icmp sgt i64 %12, 0
br i1 %13, label %14, label %22
14: ; preds = %11
%15 = call i64 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %4)
%16 = icmp sgt i64 %15, 0
br i1 %16, label %17, label %22
17: ; preds = %14
%18 = load i32, i32* @stdout
%19 = call i64 @fflush(i32 %18)
%20 = load i64, i64* @EOF
%21 = icmp eq i64 %19, %20
br i1 %21, label %22, label %23
22: ; preds = %17, %14, %11, %8, %1
br label %23
23: ; preds = %17, %22
%24 = phi i32* [ @EXIT_FAILURE, %22 ], [ @EXIT_SUCCESS, %17 ]
%25 = load i32, i32* %24
ret i32 %25
}