#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 writeValueAsNucleotides(FILE *file, unsigned long long int value) {
  unsigned long long int mask = 0x3;
  unsigned long long int nucleotide;
  for (int i = 0; i < 32; i++) {
    nucleotide = (value >> ((32 - i - 1) * 2)) & 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):
<writeValueAsNucleotides>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x3,-0x18(%rbp)
movl   $0x0,-0x24(%rbp)
cmpl   $0x20,-0x24(%rbp)
jge    120a <writeValueAsNucleotides+0xfa>
mov    -0x10(%rbp),%rax
mov    $0x20,%ecx
sub    -0x24(%rbp),%ecx
sub    $0x1,%ecx
shl    $0x1,%ecx
mov    %ecx,%ecx
shr    %cl,%rax
and    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1178 <writeValueAsNucleotides+0x68>
mov    -0x8(%rbp),%rdi
lea    0xe92(%rip),%rsi
call   1030 <fprintf@plt>
jmp    11f7 <writeValueAsNucleotides+0xe7>
cmpq   $0x1,-0x20(%rbp)
jne    1198 <writeValueAsNucleotides+0x88>
mov    -0x8(%rbp),%rdi
lea    0xe74(%rip),%rsi
call   1030 <fprintf@plt>
jmp    11f2 <writeValueAsNucleotides+0xe2>
cmpq   $0x2,-0x20(%rbp)
jne    11b8 <writeValueAsNucleotides+0xa8>
mov    -0x8(%rbp),%rdi
lea    0xe56(%rip),%rsi
call   1030 <fprintf@plt>
jmp    11ed <writeValueAsNucleotides+0xdd>
cmpq   $0x3,-0x20(%rbp)
jne    11d8 <writeValueAsNucleotides+0xc8>
mov    -0x8(%rbp),%rdi
lea    0xe38(%rip),%rsi
call   1030 <fprintf@plt>
jmp    11e8 <writeValueAsNucleotides+0xd8>
mov    -0x8(%rbp),%rdi
lea    0xe25(%rip),%rsi
call   1030 <fprintf@plt>
jmp    11ed <writeValueAsNucleotides+0xdd>
jmp    11f2 <writeValueAsNucleotides+0xe2>
jmp    11f7 <writeValueAsNucleotides+0xe7>
jmp    11fc <writeValueAsNucleotides+0xec>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    112f <writeValueAsNucleotides+0x1f>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<writeValueAsNucleotides>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%r15
mov    $0x3e,%ebx
lea    0xed6(%rip),%r12
jmp    1142 <writeValueAsNucleotides+0x32>
nopl   0x0(%rax)
mov    %r15,%rsi
call   1030 <fputc@plt>
add    $0xfffffffffffffffe,%rbx
cmp    $0xfffffffffffffffe,%rbx
je     115e <writeValueAsNucleotides+0x4e>
mov    %r14,%rax
mov    %ebx,%ecx
shr    %cl,%rax
and    $0x3,%eax
mov    $0x54,%edi
cmp    $0x3,%rax
je     1130 <writeValueAsNucleotides+0x20>
mov    (%r12,%rax,4),%edi
jmp    1130 <writeValueAsNucleotides+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
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 = [4 x i8] c"[E]\00"
define void @writeValueAsNucleotides(i32* %0, i64 %1) {
%3 = alloca i32*
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
%7 = alloca i32
store i32* %0, i32** %3
store i64 %1, i64* %4
store i64 3, i64* %5
store i32 0, i32* %7
br label %8
8: ; preds = %51, %2
%9 = load i32, i32* %7
%10 = icmp slt i32 %9, 32
br i1 %10, label %11, label %54
11: ; preds = %8
%12 = load i64, i64* %4
%13 = load i32, i32* %7
%14 = sub nsw i32 32, %13
%15 = sub nsw i32 %14, 1
%16 = mul nsw i32 %15, 2
%17 = zext i32 %16 to i64
%18 = lshr i64 %12, %17
%19 = load i64, i64* %5
%20 = and i64 %18, %19
store i64 %20, i64* %6
%21 = load i64, i64* %6
%22 = icmp eq i64 %21, 0
br i1 %22, label %23, label %26
23: ; preds = %11
%24 = load i32*, i32** %3
%25 = call i32 @fprintf(i32* %24, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %50
26: ; preds = %11
%27 = load i64, i64* %6
%28 = icmp eq i64 %27, 1
br i1 %28, label %29, label %32
29: ; preds = %26
%30 = load i32*, i32** %3
%31 = call i32 @fprintf(i32* %30, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %49
32: ; preds = %26
%33 = load i64, i64* %6
%34 = icmp eq i64 %33, 2
br i1 %34, label %35, label %38
35: ; preds = %32
%36 = load i32*, i32** %3
%37 = call i32 @fprintf(i32* %36, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %48
38: ; preds = %32
%39 = load i64, i64* %6
%40 = icmp eq i64 %39, 3
br i1 %40, label %41, label %44
41: ; preds = %38
%42 = load i32*, i32** %3
%43 = call i32 @fprintf(i32* %42, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %47
44: ; preds = %38
%45 = load i32*, i32** %3
%46 = call i32 @fprintf(i32* %45, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
br label %47
47: ; preds = %44, %41
br label %48
48: ; preds = %47, %35
br label %49
49: ; preds = %48, %29
br label %50
50: ; preds = %49, %23
br label %51
51: ; preds = %50
%52 = load i32, i32* %7
%53 = add nsw i32 %52, 1
store i32 %53, i32* %7
br label %8
54: ; preds = %8
ret void
}

LLVM IR (-O2):
@switch.table.writeValueAsNucleotides = [3 x i32] [i32 65, i32 71, i32 67]
define void @writeValueAsNucleotides(i32* nocapture %0, i64 %1) {
br label %4
3: ; preds = %14
ret void
4: ; preds = %2, %14
%5 = phi i64 [ 0, %2 ], [ %17, %14 ]
%6 = mul nsw i64 %5, -2
%7 = add nsw i64 %6, 62
%8 = lshr i64 %1, %7
%9 = and i64 %8, 3
%10 = icmp eq i64 %9, 3
br i1 %10, label %14, label %11
11: ; preds = %4
%12 = getelementptr inbounds [3 x i32], [3 x i32]* @switch.table.writeValueAsNucleotides, i64 0, i64 %9
%13 = load i32, i32* %12
br label %14
14: ; preds = %4, %11
%15 = phi i32 [ %13, %11 ], [ 84, %4 ]
%16 = tail call i32 @fputc(i32 %15, i32* %0)
%17 = add nuw nsw i64 %5, 1
%18 = icmp eq i64 %17, 32
br i1 %18, label %3, label %4
}