#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 */
char *print_dbppc_timestamp(int, struct file_header *, char *, char *, int,
                            unsigned long long);
int /*<<< orphan*/ printf(char *);
char *print_db_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);
  if (action & 0x01) {
    return print_dbppc_timestamp(1, file_hdr, cur_date, cur_time, utc, itv);
  }
  if (action & 0x04) {
    if ((((flags)&0x00000800) == 0x00000800)) {
      printf("\n");
    }
  }
  return NULL;
}


x86 assembly (clang, -O0):
<print_db_timestamp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x10(%rbp),%eax
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
mov    %r9,-0x38(%rbp)
mov    0x10(%rbp),%ecx
and    $0x4000,%ecx
xor    %eax,%eax
cmp    $0x4000,%ecx
mov    %al,-0x3d(%rbp)
je     116d <print_db_timestamp+0x4d>
mov    0x10(%rbp),%eax
and    $0x20,%eax
cmp    $0x20,%eax
sete   %al
xor    $0xff,%al
mov    %al,-0x3d(%rbp)
mov    -0x3d(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x3c(%rbp)
mov    -0x14(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     11ae <print_db_timestamp+0x8e>
mov    -0x38(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rcx
mov    -0x3c(%rbp),%r8d
mov    -0x30(%rbp),%r9
mov    $0x1,%edi
call   1040 <print_dbppc_timestamp@plt>
mov    %rax,-0x8(%rbp)
jmp    11e9 <print_db_timestamp+0xc9>
mov    -0x14(%rbp),%eax
and    $0x4,%eax
cmp    $0x0,%eax
je     11e1 <print_db_timestamp+0xc1>
mov    0x10(%rbp),%eax
and    $0x800,%eax
cmp    $0x800,%eax
jne    11dc <print_db_timestamp+0xbc>
lea    0xe29(%rip),%rdi
call   1030 <printf@plt>
jmp    11e1 <print_db_timestamp+0xc1>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_db_timestamp>:
push   %rax
mov    0x10(%rsp),%edi
test   $0x1,%sil
jne    1147 <print_db_timestamp+0x27>
test   $0x4,%sil
je     1143 <print_db_timestamp+0x23>
and    $0x800,%edi
je     1143 <print_db_timestamp+0x23>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
pop    %rcx
ret
mov    %r8,%rax
xor    %r8d,%r8d
test   $0x4020,%edi
sete   %r8b
mov    $0x1,%edi
mov    %r9,%rsi
mov    %rax,%r9
pop    %rax
jmp    1040 <print_dbppc_timestamp@plt>

LLVM IR (-O0):
%struct.file_header = type { i32 }
@.str = [2 x i8] c"\0A\00"
define i8* @print_db_timestamp(i8* %0, i32 %1, i8* %2, i8* %3, i64 %4, %struct.file_header* %5, i32 %6) {
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i32
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca i64
%14 = alloca %struct.file_header*
%15 = alloca i32
%16 = alloca i32
store i8* %0, i8** %9
store i32 %1, i32* %10
store i8* %2, i8** %11
store i8* %3, i8** %12
store i64 %4, i64* %13
store %struct.file_header* %5, %struct.file_header** %14
store i32 %6, i32* %15
%17 = load i32, i32* %15
%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* %15
%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* %16
%28 = load i32, i32* %10
%29 = and i32 %28, 1
%30 = icmp ne i32 %29, 0
br i1 %30, label %31, label %38
31: ; preds = %25
%32 = load %struct.file_header*, %struct.file_header** %14
%33 = load i8*, i8** %11
%34 = load i8*, i8** %12
%35 = load i32, i32* %16
%36 = load i64, i64* %13
%37 = call i8* @print_dbppc_timestamp(i32 1, %struct.file_header* %32, i8* %33, i8* %34, i32 %35, i64 %36)
store i8* %37, i8** %8
br label %50
38: ; preds = %25
%39 = load i32, i32* %10
%40 = and i32 %39, 4
%41 = icmp ne i32 %40, 0
br i1 %41, label %42, label %49
42: ; preds = %38
%43 = load i32, i32* %15
%44 = and i32 %43, 2048
%45 = icmp eq i32 %44, 2048
br i1 %45, label %46, label %48
46: ; preds = %42
%47 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %48
48: ; preds = %46, %42
br label %49
49: ; preds = %48, %38
store i8* null, i8** %8
br label %50
50: ; preds = %49, %31
%51 = load i8*, i8** %8
ret i8* %51
}

LLVM IR (-O2):
%struct.file_header = type { i32 }
define i8* @print_db_timestamp(i8* nocapture readnone %0, i32 %1, i8* %2, i8* %3, i64 %4, %struct.file_header* %5, i32 %6) {
%8 = and i32 %1, 1
%9 = icmp eq i32 %8, 0
br i1 %9, label %15, label %10
10: ; preds = %7
%11 = and i32 %6, 16416
%12 = icmp eq i32 %11, 0
%13 = zext i1 %12 to i32
%14 = tail call i8* @print_dbppc_timestamp(i32 1, %struct.file_header* %5, i8* %2, i8* %3, i32 %13, i64 %4)
br label %23
15: ; preds = %7
%16 = and i32 %1, 4
%17 = icmp eq i32 %16, 0
%18 = and i32 %6, 2048
%19 = icmp eq i32 %18, 0
%20 = or i1 %17, %19
br i1 %20, label %23, label %21
21: ; preds = %15
%22 = tail call i32 @putchar(i32 10)
br label %23
23: ; preds = %15, %21, %10
%24 = phi i8* [ %14, %10 ], [ null, %21 ], [ null, %15 ]
ret i8* %24
}