#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 uint16_t;

/* Variables and functions */
int /*<<< orphan*/ __aosc_split_and_16(int *, int *);
char *__aosc_encode_and_16(char *dst) {
  uint16_t word1, word2;
  __aosc_split_and_16(&word1, &word2);
  dst[0] = 0x66;
  dst[1] = 0x25;
  do {
    (&dst[2])[1] = (word1) >> 8;
    (&dst[2])[0] = (word1);
  } while (0);
  dst[4] = 0x66;
  dst[5] = 0x25;
  do {
    (&dst[6])[1] = (word2) >> 8;
    (&dst[6])[0] = (word2);
  } while (0);
  dst[8] = 0;
  return dst;
}


x86 assembly (clang, -O0):
<__aosc_encode_and_16>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0xc(%rbp),%rdi
lea    -0x10(%rbp),%rsi
call   1030 <__aosc_split_and_16@plt>
mov    -0x8(%rbp),%rax
movb   $0x66,(%rax)
mov    -0x8(%rbp),%rax
movb   $0x25,0x1(%rax)
mov    -0xc(%rbp),%eax
sar    $0x8,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x3(%rax)
mov    -0xc(%rbp),%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x2(%rax)
mov    -0x8(%rbp),%rax
movb   $0x66,0x4(%rax)
mov    -0x8(%rbp),%rax
movb   $0x25,0x5(%rax)
mov    -0x10(%rbp),%eax
sar    $0x8,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x7(%rax)
mov    -0x10(%rbp),%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x6(%rax)
mov    -0x8(%rbp),%rax
movb   $0x0,0x8(%rax)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__aosc_encode_and_16>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
lea    0xc(%rsp),%rdi
lea    0x8(%rsp),%rsi
call   1030 <__aosc_split_and_16@plt>
movw   $0x2566,(%rbx)
mov    0xc(%rsp),%eax
mov    %ah,0x3(%rbx)
mov    %al,0x2(%rbx)
movw   $0x2566,0x4(%rbx)
mov    0x8(%rsp),%eax
mov    %ah,0x7(%rbx)
mov    %al,0x6(%rbx)
movb   $0x0,0x8(%rbx)
mov    %rbx,%rax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i8* @__aosc_encode_and_16(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
store i8* %0, i8** %2
%5 = call i32 @__aosc_split_and_16(i32* %3, i32* %4)
%6 = load i8*, i8** %2
%7 = getelementptr inbounds i8, i8* %6, i64 0
store i8 102, i8* %7
%8 = load i8*, i8** %2
%9 = getelementptr inbounds i8, i8* %8, i64 1
store i8 37, i8* %9
br label %10
10: ; preds = %1
%11 = load i32, i32* %3
%12 = ashr i32 %11, 8
%13 = trunc i32 %12 to i8
%14 = load i8*, i8** %2
%15 = getelementptr inbounds i8, i8* %14, i64 2
%16 = getelementptr inbounds i8, i8* %15, i64 1
store i8 %13, i8* %16
%17 = load i32, i32* %3
%18 = trunc i32 %17 to i8
%19 = load i8*, i8** %2
%20 = getelementptr inbounds i8, i8* %19, i64 2
%21 = getelementptr inbounds i8, i8* %20, i64 0
store i8 %18, i8* %21
br label %22
22: ; preds = %10
%23 = load i8*, i8** %2
%24 = getelementptr inbounds i8, i8* %23, i64 4
store i8 102, i8* %24
%25 = load i8*, i8** %2
%26 = getelementptr inbounds i8, i8* %25, i64 5
store i8 37, i8* %26
br label %27
27: ; preds = %22
%28 = load i32, i32* %4
%29 = ashr i32 %28, 8
%30 = trunc i32 %29 to i8
%31 = load i8*, i8** %2
%32 = getelementptr inbounds i8, i8* %31, i64 6
%33 = getelementptr inbounds i8, i8* %32, i64 1
store i8 %30, i8* %33
%34 = load i32, i32* %4
%35 = trunc i32 %34 to i8
%36 = load i8*, i8** %2
%37 = getelementptr inbounds i8, i8* %36, i64 6
%38 = getelementptr inbounds i8, i8* %37, i64 0
store i8 %35, i8* %38
br label %39
39: ; preds = %27
%40 = load i8*, i8** %2
%41 = getelementptr inbounds i8, i8* %40, i64 8
store i8 0, i8* %41
%42 = load i8*, i8** %2
ret i8* %42
}

LLVM IR (-O2):
define i8* @__aosc_encode_and_16(i8* returned writeonly %0) {
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %2 to i8*
%5 = bitcast i32* %3 to i8*
%6 = call i32 @__aosc_split_and_16(i32* %2, i32* %3)
store i8 102, i8* %0
%7 = getelementptr inbounds i8, i8* %0, i64 1
store i8 37, i8* %7
%8 = load i32, i32* %2
%9 = lshr i32 %8, 8
%10 = trunc i32 %9 to i8
%11 = getelementptr inbounds i8, i8* %0, i64 2
%12 = getelementptr inbounds i8, i8* %0, i64 3
store i8 %10, i8* %12
%13 = trunc i32 %8 to i8
store i8 %13, i8* %11
%14 = getelementptr inbounds i8, i8* %0, i64 4
store i8 102, i8* %14
%15 = getelementptr inbounds i8, i8* %0, i64 5
store i8 37, i8* %15
%16 = load i32, i32* %3
%17 = lshr i32 %16, 8
%18 = trunc i32 %17 to i8
%19 = getelementptr inbounds i8, i8* %0, i64 6
%20 = getelementptr inbounds i8, i8* %0, i64 7
store i8 %18, i8* %20
%21 = trunc i32 %16 to i8
store i8 %21, i8* %19
%22 = getelementptr inbounds i8, i8* %0, i64 8
store i8 0, i8* %22
ret i8* %0
}