#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 uint8_t;
typedef int uint16_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int, int, int, int, int);
void print_dostime(const uint8_t *p) {
  uint16_t da = (p[3] << 8) + p[2];
  uint16_t ti = (p[1] << 8) + p[0];
  printf("%04u-%02u-%02u %02u:%02u:%02u", (da >> 9) + 1980, (da >> 5) & 15,
         da & 31, (ti >> 11), (ti >> 5) & 63, (ti << 1) & 63);
}


x86 assembly (clang, -O0):
<print_dostime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0xc(%rax),%eax
shl    $0x8,%eax
mov    -0x8(%rbp),%rcx
add    0x8(%rcx),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%eax
shl    $0x8,%eax
mov    -0x8(%rbp),%rcx
add    (%rcx),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%esi
sar    $0x9,%esi
add    $0x7bc,%esi
mov    -0xc(%rbp),%edx
sar    $0x5,%edx
and    $0xf,%edx
mov    -0xc(%rbp),%ecx
and    $0x1f,%ecx
mov    -0x10(%rbp),%r8d
sar    $0xb,%r8d
mov    -0x10(%rbp),%r9d
sar    $0x5,%r9d
and    $0x3f,%r9d
mov    -0x10(%rbp),%eax
shl    $0x1,%eax
and    $0x3f,%eax
lea    0xe7e(%rip),%rdi
mov    %eax,(%rsp)
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_dostime>:
push   %rax
mov    0x4(%rdi),%eax
mov    0xc(%rdi),%ecx
shl    $0x8,%ecx
add    0x8(%rdi),%ecx
shl    $0x8,%eax
add    (%rdi),%eax
mov    %ecx,%esi
sar    $0x9,%esi
add    $0x7bc,%esi
mov    %ecx,%edx
shr    $0x5,%edx
and    $0xf,%edx
and    $0x1f,%ecx
mov    %eax,%r8d
sar    $0xb,%r8d
mov    %eax,%r9d
shr    $0x5,%r9d
and    $0x3f,%r9d
add    %eax,%eax
and    $0x3e,%eax
mov    %eax,(%rsp)
lea    0xea7(%rip),%rdi
call   1030 <printf@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [30 x i8] c"%04u-%02u-%02u %02u:%02u:%02u\00"
define void @print_dostime(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32
store i32* %0, i32** %2
%5 = load i32*, i32** %2
%6 = getelementptr inbounds i32, i32* %5, i64 3
%7 = load i32, i32* %6
%8 = shl i32 %7, 8
%9 = load i32*, i32** %2
%10 = getelementptr inbounds i32, i32* %9, i64 2
%11 = load i32, i32* %10
%12 = add nsw i32 %8, %11
store i32 %12, i32* %3
%13 = load i32*, i32** %2
%14 = getelementptr inbounds i32, i32* %13, i64 1
%15 = load i32, i32* %14
%16 = shl i32 %15, 8
%17 = load i32*, i32** %2
%18 = getelementptr inbounds i32, i32* %17, i64 0
%19 = load i32, i32* %18
%20 = add nsw i32 %16, %19
store i32 %20, i32* %4
%21 = load i32, i32* %3
%22 = ashr i32 %21, 9
%23 = add nsw i32 %22, 1980
%24 = load i32, i32* %3
%25 = ashr i32 %24, 5
%26 = and i32 %25, 15
%27 = load i32, i32* %3
%28 = and i32 %27, 31
%29 = load i32, i32* %4
%30 = ashr i32 %29, 11
%31 = load i32, i32* %4
%32 = ashr i32 %31, 5
%33 = and i32 %32, 63
%34 = load i32, i32* %4
%35 = shl i32 %34, 1
%36 = and i32 %35, 63
%37 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 %23, i32 %26, i32 %28, i32 %30, i32 %33, i32 %36)
ret void
}

LLVM IR (-O2):
@.str = [30 x i8] c"%04u-%02u-%02u %02u:%02u:%02u\00"
define void @print_dostime(i32* nocapture %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 3
%3 = load i32, i32* %2
%4 = shl i32 %3, 8
%5 = getelementptr inbounds i32, i32* %0, i64 2
%6 = load i32, i32* %5
%7 = add nsw i32 %4, %6
%8 = getelementptr inbounds i32, i32* %0, i64 1
%9 = load i32, i32* %8
%10 = shl i32 %9, 8
%11 = load i32, i32* %0
%12 = add nsw i32 %10, %11
%13 = ashr i32 %7, 9
%14 = add nsw i32 %13, 1980
%15 = lshr i32 %7, 5
%16 = and i32 %15, 15
%17 = and i32 %7, 31
%18 = ashr i32 %12, 11
%19 = lshr i32 %12, 5
%20 = and i32 %19, 63
%21 = shl i32 %12, 1
%22 = and i32 %21, 62
%23 = tail call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 %14, i32 %16, i32 %17, i32 %18, i32 %20, i32 %22)
ret void
}