#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 */

/* Variables and functions */
int /*<<< orphan*/ printf(char *, unsigned int, unsigned long, unsigned int,
                          unsigned int, unsigned int);
unsigned long getMicomTime(char *micomTimeString) {
  unsigned int mjd =
      ((micomTimeString[1] & 0xFF) * 256) + (micomTimeString[2] & 0xFF);
  unsigned long epoch = ((mjd - 40587) * 86400);
  unsigned int hour = micomTimeString[3] & 0xFF;
  unsigned int min = micomTimeString[4] & 0xFF;
  unsigned int sec = micomTimeString[5] & 0xFF;
  epoch += (hour * 3600 + min * 60 + sec);
  printf("MJD = %d epoch = %ld, time = %02d:%02d:%02d\n", mjd, epoch, hour, min,
         sec);
  return epoch;
}


x86 assembly (clang, -O0):
<getMicomTime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl 0x1(%rax),%eax
and    $0xff,%eax
shl    $0x8,%eax
mov    -0x8(%rbp),%rcx
movsbl 0x2(%rcx),%ecx
and    $0xff,%ecx
add    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
sub    $0x9e8b,%eax
imul   $0x15180,%eax,%eax
mov    %eax,%eax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movsbl 0x3(%rax),%eax
and    $0xff,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rax
movsbl 0x4(%rax),%eax
and    $0xff,%eax
mov    %eax,-0x20(%rbp)
mov    -0x8(%rbp),%rax
movsbl 0x5(%rax),%eax
and    $0xff,%eax
mov    %eax,-0x24(%rbp)
imul   $0xe10,-0x1c(%rbp),%eax
imul   $0x3c,-0x20(%rbp),%ecx
add    %ecx,%eax
add    -0x24(%rbp),%eax
mov    %eax,%eax
add    -0x18(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
mov    -0x20(%rbp),%r8d
mov    -0x24(%rbp),%r9d
lea    0xe4a(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getMicomTime>:
push   %rbx
movzwl 0x1(%rdi),%esi
shl    $0x10,%esi
bswap  %esi
imul   $0x15180,%esi,%eax
add    $0x2efbbf80,%eax
movzbl 0x3(%rdi),%ecx
movzbl 0x4(%rdi),%r8d
movzbl 0x5(%rdi),%r9d
imul   $0xe10,%rcx,%rdx
imul   $0x3c,%r8,%rbx
add    %rdx,%rbx
add    %r9,%rbx
add    %rax,%rbx
lea    0xeb2(%rip),%rdi
mov    %rbx,%rdx
call   1030 <printf@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [45 x i8] c"MJD = %d epoch = %ld, time = %02d:%02d:%02d\0A\00"
define i64 @getMicomTime(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i64
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i8* %0, i8** %2
%8 = load i8*, i8** %2
%9 = getelementptr inbounds i8, i8* %8, i64 1
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = and i32 %11, 255
%13 = mul nsw i32 %12, 256
%14 = load i8*, i8** %2
%15 = getelementptr inbounds i8, i8* %14, i64 2
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = and i32 %17, 255
%19 = add nsw i32 %13, %18
store i32 %19, i32* %3
%20 = load i32, i32* %3
%21 = sub i32 %20, 40587
%22 = mul i32 %21, 86400
%23 = zext i32 %22 to i64
store i64 %23, i64* %4
%24 = load i8*, i8** %2
%25 = getelementptr inbounds i8, i8* %24, i64 3
%26 = load i8, i8* %25
%27 = sext i8 %26 to i32
%28 = and i32 %27, 255
store i32 %28, i32* %5
%29 = load i8*, i8** %2
%30 = getelementptr inbounds i8, i8* %29, i64 4
%31 = load i8, i8* %30
%32 = sext i8 %31 to i32
%33 = and i32 %32, 255
store i32 %33, i32* %6
%34 = load i8*, i8** %2
%35 = getelementptr inbounds i8, i8* %34, i64 5
%36 = load i8, i8* %35
%37 = sext i8 %36 to i32
%38 = and i32 %37, 255
store i32 %38, i32* %7
%39 = load i32, i32* %5
%40 = mul i32 %39, 3600
%41 = load i32, i32* %6
%42 = mul i32 %41, 60
%43 = add i32 %40, %42
%44 = load i32, i32* %7
%45 = add i32 %43, %44
%46 = zext i32 %45 to i64
%47 = load i64, i64* %4
%48 = add i64 %47, %46
store i64 %48, i64* %4
%49 = load i32, i32* %3
%50 = load i64, i64* %4
%51 = load i32, i32* %5
%52 = load i32, i32* %6
%53 = load i32, i32* %7
%54 = call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i32 %49, i64 %50, i32 %51, i32 %52, i32 %53)
%55 = load i64, i64* %4
ret i64 %55
}

LLVM IR (-O2):
@.str = [45 x i8] c"MJD = %d epoch = %ld, time = %02d:%02d:%02d\0A\00"
define i64 @getMicomTime(i8* nocapture %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 1
%3 = load i8, i8* %2
%4 = zext i8 %3 to i32
%5 = shl nuw nsw i32 %4, 8
%6 = getelementptr inbounds i8, i8* %0, i64 2
%7 = load i8, i8* %6
%8 = zext i8 %7 to i32
%9 = or i32 %5, %8
%10 = mul i32 %9, 86400
%11 = add i32 %10, 788250496
%12 = zext i32 %11 to i64
%13 = getelementptr inbounds i8, i8* %0, i64 3
%14 = load i8, i8* %13
%15 = zext i8 %14 to i32
%16 = getelementptr inbounds i8, i8* %0, i64 4
%17 = load i8, i8* %16
%18 = zext i8 %17 to i32
%19 = getelementptr inbounds i8, i8* %0, i64 5
%20 = load i8, i8* %19
%21 = zext i8 %20 to i32
%22 = mul nuw nsw i32 %15, 3600
%23 = mul nuw nsw i32 %18, 60
%24 = add nuw nsw i32 %23, %22
%25 = add nuw nsw i32 %24, %21
%26 = zext i32 %25 to i64
%27 = add nuw nsw i64 %26, %12
%28 = tail call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i32 %9, i64 %27, i32 %15, i32 %18, i32 %21)
ret i64 %27
}