#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 {
  scalar_t__ tm_sec;
  scalar_t__ tm_min;
  scalar_t__ tm_hour;
};
struct timeval {
  int tv_usec;
  int /*<<< orphan*/ tv_sec;
};

/* Variables and functions */
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, int, int, int, int);
void z_ms_day_print(struct timeval *t) {
  struct tm *ti;
  ti = localtime(&t->tv_sec);
  printf("%02d:%02d:%02d.%03d", (int)ti->tm_hour, (int)ti->tm_min,
         (int)ti->tm_sec, (int)(t->tv_usec / 1000));
}


x86 assembly (clang, -O0):
<z_ms_day_print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
add    $0x4,%rdi
call   1030 <localtime@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %eax,%esi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    $0x3e8,%edi
cltd
idiv   %edi
mov    -0x14(%rbp),%edx
mov    %eax,%r8d
lea    0xe8a(%rip),%rdi
call   1040 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<z_ms_day_print>:
push   %rbx
mov    %rdi,%rbx
add    $0x4,%rdi
call   1030 <localtime@plt>
mov    0x10(%rax),%esi
mov    (%rax),%ecx
mov    0x8(%rax),%edx
movslq (%rbx),%rax
imul   $0x10624dd3,%rax,%r8
mov    %r8,%rax
shr    $0x3f,%rax
sar    $0x26,%r8
add    %eax,%r8d
lea    0xeac(%rip),%rdi
pop    %rbx
jmp    1040 <printf@plt>

LLVM IR (-O0):
%struct.timeval = type { i32, i32 }
%struct.tm = type { i64, i64, i64 }
@.str = [20 x i8] c"%02d:%02d:%02d.%03d\00"
define void @z_ms_day_print(%struct.timeval* %0) {
%2 = alloca %struct.timeval*
%3 = alloca %struct.tm*
store %struct.timeval* %0, %struct.timeval** %2
%4 = load %struct.timeval*, %struct.timeval** %2
%5 = getelementptr inbounds %struct.timeval, %struct.timeval* %4, i32 0, i32 1
%6 = call %struct.tm* @localtime(i32* %5)
store %struct.tm* %6, %struct.tm** %3
%7 = load %struct.tm*, %struct.tm** %3
%8 = getelementptr inbounds %struct.tm, %struct.tm* %7, i32 0, i32 2
%9 = load i64, i64* %8
%10 = trunc i64 %9 to i32
%11 = load %struct.tm*, %struct.tm** %3
%12 = getelementptr inbounds %struct.tm, %struct.tm* %11, i32 0, i32 1
%13 = load i64, i64* %12
%14 = trunc i64 %13 to i32
%15 = load %struct.tm*, %struct.tm** %3
%16 = getelementptr inbounds %struct.tm, %struct.tm* %15, i32 0, i32 0
%17 = load i64, i64* %16
%18 = trunc i64 %17 to i32
%19 = load %struct.timeval*, %struct.timeval** %2
%20 = getelementptr inbounds %struct.timeval, %struct.timeval* %19, i32 0, i32 0
%21 = load i32, i32* %20
%22 = sdiv i32 %21, 1000
%23 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %10, i32 %14, i32 %18, i32 %22)
ret void
}

LLVM IR (-O2):
%struct.timeval = type { i32, i32 }
%struct.tm = type { i64, i64, i64 }
@.str = [20 x i8] c"%02d:%02d:%02d.%03d\00"
define void @z_ms_day_print(%struct.timeval* %0) {
%2 = getelementptr inbounds %struct.timeval, %struct.timeval* %0, i64 0, i32 1
%3 = tail call %struct.tm* @localtime(i32* %2)
%4 = getelementptr inbounds %struct.tm, %struct.tm* %3, i64 0, i32 2
%5 = load i64, i64* %4
%6 = trunc i64 %5 to i32
%7 = getelementptr inbounds %struct.tm, %struct.tm* %3, i64 0, i32 1
%8 = load i64, i64* %7
%9 = trunc i64 %8 to i32
%10 = getelementptr inbounds %struct.tm, %struct.tm* %3, i64 0, i32 0
%11 = load i64, i64* %10
%12 = trunc i64 %11 to i32
%13 = getelementptr inbounds %struct.timeval, %struct.timeval* %0, i64 0, i32 0
%14 = load i32, i32* %13
%15 = sdiv i32 %14, 1000
%16 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %6, i32 %9, i32 %12, i32 %15)
ret void
}