#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 file_header {
  int dummy;
};
typedef int flags;

/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ xprintf0(int, char *, char *, char *, int,
                            unsigned long long);
char *print_json_timestamp(void *parm, int action, char *cur_date,
                           char *cur_time, unsigned long long itv,
                           struct file_header *file_hdr, unsigned int flags) {
  int utc = !(((flags)&0x00004000) == 0x00004000) &&
            !(((flags)&0x00000020) == 0x00000020);
  int *tab = (int *)parm;
  if (action & 0x01) {
    xprintf0(*tab,
             "\"timestamp\": {\"date\": \"%s\", \"time\": \"%s\", "
             "\"utc\": %d, \"interval\": %llu}",
             cur_date, cur_time, utc ? 1 : 0, itv);
  }
  if (action & 0x02) {
    printf(",\n");
  }
  if (action & 0x04) {
    printf("\n");
  }
  return NULL;
}


x86 assembly (clang, -O0):
<print_json_timestamp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    0x10(%rbp),%eax
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    0x10(%rbp),%ecx
and    $0x4000,%ecx
xor    %eax,%eax
cmp    $0x4000,%ecx
mov    %al,-0x41(%rbp)
je     116d <print_json_timestamp+0x4d>
mov    0x10(%rbp),%eax
and    $0x20,%eax
cmp    $0x20,%eax
sete   %al
xor    $0xff,%al
mov    %al,-0x41(%rbp)
mov    -0x41(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x34(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0xc(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     11bf <print_json_timestamp+0x9f>
mov    -0x40(%rbp),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x34(%rbp),%esi
xor    %r8d,%r8d
mov    $0x1,%eax
cmp    $0x0,%esi
cmovne %eax,%r8d
mov    -0x28(%rbp),%r9
lea    0xe46(%rip),%rsi
call   1040 <xprintf0@plt>
mov    -0xc(%rbp),%eax
and    $0x2,%eax
cmp    $0x0,%eax
je     11da <print_json_timestamp+0xba>
lea    0xe72(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
and    $0x4,%eax
cmp    $0x0,%eax
je     11f5 <print_json_timestamp+0xd5>
lea    0xe58(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_json_timestamp>:
push   %rbx
mov    %esi,%ebx
test   $0x1,%bl
jne    1150 <print_json_timestamp+0x20>
test   $0x2,%bl
jne    1175 <print_json_timestamp+0x45>
test   $0x4,%bl
je     114c <print_json_timestamp+0x1c>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
pop    %rbx
ret
mov    %r8,%r9
xor    %r8d,%r8d
testl  $0x4020,0x10(%rsp)
sete   %r8b
mov    (%rdi),%edi
lea    0xe95(%rip),%rsi
call   1050 <xprintf0@plt>
test   $0x2,%bl
je     113d <print_json_timestamp+0xd>
lea    0xecb(%rip),%rdi
call   1040 <puts@plt>
test   $0x4,%bl
jne    1142 <print_json_timestamp+0x12>
jmp    114c <print_json_timestamp+0x1c>

LLVM IR (-O0):
%struct.file_header = type { i32 }
@.str = [71 x i8] c"\22timestamp\22: {\22date\22: \22%s\22, \22time\22: \22%s\22, \22utc\22: %d, \22interval\22: %llu}\00"
@.str.1 = [3 x i8] c",\0A\00"
@.str.2 = [2 x i8] c"\0A\00"
define i8* @print_json_timestamp(i8* %0, i32 %1, i8* %2, i8* %3, i64 %4, %struct.file_header* %5, i32 %6) {
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i64
%13 = alloca %struct.file_header*
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32*
store i8* %0, i8** %8
store i32 %1, i32* %9
store i8* %2, i8** %10
store i8* %3, i8** %11
store i64 %4, i64* %12
store %struct.file_header* %5, %struct.file_header** %13
store i32 %6, i32* %14
%17 = load i32, i32* %14
%18 = and i32 %17, 16384
%19 = icmp eq i32 %18, 16384
br i1 %19, label %25, label %20
20: ; preds = %7
%21 = load i32, i32* %14
%22 = and i32 %21, 32
%23 = icmp eq i32 %22, 32
%24 = xor i1 %23, true
br label %25
25: ; preds = %20, %7
%26 = phi i1 [ false, %7 ], [ %24, %20 ]
%27 = zext i1 %26 to i32
store i32 %27, i32* %15
%28 = load i8*, i8** %8
%29 = bitcast i8* %28 to i32*
store i32* %29, i32** %16
%30 = load i32, i32* %9
%31 = and i32 %30, 1
%32 = icmp ne i32 %31, 0
br i1 %32, label %33, label %44
33: ; preds = %25
%34 = load i32*, i32** %16
%35 = load i32, i32* %34
%36 = load i8*, i8** %10
%37 = load i8*, i8** %11
%38 = load i32, i32* %15
%39 = icmp ne i32 %38, 0
%40 = zext i1 %39 to i64
%41 = select i1 %39, i32 1, i32 0
%42 = load i64, i64* %12
%43 = call i32 @xprintf0(i32 %35, i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str, i64 0, i64 0), i8* %36, i8* %37, i32 %41, i64 %42)
br label %44
44: ; preds = %33, %25
%45 = load i32, i32* %9
%46 = and i32 %45, 2
%47 = icmp ne i32 %46, 0
br i1 %47, label %48, label %50
48: ; preds = %44
%49 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %50
50: ; preds = %48, %44
%51 = load i32, i32* %9
%52 = and i32 %51, 4
%53 = icmp ne i32 %52, 0
br i1 %53, label %54, label %56
54: ; preds = %50
%55 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %56
56: ; preds = %54, %50
ret i8* null
}

LLVM IR (-O2):
%struct.file_header = type { i32 }
@.str = [71 x i8] c"\22timestamp\22: {\22date\22: \22%s\22, \22time\22: \22%s\22, \22utc\22: %d, \22interval\22: %llu}\00"
@str = [2 x i8] c",\00"
define noalias i8* @print_json_timestamp(i8* nocapture %0, i32 %1, i8* %2, i8* %3, i64 %4, %struct.file_header* nocapture readnone %5, i32 %6) {
%8 = and i32 %1, 1
%9 = icmp eq i32 %8, 0
br i1 %9, label %17, label %10
10: ; preds = %7
%11 = bitcast i8* %0 to i32*
%12 = and i32 %6, 16416
%13 = icmp eq i32 %12, 0
%14 = load i32, i32* %11
%15 = zext i1 %13 to i32
%16 = tail call i32 @xprintf0(i32 %14, i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str, i64 0, i64 0), i8* %2, i8* %3, i32 %15, i64 %4)
br label %17
17: ; preds = %10, %7
%18 = and i32 %1, 2
%19 = icmp eq i32 %18, 0
br i1 %19, label %22, label %20
20: ; preds = %17
%21 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
br label %22
22: ; preds = %20, %17
%23 = and i32 %1, 4
%24 = icmp eq i32 %23, 0
br i1 %24, label %27, label %25
25: ; preds = %22
%26 = tail call i32 @putchar(i32 10)
br label %27
27: ; preds = %25, %22
ret i8* null
}