#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 uint8_t;
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ add_sentence(int *, int /*<<< orphan*/ *, int *, int);
void gen_st_time(uint8_t *b, uint32_t *buflen, int hh, int mm, int ss) {
  uint8_t T1, RS;
  T1 = ((ss & 0x0F) << 4) | 0x01;
  RS = ((mm & 0x3f) << 2) | ((ss & 0x30) >> 4);
  uint8_t sentence[] = {0x54, T1, RS, hh};
  add_sentence(b, buflen, sentence, 4);
}


x86 assembly (clang, -O0):
<gen_st_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
and    $0xf,%eax
shl    $0x4,%eax
or     $0x1,%eax
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%eax
and    $0x3f,%eax
shl    $0x2,%eax
mov    -0x1c(%rbp),%ecx
and    $0x30,%ecx
sar    $0x4,%ecx
or     %ecx,%eax
mov    %eax,-0x24(%rbp)
movl   $0x54,-0x40(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x24(%rbp),%eax
mov    %eax,-0x38(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    -0x40(%rbp),%rdx
mov    $0x4,%ecx
call   1030 <add_sentence@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gen_st_time>:
sub    $0x18,%rsp
mov    %r8d,%eax
shl    $0x4,%eax
or     $0x1,%eax
movzbl %al,%eax
and    $0x3f,%ecx
shr    $0x4,%r8d
and    $0x3,%r8d
lea    (%r8,%rcx,4),%ecx
movl   $0x54,(%rsp)
mov    %eax,0x4(%rsp)
mov    %ecx,0x8(%rsp)
mov    %edx,0xc(%rsp)
mov    %rsp,%rdx
mov    $0x4,%ecx
call   1030 <add_sentence@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
define void @gen_st_time(i32* %0, i32* %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca [4 x i32]
store i32* %0, i32** %6
store i32* %1, i32** %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i32 %4, i32* %10
%14 = load i32, i32* %10
%15 = and i32 %14, 15
%16 = shl i32 %15, 4
%17 = or i32 %16, 1
store i32 %17, i32* %11
%18 = load i32, i32* %9
%19 = and i32 %18, 63
%20 = shl i32 %19, 2
%21 = load i32, i32* %10
%22 = and i32 %21, 48
%23 = ashr i32 %22, 4
%24 = or i32 %20, %23
store i32 %24, i32* %12
%25 = getelementptr inbounds [4 x i32], [4 x i32]* %13, i64 0, i64 0
store i32 84, i32* %25
%26 = getelementptr inbounds i32, i32* %25, i64 1
%27 = load i32, i32* %11
store i32 %27, i32* %26
%28 = getelementptr inbounds i32, i32* %26, i64 1
%29 = load i32, i32* %12
store i32 %29, i32* %28
%30 = getelementptr inbounds i32, i32* %28, i64 1
%31 = load i32, i32* %8
store i32 %31, i32* %30
%32 = load i32*, i32** %6
%33 = load i32*, i32** %7
%34 = getelementptr inbounds [4 x i32], [4 x i32]* %13, i64 0, i64 0
%35 = call i32 @add_sentence(i32* %32, i32* %33, i32* %34, i32 4)
ret void
}

LLVM IR (-O2):
define void @gen_st_time(i32* %0, i32* %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca [4 x i32]
%7 = shl i32 %4, 4
%8 = and i32 %7, 240
%9 = or i32 %8, 1
%10 = shl i32 %3, 2
%11 = and i32 %10, 252
%12 = lshr i32 %4, 4
%13 = and i32 %12, 3
%14 = or i32 %13, %11
%15 = bitcast [4 x i32]* %6 to i8*
%16 = getelementptr inbounds [4 x i32], [4 x i32]* %6, i64 0, i64 0
store i32 84, i32* %16
%17 = getelementptr inbounds [4 x i32], [4 x i32]* %6, i64 0, i64 1
store i32 %9, i32* %17
%18 = getelementptr inbounds [4 x i32], [4 x i32]* %6, i64 0, i64 2
store i32 %14, i32* %18
%19 = getelementptr inbounds [4 x i32], [4 x i32]* %6, i64 0, i64 3
store i32 %2, i32* %19
%20 = call i32 @add_sentence(i32* %0, i32* %1, i32* %16, i32 4)
ret void
}