#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 */
char num_to_base(unsigned short);
int /*<<< orphan*/ printf(char *, char *);
void print_8mer(unsigned short mer) {
  char str[9];
  int i;
  for (i = 0; i < 8; i++) {
    str[i] = num_to_base((mer >> ((8 - 1) - i) * 2) & 3);
  }
  str[8] = '\0';
  printf("%s\n", str);
}


x86 assembly (clang, -O0):
<print_8mer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x8,-0x10(%rbp)
jge    1174 <print_8mer+0x54>
movzwl -0x2(%rbp),%eax
mov    $0x7,%ecx
sub    -0x10(%rbp),%ecx
shl    $0x1,%ecx
sar    %cl,%eax
and    $0x3,%eax
movzwl %ax,%edi
call   1030 <num_to_base@plt>
mov    %al,%cl
movslq -0x10(%rbp),%rax
mov    %cl,-0xb(%rbp,%rax,1)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1136 <print_8mer+0x16>
movb   $0x0,-0x3(%rbp)
lea    -0xb(%rbp),%rsi
lea    0xe7d(%rip),%rdi
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_8mer>:
push   %rbx
sub    $0x10,%rsp
mov    %edi,%ebx
shr    $0xe,%edi
call   1030 <num_to_base@plt>
mov    %al,0x7(%rsp)
mov    %ebx,%edi
shr    $0xc,%edi
and    $0x3,%edi
call   1030 <num_to_base@plt>
mov    %al,0x8(%rsp)
mov    %ebx,%edi
shr    $0xa,%edi
and    $0x3,%edi
call   1030 <num_to_base@plt>
mov    %al,0x9(%rsp)
mov    %ebx,%edi
shr    $0x8,%edi
and    $0x3,%edi
call   1030 <num_to_base@plt>
mov    %al,0xa(%rsp)
mov    %ebx,%edi
shr    $0x6,%edi
and    $0x3,%edi
call   1030 <num_to_base@plt>
mov    %al,0xb(%rsp)
mov    %ebx,%edi
shr    $0x4,%edi
and    $0x3,%edi
call   1030 <num_to_base@plt>
mov    %al,0xc(%rsp)
mov    %ebx,%edi
shr    $0x2,%edi
and    $0x3,%edi
call   1030 <num_to_base@plt>
mov    %al,0xd(%rsp)
and    $0x3,%ebx
mov    %ebx,%edi
call   1030 <num_to_base@plt>
mov    %al,0xe(%rsp)
movb   $0x0,0xf(%rsp)
lea    0xe4d(%rip),%rdi
lea    0x7(%rsp),%rsi
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
define void @print_8mer(i16 zeroext %0) {
%2 = alloca i16
%3 = alloca [9 x i8]
%4 = alloca i32
store i16 %0, i16* %2
store i32 0, i32* %4
br label %5
5: ; preds = %21, %1
%6 = load i32, i32* %4
%7 = icmp slt i32 %6, 8
br i1 %7, label %8, label %24
8: ; preds = %5
%9 = load i16, i16* %2
%10 = zext i16 %9 to i32
%11 = load i32, i32* %4
%12 = sub nsw i32 7, %11
%13 = mul nsw i32 %12, 2
%14 = ashr i32 %10, %13
%15 = and i32 %14, 3
%16 = trunc i32 %15 to i16
%17 = call signext i8 @num_to_base(i16 zeroext %16)
%18 = load i32, i32* %4
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [9 x i8], [9 x i8]* %3, i64 0, i64 %19
store i8 %17, i8* %20
br label %21
21: ; preds = %8
%22 = load i32, i32* %4
%23 = add nsw i32 %22, 1
store i32 %23, i32* %4
br label %5
24: ; preds = %5
%25 = getelementptr inbounds [9 x i8], [9 x i8]* %3, i64 0, i64 8
store i8 0, i8* %25
%26 = getelementptr inbounds [9 x i8], [9 x i8]* %3, i64 0, i64 0
%27 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %26)
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define void @print_8mer(i16 zeroext %0) {
%2 = alloca [9 x i8]
%3 = getelementptr inbounds [9 x i8], [9 x i8]* %2, i64 0, i64 0
%4 = lshr i16 %0, 14
%5 = tail call signext i8 @num_to_base(i16 zeroext %4)
store i8 %5, i8* %3
%6 = lshr i16 %0, 12
%7 = and i16 %6, 3
%8 = tail call signext i8 @num_to_base(i16 zeroext %7)
%9 = getelementptr inbounds [9 x i8], [9 x i8]* %2, i64 0, i64 1
store i8 %8, i8* %9
%10 = lshr i16 %0, 10
%11 = and i16 %10, 3
%12 = tail call signext i8 @num_to_base(i16 zeroext %11)
%13 = getelementptr inbounds [9 x i8], [9 x i8]* %2, i64 0, i64 2
store i8 %12, i8* %13
%14 = lshr i16 %0, 8
%15 = and i16 %14, 3
%16 = tail call signext i8 @num_to_base(i16 zeroext %15)
%17 = getelementptr inbounds [9 x i8], [9 x i8]* %2, i64 0, i64 3
store i8 %16, i8* %17
%18 = lshr i16 %0, 6
%19 = and i16 %18, 3
%20 = tail call signext i8 @num_to_base(i16 zeroext %19)
%21 = getelementptr inbounds [9 x i8], [9 x i8]* %2, i64 0, i64 4
store i8 %20, i8* %21
%22 = lshr i16 %0, 4
%23 = and i16 %22, 3
%24 = tail call signext i8 @num_to_base(i16 zeroext %23)
%25 = getelementptr inbounds [9 x i8], [9 x i8]* %2, i64 0, i64 5
store i8 %24, i8* %25
%26 = lshr i16 %0, 2
%27 = and i16 %26, 3
%28 = tail call signext i8 @num_to_base(i16 zeroext %27)
%29 = getelementptr inbounds [9 x i8], [9 x i8]* %2, i64 0, i64 6
store i8 %28, i8* %29
%30 = and i16 %0, 3
%31 = tail call signext i8 @num_to_base(i16 zeroext %30)
%32 = getelementptr inbounds [9 x i8], [9 x i8]* %2, i64 0, i64 7
store i8 %31, i8* %32
%33 = getelementptr inbounds [9 x i8], [9 x i8]* %2, i64 0, i64 8
store i8 0, i8* %33
%34 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %3)
ret void
}