#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 */
unsigned char bcd2i(unsigned char);
double hmsc2sec(unsigned char, unsigned char, unsigned char, unsigned char);
double bcd_hmsc2sec(unsigned char pos[]) {
  unsigned char h = bcd2i(pos[3]);
  unsigned char m = bcd2i(pos[2]);
  unsigned char s = bcd2i(pos[1]);
  unsigned char c = bcd2i(pos[0]);
  return hmsc2sec(h, m, s, c);
}


x86 assembly (clang, -O0):
<bcd_hmsc2sec>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzbl 0x3(%rax),%edi
call   1030 <bcd2i@plt>
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rax
movzbl 0x2(%rax),%edi
call   1030 <bcd2i@plt>
mov    %al,-0xa(%rbp)
mov    -0x8(%rbp),%rax
movzbl 0x1(%rax),%edi
call   1030 <bcd2i@plt>
mov    %al,-0xb(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%edi
call   1030 <bcd2i@plt>
mov    %al,-0xc(%rbp)
mov    -0x9(%rbp),%dl
mov    -0xa(%rbp),%cl
mov    -0xb(%rbp),%al
movzbl %dl,%edi
movzbl %cl,%esi
movzbl %al,%edx
movzbl -0xc(%rbp),%ecx
call   1040 <hmsc2sec@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bcd_hmsc2sec>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
movzbl 0x3(%rdi),%edi
call   1030 <bcd2i@plt>
mov    %eax,%ebp
movzbl 0x2(%rbx),%edi
call   1030 <bcd2i@plt>
mov    %eax,%r14d
movzbl 0x1(%rbx),%edi
call   1030 <bcd2i@plt>
mov    %eax,%r15d
movzbl (%rbx),%edi
call   1030 <bcd2i@plt>
movzbl %bpl,%edi
movzbl %r14b,%esi
movzbl %r15b,%edx
movzbl %al,%ecx
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <hmsc2sec@plt>

LLVM IR (-O0):
define double @bcd_hmsc2sec(i8* %0) {
%2 = alloca i8*
%3 = alloca i8
%4 = alloca i8
%5 = alloca i8
%6 = alloca i8
store i8* %0, i8** %2
%7 = load i8*, i8** %2
%8 = getelementptr inbounds i8, i8* %7, i64 3
%9 = load i8, i8* %8
%10 = call zeroext i8 @bcd2i(i8 zeroext %9)
store i8 %10, i8* %3
%11 = load i8*, i8** %2
%12 = getelementptr inbounds i8, i8* %11, i64 2
%13 = load i8, i8* %12
%14 = call zeroext i8 @bcd2i(i8 zeroext %13)
store i8 %14, i8* %4
%15 = load i8*, i8** %2
%16 = getelementptr inbounds i8, i8* %15, i64 1
%17 = load i8, i8* %16
%18 = call zeroext i8 @bcd2i(i8 zeroext %17)
store i8 %18, i8* %5
%19 = load i8*, i8** %2
%20 = getelementptr inbounds i8, i8* %19, i64 0
%21 = load i8, i8* %20
%22 = call zeroext i8 @bcd2i(i8 zeroext %21)
store i8 %22, i8* %6
%23 = load i8, i8* %3
%24 = load i8, i8* %4
%25 = load i8, i8* %5
%26 = load i8, i8* %6
%27 = call double @hmsc2sec(i8 zeroext %23, i8 zeroext %24, i8 zeroext %25, i8 zeroext %26)
ret double %27
}

LLVM IR (-O2):
define double @bcd_hmsc2sec(i8* nocapture %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 3
%3 = load i8, i8* %2
%4 = tail call zeroext i8 @bcd2i(i8 zeroext %3)
%5 = getelementptr inbounds i8, i8* %0, i64 2
%6 = load i8, i8* %5
%7 = tail call zeroext i8 @bcd2i(i8 zeroext %6)
%8 = getelementptr inbounds i8, i8* %0, i64 1
%9 = load i8, i8* %8
%10 = tail call zeroext i8 @bcd2i(i8 zeroext %9)
%11 = load i8, i8* %0
%12 = tail call zeroext i8 @bcd2i(i8 zeroext %11)
%13 = tail call double @hmsc2sec(i8 zeroext %4, i8 zeroext %7, i8 zeroext %10, i8 zeroext %12)
ret double %13
}