#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;
};
typedef int /*<<< orphan*/ buf;

/* Variables and functions */
struct tm *gmtime(int /*<<< orphan*/ *);
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ strftime(char *, int, char *, struct tm *);
const char *iso_time(time_t t, int utc_flag) {
  struct tm *tm;
  static char buf[128];
  if (utc_flag)
    tm = gmtime(&t);
  else
    tm = localtime(&t);
  strftime(buf, sizeof(buf), "%Y-%m-%dT%H:%M:%S", tm);
  return (buf);
}


x86 assembly (clang, -O0):
<iso_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     115a <iso_time+0x2a>
lea    -0x4(%rbp),%rdi
call   1050 <gmtime@plt>
mov    %rax,-0x10(%rbp)
jmp    1167 <iso_time+0x37>
lea    -0x4(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rcx
lea    0x2ede(%rip),%rdi
mov    $0x80,%esi
lea    0xe82(%rip),%rdx
call   1040 <strftime@plt>
lea    0x2ec6(%rip),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<iso_time>:
push   %rbx
sub    $0x10,%rsp
mov    %edi,0xc(%rsp)
lea    0xc(%rsp),%rdi
test   %esi,%esi
je     1149 <iso_time+0x19>
call   1050 <gmtime@plt>
jmp    114e <iso_time+0x1e>
call   1030 <localtime@plt>
lea    0x2efb(%rip),%rbx
lea    0xea4(%rip),%rdx
mov    %rbx,%rdi
mov    $0x80,%esi
mov    %rax,%rcx
call   1040 <strftime@plt>
mov    %rbx,%rax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
@iso_time.buf = internal global [128 x i8] zeroinitializer
@.str = [18 x i8] c"%Y-%m-%dT%H:%M:%S\00"
define i8* @iso_time(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca %struct.tm*
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = call %struct.tm* @gmtime(i32* %3)
store %struct.tm* %9, %struct.tm** %5
br label %12
10: ; preds = %2
%11 = call %struct.tm* @localtime(i32* %3)
store %struct.tm* %11, %struct.tm** %5
br label %12
12: ; preds = %10, %8
%13 = load %struct.tm*, %struct.tm** %5
%14 = call i32 @strftime(i8* getelementptr inbounds ([128 x i8], [128 x i8]* @iso_time.buf, i64 0, i64 0), i32 128, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), %struct.tm* %13)
ret i8* getelementptr inbounds ([128 x i8], [128 x i8]* @iso_time.buf, i64 0, i64 0)
}

LLVM IR (-O2):
%struct.tm = type { i32 }
@iso_time.buf = internal global [128 x i8] zeroinitializer
@.str = [18 x i8] c"%Y-%m-%dT%H:%M:%S\00"
define i8* @iso_time(i32 %0, i32 %1) {
%3 = alloca i32
store i32 %0, i32* %3
%4 = icmp eq i32 %1, 0
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = call %struct.tm* @gmtime(i32* %3)
br label %9
7: ; preds = %2
%8 = call %struct.tm* @localtime(i32* %3)
br label %9
9: ; preds = %7, %5
%10 = phi %struct.tm* [ %6, %5 ], [ %8, %7 ]
%11 = call i32 @strftime(i8* getelementptr inbounds ([128 x i8], [128 x i8]* @iso_time.buf, i64 0, i64 0), i32 128, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), %struct.tm* %10)
ret i8* getelementptr inbounds ([128 x i8], [128 x i8]* @iso_time.buf, i64 0, i64 0)
}