#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 {
  char tm_hour;
  char tm_min;
  char tm_sec;
};

/* Variables and functions */
struct tm *gmtime(int /*<<< orphan*/ *);
double modJulianDate(struct tm *);
void setMicomTime(time_t theGMTTime, char *destString) {
  struct tm *now_tm;
  now_tm = gmtime(&theGMTTime);
  double mjd = modJulianDate(now_tm);
  int mjd_int = mjd;
  destString[0] = (mjd_int >> 8);
  destString[1] = (mjd_int & 0xff);
  destString[2] = now_tm->tm_hour;
  destString[3] = now_tm->tm_min;
  destString[4] = now_tm->tm_sec;
}


x86 assembly (clang, -O0):
<setMicomTime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x4(%rbp),%rdi
call   1040 <gmtime@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <modJulianDate@plt>
movsd  %xmm0,-0x20(%rbp)
cvttsd2si -0x20(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
sar    $0x8,%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
mov    -0x24(%rbp),%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,0x1(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%cl
mov    -0x10(%rbp),%rax
mov    %cl,0x2(%rax)
mov    -0x18(%rbp),%rax
mov    0x1(%rax),%cl
mov    -0x10(%rbp),%rax
mov    %cl,0x3(%rax)
mov    -0x18(%rbp),%rax
mov    0x2(%rax),%cl
mov    -0x10(%rbp),%rax
mov    %cl,0x4(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setMicomTime>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %edi,0x4(%rsp)
lea    0x4(%rsp),%rdi
call   1040 <gmtime@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1030 <modJulianDate@plt>
cvttsd2si %xmm0,%eax
rol    $0x8,%ax
mov    %ax,(%r14)
mov    (%rbx),%al
mov    %al,0x2(%r14)
mov    0x1(%rbx),%al
mov    %al,0x3(%r14)
mov    0x2(%rbx),%al
mov    %al,0x4(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.tm = type { i8, i8, i8 }
define void @setMicomTime(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca %struct.tm*
%6 = alloca double
%7 = alloca i32
store i32 %0, i32* %3
store i8* %1, i8** %4
%8 = call %struct.tm* @gmtime(i32* %3)
store %struct.tm* %8, %struct.tm** %5
%9 = load %struct.tm*, %struct.tm** %5
%10 = call double @modJulianDate(%struct.tm* %9)
store double %10, double* %6
%11 = load double, double* %6
%12 = fptosi double %11 to i32
store i32 %12, i32* %7
%13 = load i32, i32* %7
%14 = ashr i32 %13, 8
%15 = trunc i32 %14 to i8
%16 = load i8*, i8** %4
%17 = getelementptr inbounds i8, i8* %16, i64 0
store i8 %15, i8* %17
%18 = load i32, i32* %7
%19 = and i32 %18, 255
%20 = trunc i32 %19 to i8
%21 = load i8*, i8** %4
%22 = getelementptr inbounds i8, i8* %21, i64 1
store i8 %20, i8* %22
%23 = load %struct.tm*, %struct.tm** %5
%24 = getelementptr inbounds %struct.tm, %struct.tm* %23, i32 0, i32 0
%25 = load i8, i8* %24
%26 = load i8*, i8** %4
%27 = getelementptr inbounds i8, i8* %26, i64 2
store i8 %25, i8* %27
%28 = load %struct.tm*, %struct.tm** %5
%29 = getelementptr inbounds %struct.tm, %struct.tm* %28, i32 0, i32 1
%30 = load i8, i8* %29
%31 = load i8*, i8** %4
%32 = getelementptr inbounds i8, i8* %31, i64 3
store i8 %30, i8* %32
%33 = load %struct.tm*, %struct.tm** %5
%34 = getelementptr inbounds %struct.tm, %struct.tm* %33, i32 0, i32 2
%35 = load i8, i8* %34
%36 = load i8*, i8** %4
%37 = getelementptr inbounds i8, i8* %36, i64 4
store i8 %35, i8* %37
ret void
}

LLVM IR (-O2):
%struct.tm = type { i8, i8, i8 }
define void @setMicomTime(i32 %0, i8* nocapture writeonly %1) {
%3 = alloca i32
store i32 %0, i32* %3
%4 = call %struct.tm* @gmtime(i32* %3)
%5 = call double @modJulianDate(%struct.tm* %4)
%6 = fptosi double %5 to i32
%7 = lshr i32 %6, 8
%8 = trunc i32 %7 to i8
store i8 %8, i8* %1
%9 = trunc i32 %6 to i8
%10 = getelementptr inbounds i8, i8* %1, i64 1
store i8 %9, i8* %10
%11 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 0
%12 = load i8, i8* %11
%13 = getelementptr inbounds i8, i8* %1, i64 2
store i8 %12, i8* %13
%14 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 1
%15 = load i8, i8* %14
%16 = getelementptr inbounds i8, i8* %1, i64 3
store i8 %15, i8* %16
%17 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 2
%18 = load i8, i8* %17
%19 = getelementptr inbounds i8, i8* %1, i64 4
store i8 %18, i8* %19
ret void
}