#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 long long encoded_kmer(unsigned char *);
unsigned char to_amino_acid_off(int);
unsigned long long encoded_aa_kmer(char *p) {
  unsigned char aa_off[8];
  int j;
  for (j = 0; (j < 8); j++) {
    int prot_c = *(p + j);
    aa_off[j] = to_amino_acid_off(prot_c);
  }
  return encoded_kmer(aa_off);
}


x86 assembly (clang, -O0):
<encoded_aa_kmer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x8,-0x14(%rbp)
jge    116c <encoded_aa_kmer+0x4c>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%edi
call   1040 <to_amino_acid_off@plt>
mov    %al,%cl
movslq -0x14(%rbp),%rax
mov    %cl,-0x10(%rbp,%rax,1)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1133 <encoded_aa_kmer+0x13>
lea    -0x10(%rbp),%rdi
call   1030 <encoded_kmer@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<encoded_aa_kmer>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
movsbl (%rdi),%edi
call   1040 <to_amino_acid_off@plt>
mov    %al,0x8(%rsp)
movsbl 0x1(%rbx),%edi
call   1040 <to_amino_acid_off@plt>
mov    %al,0x9(%rsp)
movsbl 0x2(%rbx),%edi
call   1040 <to_amino_acid_off@plt>
mov    %al,0xa(%rsp)
movsbl 0x3(%rbx),%edi
call   1040 <to_amino_acid_off@plt>
mov    %al,0xb(%rsp)
movsbl 0x4(%rbx),%edi
call   1040 <to_amino_acid_off@plt>
mov    %al,0xc(%rsp)
movsbl 0x5(%rbx),%edi
call   1040 <to_amino_acid_off@plt>
mov    %al,0xd(%rsp)
movsbl 0x6(%rbx),%edi
call   1040 <to_amino_acid_off@plt>
mov    %al,0xe(%rsp)
movsbl 0x7(%rbx),%edi
call   1040 <to_amino_acid_off@plt>
mov    %al,0xf(%rsp)
lea    0x8(%rsp),%rdi
call   1030 <encoded_kmer@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i64 @encoded_aa_kmer(i8* %0) {
%2 = alloca i8*
%3 = alloca [8 x i8]
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %4
br label %6
6: ; preds = %21, %1
%7 = load i32, i32* %4
%8 = icmp slt i32 %7, 8
br i1 %8, label %9, label %24
9: ; preds = %6
%10 = load i8*, i8** %2
%11 = load i32, i32* %4
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds i8, i8* %10, i64 %12
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
store i32 %15, i32* %5
%16 = load i32, i32* %5
%17 = call zeroext i8 @to_amino_acid_off(i32 %16)
%18 = load i32, i32* %4
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 %19
store i8 %17, i8* %20
br label %21
21: ; preds = %9
%22 = load i32, i32* %4
%23 = add nsw i32 %22, 1
store i32 %23, i32* %4
br label %6
24: ; preds = %6
%25 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 0
%26 = call i64 @encoded_kmer(i8* %25)
ret i64 %26
}

LLVM IR (-O2):
define i64 @encoded_aa_kmer(i8* nocapture %0) {
%2 = alloca [8 x i8]
%3 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 0
%4 = load i8, i8* %0
%5 = sext i8 %4 to i32
%6 = tail call zeroext i8 @to_amino_acid_off(i32 %5)
store i8 %6, i8* %3
%7 = getelementptr inbounds i8, i8* %0, i64 1
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
%10 = tail call zeroext i8 @to_amino_acid_off(i32 %9)
%11 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 1
store i8 %10, i8* %11
%12 = getelementptr inbounds i8, i8* %0, i64 2
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = tail call zeroext i8 @to_amino_acid_off(i32 %14)
%16 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 2
store i8 %15, i8* %16
%17 = getelementptr inbounds i8, i8* %0, i64 3
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = tail call zeroext i8 @to_amino_acid_off(i32 %19)
%21 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 3
store i8 %20, i8* %21
%22 = getelementptr inbounds i8, i8* %0, i64 4
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = tail call zeroext i8 @to_amino_acid_off(i32 %24)
%26 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 4
store i8 %25, i8* %26
%27 = getelementptr inbounds i8, i8* %0, i64 5
%28 = load i8, i8* %27
%29 = sext i8 %28 to i32
%30 = tail call zeroext i8 @to_amino_acid_off(i32 %29)
%31 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 5
store i8 %30, i8* %31
%32 = getelementptr inbounds i8, i8* %0, i64 6
%33 = load i8, i8* %32
%34 = sext i8 %33 to i32
%35 = tail call zeroext i8 @to_amino_acid_off(i32 %34)
%36 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 6
store i8 %35, i8* %36
%37 = getelementptr inbounds i8, i8* %0, i64 7
%38 = load i8, i8* %37
%39 = sext i8 %38 to i32
%40 = tail call zeroext i8 @to_amino_acid_off(i32 %39)
%41 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 7
store i8 %40, i8* %41
%42 = call i64 @encoded_kmer(i8* %3)
ret i64 %42
}