#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 */
struct tm {
  int dummy;
};
struct timespec {
  int /*<<< orphan*/ tv_nsec;
  int /*<<< orphan*/ tv_sec;
};

/* Variables and functions */
int /*<<< orphan*/ CLOCK_REALTIME;
int /*<<< orphan*/ LC_TIME;
char *calloc(int, int);
int clock_gettime(int /*<<< orphan*/, struct timespec *);
int /*<<< orphan*/ free(char *);
struct tm *gmtime(int /*<<< orphan*/ *);
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ setlocale(int /*<<< orphan*/, char *);
int /*<<< orphan*/ sprintf(char *, char *, int /*<<< orphan*/);
int /*<<< orphan*/ strcpy(char *, char *);
char *strdup(int /*<<< orphan*/);
int /*<<< orphan*/ strftime(char *, int, char *, struct tm *);
size_t strlen(char *);
char *flu_tstamp(struct timespec *ts, int utc, char format) {
  if (ts == NULL) {
    struct timespec tss;
    int i = clock_gettime(CLOCK_REALTIME, &tss);
    if (i != 0)
      return NULL;
    ts = &tss;
  }
  if (format == 'z' || format == 'Z' || format == 'r' || format == 'g')
    utc = 1;
  struct tm *tm = utc ? gmtime(&ts->tv_sec) : localtime(&ts->tv_sec);
  if (tm == NULL)
    return NULL;
  char *r = calloc(32, sizeof(char));
  if (format == 'z' || format == 'Z') {
    strftime(r, 32, "%Y-%m-%dT%H:%M:%SZ", tm);
    return r;
  }
  if (format == 'r' || format == 'g') {
    char *loc = strdup(setlocale(LC_TIME, NULL));
    setlocale(LC_TIME, "en_US");
    strftime(r, 32, "%a, %d %b %Y %T UTC", tm);
    setlocale(LC_TIME, loc);
    free(loc);
    if (format == 'g')
      strcpy(r + strlen(r) - 3, "GMT");
    return r;
  }
  strftime(r, 32, "%Y%m%d.%H%M%S", tm);
  size_t l = strlen(r);
  if (format == 'h') {
    *(r + l - 2) = '\0';
    return r;
  }
  if (format == 's') {
    return r;
  }
  *(r + l) = '.';
  sprintf(r + l + 1, "%09li", ts->tv_nsec);
  size_t off = 9;
  if (format == 'u')
    off = 6;
  else if (format == 'm')
    off = 3;
  *(r + l + 1 + off) = '\0';
  return r;
}


x86 assembly (clang, -O0):
<flu_tstamp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %dl,%al
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %al,-0x15(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1203 <flu_tstamp+0x53>
mov    0x2e02(%rip),%rax
mov    (%rax),%edi
lea    -0x20(%rbp),%rsi
call   1060 <clock_gettime@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
je     11fb <flu_tstamp+0x4b>
movq   $0x0,-0x8(%rbp)
jmp    148a <flu_tstamp+0x2da>
lea    -0x20(%rbp),%rax
mov    %rax,-0x10(%rbp)
movsbl -0x15(%rbp),%eax
cmp    $0x7a,%eax
je     1237 <flu_tstamp+0x87>
movsbl -0x15(%rbp),%eax
cmp    $0x5a,%eax
je     1237 <flu_tstamp+0x87>
movsbl -0x15(%rbp),%eax
cmp    $0x72,%eax
je     1237 <flu_tstamp+0x87>
movsbl -0x15(%rbp),%eax
cmp    $0x67,%eax
jne    123e <flu_tstamp+0x8e>
movl   $0x1,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     125e <flu_tstamp+0xae>
mov    -0x10(%rbp),%rdi
add    $0x4,%rdi
call   10b0 <gmtime@plt>
mov    %rax,-0x58(%rbp)
jmp    126f <flu_tstamp+0xbf>
mov    -0x10(%rbp),%rdi
add    $0x4,%rdi
call   1040 <localtime@plt>
mov    %rax,-0x58(%rbp)
mov    -0x58(%rbp),%rax
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    128f <flu_tstamp+0xdf>
movq   $0x0,-0x8(%rbp)
jmp    148a <flu_tstamp+0x2da>
mov    $0x20,%edi
mov    $0x1,%esi
call   1080 <calloc@plt>
mov    %rax,-0x38(%rbp)
movsbl -0x15(%rbp),%eax
cmp    $0x7a,%eax
je     12bc <flu_tstamp+0x10c>
movsbl -0x15(%rbp),%eax
cmp    $0x5a,%eax
jne    12e2 <flu_tstamp+0x132>
mov    -0x38(%rbp),%rdi
mov    -0x30(%rbp),%rcx
mov    $0x20,%esi
lea    0xd30(%rip),%rdx
call   10a0 <strftime@plt>
mov    -0x38(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    148a <flu_tstamp+0x2da>
movsbl -0x15(%rbp),%eax
cmp    $0x72,%eax
je     12fc <flu_tstamp+0x14c>
movsbl -0x15(%rbp),%eax
cmp    $0x67,%eax
jne    13a4 <flu_tstamp+0x1f4>
mov    0x2ce5(%rip),%rax
mov    (%rax),%edi
xor    %eax,%eax
mov    %eax,%esi
call   1090 <setlocale@plt>
mov    %eax,%edi
call   10d0 <strdup@plt>
mov    %rax,-0x40(%rbp)
mov    0x2cc8(%rip),%rax
mov    (%rax),%edi
lea    0xcea(%rip),%rsi
call   1090 <setlocale@plt>
mov    -0x38(%rbp),%rdi
mov    -0x30(%rbp),%rcx
mov    $0x20,%esi
lea    0xcd7(%rip),%rdx
call   10a0 <strftime@plt>
mov    0x2c9a(%rip),%rax
mov    (%rax),%edi
mov    -0x40(%rbp),%rsi
call   1090 <setlocale@plt>
mov    -0x40(%rbp),%rdi
call   1030 <free@plt>
movsbl -0x15(%rbp),%eax
cmp    $0x67,%eax
jne    1397 <flu_tstamp+0x1e7>
mov    -0x38(%rbp),%rax
mov    %rax,-0x60(%rbp)
mov    -0x38(%rbp),%rdi
call   1070 <strlen@plt>
mov    -0x60(%rbp),%rdi
add    %rax,%rdi
add    $0xfffffffffffffffd,%rdi
lea    0xc9b(%rip),%rsi
call   1050 <strcpy@plt>
mov    -0x38(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    148a <flu_tstamp+0x2da>
mov    -0x38(%rbp),%rdi
mov    -0x30(%rbp),%rcx
mov    $0x20,%esi
lea    0xc79(%rip),%rdx
call   10a0 <strftime@plt>
mov    -0x38(%rbp),%rdi
call   1070 <strlen@plt>
mov    %rax,-0x48(%rbp)
movsbl -0x15(%rbp),%eax
cmp    $0x68,%eax
jne    13f1 <flu_tstamp+0x241>
mov    -0x38(%rbp),%rax
mov    -0x48(%rbp),%rcx
movb   $0x0,-0x2(%rax,%rcx,1)
mov    -0x38(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    148a <flu_tstamp+0x2da>
movsbl -0x15(%rbp),%eax
cmp    $0x73,%eax
jne    140b <flu_tstamp+0x25b>
mov    -0x38(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    148a <flu_tstamp+0x2da>
mov    -0x38(%rbp),%rax
mov    -0x48(%rbp),%rcx
movb   $0x2e,(%rax,%rcx,1)
mov    -0x38(%rbp),%rdi
add    -0x48(%rbp),%rdi
add    $0x1,%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%edx
lea    0xc0f(%rip),%rsi
call   10c0 <sprintf@plt>
movq   $0x9,-0x50(%rbp)
movsbl -0x15(%rbp),%eax
cmp    $0x75,%eax
jne    1457 <flu_tstamp+0x2a7>
movq   $0x6,-0x50(%rbp)
jmp    1471 <flu_tstamp+0x2c1>
movsbl -0x15(%rbp),%eax
cmp    $0x6d,%eax
jne    146c <flu_tstamp+0x2bc>
movq   $0x3,-0x50(%rbp)
jmp    1471 <flu_tstamp+0x2c1>
mov    -0x38(%rbp),%rax
add    -0x48(%rbp),%rax
mov    -0x50(%rbp),%rcx
movb   $0x0,0x1(%rax,%rcx,1)
mov    -0x38(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<flu_tstamp>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %edx,%r14d
mov    %esi,%ebx
mov    %rdi,%rbp
test   %rdi,%rdi
je     1233 <flu_tstamp+0x83>
lea    -0x5a(%r14),%eax
cmp    $0x20,%al
ja     12ef <flu_tstamp+0x13f>
movzbl %al,%eax
movabs $0x101002001,%rcx
bt     %rax,%rcx
jae    12ef <flu_tstamp+0x13f>
lea    0x4(%rbp),%rdi
call   10b0 <gmtime@plt>
mov    %rax,%r12
test   %rax,%rax
je     1251 <flu_tstamp+0xa1>
mov    %r14d,%ebx
and    $0xdf,%bl
mov    $0x20,%edi
mov    $0x1,%esi
call   1080 <calloc@plt>
mov    %rax,%r15
cmp    $0x5a,%bl
jne    1264 <flu_tstamp+0xb4>
lea    0xddf(%rip),%rdx
mov    %r15,%rdi
mov    $0x20,%esi
mov    %r12,%rcx
call   10a0 <strftime@plt>
jmp    1254 <flu_tstamp+0xa4>
mov    0x2d9e(%rip),%rax
mov    (%rax),%edi
lea    0x8(%rsp),%rbp
mov    %rbp,%rsi
call   1060 <clock_gettime@plt>
test   %eax,%eax
je     11c9 <flu_tstamp+0x19>
xor    %r15d,%r15d
mov    %r15,%rax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
cmp    $0x72,%r14b
je     1274 <flu_tstamp+0xc4>
cmp    $0x67,%r14b
jne    1305 <flu_tstamp+0x155>
mov    0x2d6d(%rip),%rbp
mov    0x0(%rbp),%edi
xor    %esi,%esi
call   1090 <setlocale@plt>
mov    %eax,%edi
call   10d0 <strdup@plt>
mov    %rax,%rbx
mov    0x0(%rbp),%edi
lea    0xd7a(%rip),%rsi
call   1090 <setlocale@plt>
lea    0xd74(%rip),%rdx
mov    %r15,%rdi
mov    $0x20,%esi
mov    %r12,%rcx
call   10a0 <strftime@plt>
mov    0x0(%rbp),%edi
mov    %rbx,%rsi
call   1090 <setlocale@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
cmp    $0x67,%r14b
jne    1254 <flu_tstamp+0xa4>
mov    %r15,%rdi
call   1070 <strlen@plt>
lea    (%r15,%rax,1),%rdi
add    $0xfffffffffffffffd,%rdi
lea    0xd48(%rip),%rsi
call   1050 <strcpy@plt>
jmp    1254 <flu_tstamp+0xa4>
test   %ebx,%ebx
jne    11ec <flu_tstamp+0x3c>
lea    0x4(%rbp),%rdi
call   1040 <localtime@plt>
jmp    11f5 <flu_tstamp+0x45>
lea    0xd25(%rip),%rdx
mov    %r15,%rdi
mov    $0x20,%esi
mov    %r12,%rcx
call   10a0 <strftime@plt>
mov    %r15,%rdi
call   1070 <strlen@plt>
cmp    $0x73,%r14b
je     1254 <flu_tstamp+0xa4>
cmp    $0x68,%r14b
jne    133f <flu_tstamp+0x18f>
movb   $0x0,-0x2(%r15,%rax,1)
jmp    1254 <flu_tstamp+0xa4>
lea    (%r15,%rax,1),%rbx
movb   $0x2e,(%r15,%rax,1)
lea    (%r15,%rax,1),%rdi
add    $0x1,%rdi
mov    0x0(%rbp),%edx
lea    0xce5(%rip),%rsi
call   10c0 <sprintf@plt>
cmp    $0x6d,%r14b
mov    $0x3,%eax
mov    $0x9,%ecx
cmove  %rax,%rcx
cmp    $0x75,%r14b
mov    $0x6,%eax
cmovne %rcx,%rax
movb   $0x0,0x1(%rax,%rbx,1)
jmp    1254 <flu_tstamp+0xa4>

LLVM IR (-O0):
%struct.timespec = type { i32, i32 }
%struct.tm = type { i32 }
@CLOCK_REALTIME = global i32 0
@.str = [19 x i8] c"%Y-%m-%dT%H:%M:%SZ\00"
@LC_TIME = global i32 0
@.str.1 = [6 x i8] c"en_US\00"
@.str.2 = [20 x i8] c"%a, %d %b %Y %T UTC\00"
@.str.3 = [4 x i8] c"GMT\00"
@.str.4 = [14 x i8] c"%Y%m%d.%H%M%S\00"
@.str.5 = [6 x i8] c"%09li\00"
define i8* @flu_tstamp(%struct.timespec* %0, i32 %1, i8 signext %2) {
%4 = alloca i8*
%5 = alloca %struct.timespec*
%6 = alloca i32
%7 = alloca i8
%8 = alloca %struct.timespec
%9 = alloca i32
%10 = alloca %struct.tm*
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca i64
%14 = alloca i64
store %struct.timespec* %0, %struct.timespec** %5
store i32 %1, i32* %6
store i8 %2, i8* %7
%15 = load %struct.timespec*, %struct.timespec** %5
%16 = icmp eq %struct.timespec* %15, null
br i1 %16, label %17, label %24
17: ; preds = %3
%18 = load i32, i32* @CLOCK_REALTIME
%19 = call i32 @clock_gettime(i32 %18, %struct.timespec* %8)
store i32 %19, i32* %9
%20 = load i32, i32* %9
%21 = icmp ne i32 %20, 0
br i1 %21, label %22, label %23
22: ; preds = %17
store i8* null, i8** %4
br label %156
23: ; preds = %17
store %struct.timespec* %8, %struct.timespec** %5
br label %24
24: ; preds = %23, %3
%25 = load i8, i8* %7
%26 = sext i8 %25 to i32
%27 = icmp eq i32 %26, 122
br i1 %27, label %40, label %28
28: ; preds = %24
%29 = load i8, i8* %7
%30 = sext i8 %29 to i32
%31 = icmp eq i32 %30, 90
br i1 %31, label %40, label %32
32: ; preds = %28
%33 = load i8, i8* %7
%34 = sext i8 %33 to i32
%35 = icmp eq i32 %34, 114
br i1 %35, label %40, label %36
36: ; preds = %32
%37 = load i8, i8* %7
%38 = sext i8 %37 to i32
%39 = icmp eq i32 %38, 103
br i1 %39, label %40, label %41
40: ; preds = %36, %32, %28, %24
store i32 1, i32* %6
br label %41
41: ; preds = %40, %36
%42 = load i32, i32* %6
%43 = icmp ne i32 %42, 0
br i1 %43, label %44, label %48
44: ; preds = %41
%45 = load %struct.timespec*, %struct.timespec** %5
%46 = getelementptr inbounds %struct.timespec, %struct.timespec* %45, i32 0, i32 1
%47 = call %struct.tm* @gmtime(i32* %46)
br label %52
48: ; preds = %41
%49 = load %struct.timespec*, %struct.timespec** %5
%50 = getelementptr inbounds %struct.timespec, %struct.timespec* %49, i32 0, i32 1
%51 = call %struct.tm* @localtime(i32* %50)
br label %52
52: ; preds = %48, %44
%53 = phi %struct.tm* [ %47, %44 ], [ %51, %48 ]
store %struct.tm* %53, %struct.tm** %10
%54 = load %struct.tm*, %struct.tm** %10
%55 = icmp eq %struct.tm* %54, null
br i1 %55, label %56, label %57
56: ; preds = %52
store i8* null, i8** %4
br label %156
57: ; preds = %52
%58 = call i8* @calloc(i32 32, i32 1)
store i8* %58, i8** %11
%59 = load i8, i8* %7
%60 = sext i8 %59 to i32
%61 = icmp eq i32 %60, 122
br i1 %61, label %66, label %62
62: ; preds = %57
%63 = load i8, i8* %7
%64 = sext i8 %63 to i32
%65 = icmp eq i32 %64, 90
br i1 %65, label %66, label %71
66: ; preds = %62, %57
%67 = load i8*, i8** %11
%68 = load %struct.tm*, %struct.tm** %10
%69 = call i32 @strftime(i8* %67, i32 32, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), %struct.tm* %68)
%70 = load i8*, i8** %11
store i8* %70, i8** %4
br label %156
71: ; preds = %62
%72 = load i8, i8* %7
%73 = sext i8 %72 to i32
%74 = icmp eq i32 %73, 114
br i1 %74, label %79, label %75
75: ; preds = %71
%76 = load i8, i8* %7
%77 = sext i8 %76 to i32
%78 = icmp eq i32 %77, 103
br i1 %78, label %79, label %105
79: ; preds = %75, %71
%80 = load i32, i32* @LC_TIME
%81 = call i32 @setlocale(i32 %80, i8* null)
%82 = call i8* @strdup(i32 %81)
store i8* %82, i8** %12
%83 = load i32, i32* @LC_TIME
%84 = call i32 @setlocale(i32 %83, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%85 = load i8*, i8** %11
%86 = load %struct.tm*, %struct.tm** %10
%87 = call i32 @strftime(i8* %85, i32 32, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), %struct.tm* %86)
%88 = load i32, i32* @LC_TIME
%89 = load i8*, i8** %12
%90 = call i32 @setlocale(i32 %88, i8* %89)
%91 = load i8*, i8** %12
%92 = call i32 @free(i8* %91)
%93 = load i8, i8* %7
%94 = sext i8 %93 to i32
%95 = icmp eq i32 %94, 103
br i1 %95, label %96, label %103
96: ; preds = %79
%97 = load i8*, i8** %11
%98 = load i8*, i8** %11
%99 = call i64 @strlen(i8* %98)
%100 = getelementptr inbounds i8, i8* %97, i64 %99
%101 = getelementptr inbounds i8, i8* %100, i64 -3
%102 = call i32 @strcpy(i8* %101, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
br label %103
103: ; preds = %96, %79
%104 = load i8*, i8** %11
store i8* %104, i8** %4
br label %156
105: ; preds = %75
%106 = load i8*, i8** %11
%107 = load %struct.tm*, %struct.tm** %10
%108 = call i32 @strftime(i8* %106, i32 32, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), %struct.tm* %107)
%109 = load i8*, i8** %11
%110 = call i64 @strlen(i8* %109)
store i64 %110, i64* %13
%111 = load i8, i8* %7
%112 = sext i8 %111 to i32
%113 = icmp eq i32 %112, 104
br i1 %113, label %114, label %120
114: ; preds = %105
%115 = load i8*, i8** %11
%116 = load i64, i64* %13
%117 = getelementptr inbounds i8, i8* %115, i64 %116
%118 = getelementptr inbounds i8, i8* %117, i64 -2
store i8 0, i8* %118
%119 = load i8*, i8** %11
store i8* %119, i8** %4
br label %156
120: ; preds = %105
%121 = load i8, i8* %7
%122 = sext i8 %121 to i32
%123 = icmp eq i32 %122, 115
br i1 %123, label %124, label %126
124: ; preds = %120
%125 = load i8*, i8** %11
store i8* %125, i8** %4
br label %156
126: ; preds = %120
%127 = load i8*, i8** %11
%128 = load i64, i64* %13
%129 = getelementptr inbounds i8, i8* %127, i64 %128
store i8 46, i8* %129
%130 = load i8*, i8** %11
%131 = load i64, i64* %13
%132 = getelementptr inbounds i8, i8* %130, i64 %131
%133 = getelementptr inbounds i8, i8* %132, i64 1
%134 = load %struct.timespec*, %struct.timespec** %5
%135 = getelementptr inbounds %struct.timespec, %struct.timespec* %134, i32 0, i32 0
%136 = load i32, i32* %135
%137 = call i32 @sprintf(i8* %133, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i32 %136)
store i64 9, i64* %14
%138 = load i8, i8* %7
%139 = sext i8 %138 to i32
%140 = icmp eq i32 %139, 117
br i1 %140, label %141, label %142
141: ; preds = %126
store i64 6, i64* %14
br label %148
142: ; preds = %126
%143 = load i8, i8* %7
%144 = sext i8 %143 to i32
%145 = icmp eq i32 %144, 109
br i1 %145, label %146, label %147
146: ; preds = %142
store i64 3, i64* %14
br label %147
147: ; preds = %146, %142
br label %148
148: ; preds = %147, %141
%149 = load i8*, i8** %11
%150 = load i64, i64* %13
%151 = getelementptr inbounds i8, i8* %149, i64 %150
%152 = getelementptr inbounds i8, i8* %151, i64 1
%153 = load i64, i64* %14
%154 = getelementptr inbounds i8, i8* %152, i64 %153
store i8 0, i8* %154
%155 = load i8*, i8** %11
store i8* %155, i8** %4
br label %156
156: ; preds = %148, %124, %114, %103, %66, %56, %22
%157 = load i8*, i8** %4
ret i8* %157
}

LLVM IR (-O2):
%struct.timespec = type { i32, i32 }
%struct.tm = type { i32 }
@CLOCK_REALTIME = global i32 0
@.str = [19 x i8] c"%Y-%m-%dT%H:%M:%SZ\00"
@LC_TIME = global i32 0
@.str.1 = [6 x i8] c"en_US\00"
@.str.2 = [20 x i8] c"%a, %d %b %Y %T UTC\00"
@.str.3 = [4 x i8] c"GMT\00"
@.str.4 = [14 x i8] c"%Y%m%d.%H%M%S\00"
@.str.5 = [6 x i8] c"%09li\00"
define i8* @flu_tstamp(%struct.timespec* %0, i32 %1, i8 signext %2) {
%4 = alloca %struct.timespec
%5 = icmp eq %struct.timespec* %0, null
br i1 %5, label %6, label %11
6: ; preds = %3
%7 = bitcast %struct.timespec* %4 to i8*
%8 = load i32, i32* @CLOCK_REALTIME
%9 = call i32 @clock_gettime(i32 %8, %struct.timespec* %4)
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %64
11: ; preds = %6, %3
%12 = phi %struct.timespec* [ %4, %6 ], [ %0, %3 ]
%13 = and i8 %2, -33
%14 = icmp eq i8 %13, 90
%15 = icmp eq i8 %2, 103
switch i8 %2, label %16 [
i8 122, label %18
i8 114, label %18
i8 103, label %18
i8 90, label %18
]
16: ; preds = %11
%17 = icmp eq i32 %1, 0
br i1 %17, label %21, label %18
18: ; preds = %11, %11, %11, %11, %16
%19 = getelementptr inbounds %struct.timespec, %struct.timespec* %12, i64 0, i32 1
%20 = call %struct.tm* @gmtime(i32* %19)
br label %24
21: ; preds = %16
%22 = getelementptr inbounds %struct.timespec, %struct.timespec* %12, i64 0, i32 1
%23 = call %struct.tm* @localtime(i32* %22)
br label %24
24: ; preds = %21, %18
%25 = phi %struct.tm* [ %20, %18 ], [ %23, %21 ]
%26 = icmp eq %struct.tm* %25, null
br i1 %26, label %64, label %27
27: ; preds = %24
%28 = call dereferenceable_or_null(32) i8* @calloc(i32 32, i32 1)
br i1 %14, label %29, label %31
29: ; preds = %27
%30 = call i32 @strftime(i8* %28, i32 32, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), %struct.tm* %25)
br label %64
31: ; preds = %27
switch i8 %2, label %47 [
i8 114, label %32
i8 103, label %32
]
32: ; preds = %31, %31
%33 = load i32, i32* @LC_TIME
%34 = call i32 @setlocale(i32 %33, i8* null)
%35 = call i8* @strdup(i32 %34)
%36 = load i32, i32* @LC_TIME
%37 = call i32 @setlocale(i32 %36, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%38 = call i32 @strftime(i8* %28, i32 32, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), %struct.tm* %25)
%39 = load i32, i32* @LC_TIME
%40 = call i32 @setlocale(i32 %39, i8* %35)
%41 = call i32 @free(i8* %35)
br i1 %15, label %42, label %64
42: ; preds = %32
%43 = call i64 @strlen(i8* dereferenceable(1) %28)
%44 = getelementptr inbounds i8, i8* %28, i64 %43
%45 = getelementptr inbounds i8, i8* %44, i64 -3
%46 = call i32 @strcpy(i8* %45, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
br label %64
47: ; preds = %31
%48 = call i32 @strftime(i8* %28, i32 32, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), %struct.tm* %25)
%49 = call i64 @strlen(i8* dereferenceable(1) %28)
switch i8 %2, label %53 [
i8 104, label %50
i8 115, label %64
]
50: ; preds = %47
%51 = getelementptr inbounds i8, i8* %28, i64 %49
%52 = getelementptr inbounds i8, i8* %51, i64 -2
store i8 0, i8* %52
br label %64
53: ; preds = %47
%54 = getelementptr inbounds i8, i8* %28, i64 %49
store i8 46, i8* %54
%55 = getelementptr inbounds i8, i8* %54, i64 1
%56 = getelementptr inbounds %struct.timespec, %struct.timespec* %12, i64 0, i32 0
%57 = load i32, i32* %56
%58 = call i32 @sprintf(i8* %55, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i32 %57)
%59 = icmp eq i8 %2, 109
%60 = select i1 %59, i64 3, i64 9
%61 = icmp eq i8 %2, 117
%62 = select i1 %61, i64 6, i64 %60
%63 = getelementptr inbounds i8, i8* %55, i64 %62
store i8 0, i8* %63
br label %64
64: ; preds = %6, %24, %50, %53, %47, %32, %42, %29
%65 = phi i8* [ null, %6 ], [ null, %24 ], [ %28, %50 ], [ %28, %53 ], [ %28, %47 ], [ %28, %32 ], [ %28, %42 ], [ %28, %29 ]
ret i8* %65
}