#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 /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *);
void writeAsNucleotides(FILE *file, unsigned long long int *sequence,
                        unsigned int startNucleotidePosition,
                        unsigned int endNucleotidePosition) {
  const unsigned long long int MASK = 0x3;
  for (int i = startNucleotidePosition; i < endNucleotidePosition; i++) {
    unsigned long long int currentSequence = sequence[i / 32];
    unsigned int position = (i * 2) % 64;
    unsigned long long int nucleotide =
        (currentSequence >> (62 - position)) & MASK;
    if (nucleotide == 0x0) {
      fprintf(file, "A");
    } else if (nucleotide == 0x1) {
      fprintf(file, "G");
    } else if (nucleotide == 0x2) {
      fprintf(file, "C");
    } else if (nucleotide == 0x3) {
      fprintf(file, "T");
    } else {
      fprintf(file, "E");
    }
  }
}


x86 assembly (clang, -O0):
<writeAsNucleotides>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
movq   $0x3,-0x20(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x18(%rbp),%eax
jae    1240 <writeAsNucleotides+0x130>
mov    -0x10(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x24(%rbp),%eax
mov    $0x20,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x48(%rbp),%rax
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x30(%rbp)
mov    -0x24(%rbp),%eax
shl    $0x1,%eax
mov    $0x40,%ecx
cltd
idiv   %ecx
mov    %edx,-0x34(%rbp)
mov    -0x30(%rbp),%rax
mov    $0x3e,%ecx
sub    -0x34(%rbp),%ecx
mov    %ecx,%ecx
shr    %cl,%rax
and    $0x3,%rax
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x40(%rbp)
jne    11ae <writeAsNucleotides+0x9e>
mov    -0x8(%rbp),%rdi
lea    0xe5c(%rip),%rsi
call   1030 <fprintf@plt>
jmp    122d <writeAsNucleotides+0x11d>
cmpq   $0x1,-0x40(%rbp)
jne    11ce <writeAsNucleotides+0xbe>
mov    -0x8(%rbp),%rdi
lea    0xe3e(%rip),%rsi
call   1030 <fprintf@plt>
jmp    1228 <writeAsNucleotides+0x118>
cmpq   $0x2,-0x40(%rbp)
jne    11ee <writeAsNucleotides+0xde>
mov    -0x8(%rbp),%rdi
lea    0xe20(%rip),%rsi
call   1030 <fprintf@plt>
jmp    1223 <writeAsNucleotides+0x113>
cmpq   $0x3,-0x40(%rbp)
jne    120e <writeAsNucleotides+0xfe>
mov    -0x8(%rbp),%rdi
lea    0xe02(%rip),%rsi
call   1030 <fprintf@plt>
jmp    121e <writeAsNucleotides+0x10e>
mov    -0x8(%rbp),%rdi
lea    0xdef(%rip),%rsi
call   1030 <fprintf@plt>
jmp    1223 <writeAsNucleotides+0x113>
jmp    1228 <writeAsNucleotides+0x118>
jmp    122d <writeAsNucleotides+0x11d>
jmp    1232 <writeAsNucleotides+0x122>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1134 <writeAsNucleotides+0x24>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<writeAsNucleotides>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
cmp    %ecx,%edx
jae    1192 <writeAsNucleotides+0x82>
mov    %ecx,%r12d
mov    %edx,%ebx
mov    %rsi,%r14
mov    %rdi,%r15
lea    (%rbx,%rbx,1),%ebp
lea    0xecc(%rip),%r13
jmp    1153 <writeAsNucleotides+0x43>
cs nopw 0x0(%rax,%rax,1)
mov    %r15,%rsi
call   1030 <fputc@plt>
add    $0x1,%ebx
add    $0x2,%ebp
cmp    %ebx,%r12d
je     1192 <writeAsNucleotides+0x82>
lea    0x1f(%rbx),%eax
test   %ebx,%ebx
cmovns %ebx,%eax
sar    $0x5,%eax
cltq
lea    0x3f(%rbp),%ecx
test   %ebp,%ebp
cmovns %ebp,%ecx
mov    (%r14,%rax,8),%rax
and    $0xc0,%ecx
mov    %ebp,%edx
sub    %ecx,%edx
mov    $0x3e,%cl
sub    %dl,%cl
shr    %cl,%rax
and    $0x3,%eax
mov    $0x54,%edi
cmp    $0x3,%rax
je     1140 <writeAsNucleotides+0x30>
mov    0x0(%r13,%rax,4),%edi
jmp    1140 <writeAsNucleotides+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@switch.table.writeAsNucleotides = [3 x i32] [i32 65, i32 71, i32 67]
define void @writeAsNucleotides(i32* nocapture %0, i64* nocapture %1, i32 %2, i32 %3) {
%5 = icmp ult i32 %2, %3
br i1 %5, label %7, label %6
6: ; preds = %23, %4
ret void
7: ; preds = %4, %23
%8 = phi i32 [ %26, %23 ], [ %2, %4 ]
%9 = sdiv i32 %8, 32
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i64, i64* %1, i64 %10
%12 = load i64, i64* %11
%13 = shl nsw i32 %8, 1
%14 = srem i32 %13, 64
%15 = sub nsw i32 62, %14
%16 = zext i32 %15 to i64
%17 = lshr i64 %12, %16
%18 = and i64 %17, 3
%19 = icmp eq i64 %18, 3
br i1 %19, label %23, label %20
20: ; preds = %7
%21 = getelementptr inbounds [3 x i32], [3 x i32]* @switch.table.writeAsNucleotides, i64 0, i64 %18
%22 = load i32, i32* %21
br label %23
23: ; preds = %7, %20
%24 = phi i32 [ %22, %20 ], [ 84, %7 ]
%25 = tail call i32 @fputc(i32 %24, i32* %0)
%26 = add i32 %8, 1
%27 = icmp eq i32 %26, %3
br i1 %27, label %6, label %7
}