#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 */
int /*<<< orphan*/ strcpy(char *, char *);
void convert_int_basepairs(int i, char *s, int k) {
  int j, l;
  char ss[256];
  l = k - 1;
  for (j = 0; j < 256; j++)
    ss[j] = 'A';
  while (l >= 0) {
    j = i % 4;
    if (j == 0)
      ss[l] = 'A';
    else if (j == 1)
      ss[l] = 'C';
    else if (j == 2)
      ss[l] = 'G';
    else
      ss[l] = 'T';
    i -= j;
    i /= 4;
    l--;
  }
  ss[k] = '\0';
  strcpy(s, ss);
}


x86 assembly (clang, -O0):
<convert_int_basepairs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x1c(%rbp)
movl   $0x0,-0x18(%rbp)
cmpl   $0x100,-0x18(%rbp)
jge    115c <convert_int_basepairs+0x4c>
movslq -0x18(%rbp),%rax
movb   $0x41,-0x120(%rbp,%rax,1)
41
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1135 <convert_int_basepairs+0x25>
jmp    1161 <convert_int_basepairs+0x51>
cmpl   $0x0,-0x1c(%rbp)
jl     1207 <convert_int_basepairs+0xf7>
mov    -0x4(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    %edx,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jne    1194 <convert_int_basepairs+0x84>
movslq -0x1c(%rbp),%rax
movb   $0x41,-0x120(%rbp,%rax,1)
41
jmp    11e0 <convert_int_basepairs+0xd0>
cmpl   $0x1,-0x18(%rbp)
jne    11af <convert_int_basepairs+0x9f>
movslq -0x1c(%rbp),%rax
movb   $0x43,-0x120(%rbp,%rax,1)
43
jmp    11db <convert_int_basepairs+0xcb>
cmpl   $0x2,-0x18(%rbp)
jne    11ca <convert_int_basepairs+0xba>
movslq -0x1c(%rbp),%rax
movb   $0x47,-0x120(%rbp,%rax,1)
47
jmp    11d6 <convert_int_basepairs+0xc6>
movslq -0x1c(%rbp),%rax
movb   $0x54,-0x120(%rbp,%rax,1)
54
jmp    11db <convert_int_basepairs+0xcb>
jmp    11e0 <convert_int_basepairs+0xd0>
mov    -0x18(%rbp),%ecx
mov    -0x4(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    %eax,-0x4(%rbp)
mov    -0x1c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x1c(%rbp)
jmp    1161 <convert_int_basepairs+0x51>
movslq -0x14(%rbp),%rax
movb   $0x0,-0x120(%rbp,%rax,1)
mov    -0x10(%rbp),%rdi
lea    -0x120(%rbp),%rsi
call   1030 <strcpy@plt>
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<convert_int_basepairs>:
sub    $0x108,%rsp
mov    %rsi,%r8
movaps 0xedf(%rip),%xmm0
movaps %xmm0,0xf0(%rsp)
movaps %xmm0,0xe0(%rsp)
movaps %xmm0,0xd0(%rsp)
movaps %xmm0,0xc0(%rsp)
movaps %xmm0,0xb0(%rsp)
movaps %xmm0,0xa0(%rsp)
movaps %xmm0,0x90(%rsp)
movaps %xmm0,0x80(%rsp)
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
test   %edx,%edx
jle    11db <convert_int_basepairs+0xcb>
mov    %edx,%r10d
add    $0x1,%r10
mov    $0x54,%r9d
nopl   0x0(%rax)
lea    0x3(%rdi),%eax
test   %edi,%edi
cmovns %edi,%eax
mov    %eax,%ecx
and    $0xfffffffc,%ecx
sub    %ecx,%edi
lea    0x0(,%rdi,8),%ecx
mov    $0x474341,%esi
shr    %cl,%esi
lea    -0x2(%r10),%ecx
cmp    $0x3,%edi
cmovae %r9d,%esi
mov    %sil,(%rsp,%rcx,1)
sar    $0x2,%eax
add    $0xffffffffffffffff,%r10
mov    %eax,%edi
cmp    $0x1,%r10
ja     11a0 <convert_int_basepairs+0x90>
movslq %edx,%rax
movb   $0x0,(%rsp,%rax,1)
mov    %rsp,%rsi
mov    %r8,%rdi
call   1030 <strcpy@plt>
add    $0x108,%rsp
ret

LLVM IR (-O0):
define void @convert_int_basepairs(i32 %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca [256 x i8]
store i32 %0, i32* %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%10 = load i32, i32* %6
%11 = sub nsw i32 %10, 1
store i32 %11, i32* %8
store i32 0, i32* %7
br label %12
12: ; preds = %19, %3
%13 = load i32, i32* %7
%14 = icmp slt i32 %13, 256
br i1 %14, label %15, label %22
15: ; preds = %12
%16 = load i32, i32* %7
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 %17
store i8 65, i8* %18
br label %19
19: ; preds = %15
%20 = load i32, i32* %7
%21 = add nsw i32 %20, 1
store i32 %21, i32* %7
br label %12
22: ; preds = %12
br label %23
23: ; preds = %55, %22
%24 = load i32, i32* %8
%25 = icmp sge i32 %24, 0
br i1 %25, label %26, label %63
26: ; preds = %23
%27 = load i32, i32* %4
%28 = srem i32 %27, 4
store i32 %28, i32* %7
%29 = load i32, i32* %7
%30 = icmp eq i32 %29, 0
br i1 %30, label %31, label %35
31: ; preds = %26
%32 = load i32, i32* %8
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 %33
store i8 65, i8* %34
br label %55
35: ; preds = %26
%36 = load i32, i32* %7
%37 = icmp eq i32 %36, 1
br i1 %37, label %38, label %42
38: ; preds = %35
%39 = load i32, i32* %8
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 %40
store i8 67, i8* %41
br label %54
42: ; preds = %35
%43 = load i32, i32* %7
%44 = icmp eq i32 %43, 2
br i1 %44, label %45, label %49
45: ; preds = %42
%46 = load i32, i32* %8
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 %47
store i8 71, i8* %48
br label %53
49: ; preds = %42
%50 = load i32, i32* %8
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 %51
store i8 84, i8* %52
br label %53
53: ; preds = %49, %45
br label %54
54: ; preds = %53, %38
br label %55
55: ; preds = %54, %31
%56 = load i32, i32* %7
%57 = load i32, i32* %4
%58 = sub nsw i32 %57, %56
store i32 %58, i32* %4
%59 = load i32, i32* %4
%60 = sdiv i32 %59, 4
store i32 %60, i32* %4
%61 = load i32, i32* %8
%62 = add nsw i32 %61, -1
store i32 %62, i32* %8
br label %23
63: ; preds = %23
%64 = load i32, i32* %6
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 %65
store i8 0, i8* %66
%67 = load i8*, i8** %5
%68 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 0
%69 = call i32 @strcpy(i8* %67, i8* %68)
ret void
}

LLVM IR (-O2):
define void @convert_int_basepairs(i32 %0, i8* %1, i32 %2) {
%4 = alloca [256 x i8]
%5 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%6 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%7 = icmp sgt i32 %2, 0
br i1 %7, label %8, label %25
8: ; preds = %3
%9 = zext i32 %2 to i64
br label %10
10: ; preds = %8, %10
%11 = phi i64 [ %9, %8 ], [ %13, %10 ]
%12 = phi i32 [ %0, %8 ], [ %23, %10 ]
%13 = add nsw i64 %11, -1
%14 = srem i32 %12, 4
%15 = icmp ult i32 %14, 3
%16 = trunc i32 %14 to i24
%17 = shl i24 %16, 3
%18 = lshr i24 4670273, %17
%19 = trunc i24 %18 to i8
%20 = select i1 %15, i8 %19, i8 84
%21 = and i64 %13, 4294967295
%22 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 %21
store i8 %20, i8* %22
%23 = sdiv i32 %12, 4
%24 = icmp ugt i64 %11, 1
br i1 %24, label %10, label %25
25: ; preds = %10, %3
%26 = sext i32 %2 to i64
%27 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 %26
store i8 0, i8* %27
%28 = call i32 @strcpy(i8* %1, i8* %6)
ret void
}