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

/* Variables and functions */
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, int, int, int, int, int, int);
int /*<<< orphan*/ stdout;
void printtime(int meg) {
  char timebuf[20];
  struct tm *t;
  struct timeval tv;
  time_t timeval;
  int gb = meg / 1024;
  int tgb = ((meg - gb * 1024) * 100) / 1024;
  gettimeofday(&tv, NULL);
  timeval = tv.tv_sec;
  t = localtime(&timeval);
  printf("%02d:%02d:%02d.%06d %2d.%02dG ", t->tm_hour, t->tm_min, t->tm_sec,
         (int)tv.tv_usec, gb, tgb);
  fflush(stdout);
}


x86 assembly (clang, -O0):
<printtime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x400,%ecx
cltd
idiv   %ecx
mov    %eax,-0x40(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x40(%rbp),%ecx
shl    $0xa,%ecx
sub    %ecx,%eax
imul   $0x64,%eax,%eax
mov    $0x400,%ecx
cltd
idiv   %ecx
mov    %eax,-0x44(%rbp)
lea    -0x38(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <gettimeofday@plt>
mov    -0x30(%rbp),%eax
mov    %eax,-0x3c(%rbp)
lea    -0x3c(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    (%rax),%esi
mov    -0x28(%rbp),%rax
mov    0x4(%rax),%edx
mov    -0x28(%rbp),%rax
mov    0x8(%rax),%ecx
mov    -0x38(%rbp),%rax
mov    %eax,%r8d
mov    -0x40(%rbp),%r9d
mov    -0x44(%rbp),%eax
lea    0xe45(%rip),%rdi
mov    %eax,(%rsp)
call   1040 <printf@plt>
mov    0x2e16(%rip),%rax
mov    (%rax),%edi
call   1060 <fflush@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printtime>:
push   %rbp
push   %rbx
sub    $0x28,%rsp
lea    0x3ff(%rdi),%eax
test   %edi,%edi
cmovns %edi,%eax
mov    %eax,%ebx
sar    $0xa,%ebx
and    $0xfffffc00,%eax
sub    %eax,%edi
imul   $0x64,%edi,%eax
lea    0x3ff(%rax),%ebp
test   %eax,%eax
cmovns %eax,%ebp
sar    $0xa,%ebp
lea    0x18(%rsp),%rdi
xor    %esi,%esi
call   1050 <gettimeofday@plt>
mov    0x20(%rsp),%eax
mov    %eax,0x14(%rsp)
lea    0x14(%rsp),%rdi
call   1030 <localtime@plt>
mov    (%rax),%esi
mov    0x4(%rax),%edx
mov    0x8(%rax),%ecx
mov    0x18(%rsp),%r8d
mov    %ebp,(%rsp)
lea    0xe5d(%rip),%rdi
mov    %ebx,%r9d
call   1040 <printf@plt>
mov    0x2e2e(%rip),%rax
mov    (%rax),%edi
call   1060 <fflush@plt>
add    $0x28,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.tm = type { i32, i32, i32 }
%struct.timeval = type { i64, i32 }
@.str = [31 x i8] c"%02d:%02d:%02d.%06d %2d.%02dG \00"
@stdout = global i32 0
define void @printtime(i32 %0) {
%2 = alloca i32
%3 = alloca [20 x i8]
%4 = alloca %struct.tm*
%5 = alloca %struct.timeval
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %2
%9 = load i32, i32* %2
%10 = sdiv i32 %9, 1024
store i32 %10, i32* %7
%11 = load i32, i32* %2
%12 = load i32, i32* %7
%13 = mul nsw i32 %12, 1024
%14 = sub nsw i32 %11, %13
%15 = mul nsw i32 %14, 100
%16 = sdiv i32 %15, 1024
store i32 %16, i32* %8
%17 = call i32 @gettimeofday(%struct.timeval* %5, i32* null)
%18 = getelementptr inbounds %struct.timeval, %struct.timeval* %5, i32 0, i32 1
%19 = load i32, i32* %18
store i32 %19, i32* %6
%20 = call %struct.tm* @localtime(i32* %6)
store %struct.tm* %20, %struct.tm** %4
%21 = load %struct.tm*, %struct.tm** %4
%22 = getelementptr inbounds %struct.tm, %struct.tm* %21, i32 0, i32 0
%23 = load i32, i32* %22
%24 = load %struct.tm*, %struct.tm** %4
%25 = getelementptr inbounds %struct.tm, %struct.tm* %24, i32 0, i32 1
%26 = load i32, i32* %25
%27 = load %struct.tm*, %struct.tm** %4
%28 = getelementptr inbounds %struct.tm, %struct.tm* %27, i32 0, i32 2
%29 = load i32, i32* %28
%30 = getelementptr inbounds %struct.timeval, %struct.timeval* %5, i32 0, i32 0
%31 = load i64, i64* %30
%32 = trunc i64 %31 to i32
%33 = load i32, i32* %7
%34 = load i32, i32* %8
%35 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i32 %23, i32 %26, i32 %29, i32 %32, i32 %33, i32 %34)
%36 = load i32, i32* @stdout
%37 = call i32 @fflush(i32 %36)
ret void
}

LLVM IR (-O2):
%struct.timeval = type { i64, i32 }
%struct.tm = type { i32, i32, i32 }
@.str = [31 x i8] c"%02d:%02d:%02d.%06d %2d.%02dG \00"
@stdout = global i32 0
define void @printtime(i32 %0) {
%2 = alloca %struct.timeval
%3 = alloca i32
%4 = bitcast %struct.timeval* %2 to i8*
%5 = bitcast i32* %3 to i8*
%6 = sdiv i32 %0, 1024
%7 = mul i32 %6, -1024
%8 = add i32 %7, %0
%9 = mul nsw i32 %8, 100
%10 = sdiv i32 %9, 1024
%11 = call i32 @gettimeofday(%struct.timeval* %2, i32* null)
%12 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i64 0, i32 1
%13 = load i32, i32* %12
store i32 %13, i32* %3
%14 = call %struct.tm* @localtime(i32* %3)
%15 = getelementptr inbounds %struct.tm, %struct.tm* %14, i64 0, i32 0
%16 = load i32, i32* %15
%17 = getelementptr inbounds %struct.tm, %struct.tm* %14, i64 0, i32 1
%18 = load i32, i32* %17
%19 = getelementptr inbounds %struct.tm, %struct.tm* %14, i64 0, i32 2
%20 = load i32, i32* %19
%21 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i64 0, i32 0
%22 = load i64, i64* %21
%23 = trunc i64 %22 to i32
%24 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i32 %16, i32 %18, i32 %20, i32 %23, i32 %6, i32 %10)
%25 = load i32, i32* @stdout
%26 = call i32 @fflush(i32 %25)
ret void
}