#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 UCHAR_MAX;
int iupac_char_to_nt(unsigned int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ table_int(char *, char *, int *, int);
void gen_char_to_nt(void) {
  int char_to_nt[UCHAR_MAX + 1];
  unsigned i;
  for (i = 0; i < UCHAR_MAX + 1; i++) {
    char_to_nt[i] = iupac_char_to_nt(i);
  }
  table_int("char_to_nt", "%4d", char_to_nt, UCHAR_MAX + 1);
  printf("\n");
}


x86 assembly (clang, -O0):
<gen_char_to_nt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0x2eb1(%rip),%rax
mov    (%rax),%eax
add    $0x1,%eax
mov    %rsp,%rcx
mov    %rcx,-0x8(%rbp)
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x20(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    0x2e77(%rip),%rcx
mov    (%rcx),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jae    11a8 <gen_char_to_nt+0x78>
mov    -0x14(%rbp),%edi
call   1050 <iupac_char_to_nt@plt>
mov    %eax,%edx
mov    -0x20(%rbp),%rax
mov    -0x14(%rbp),%ecx
mov    %edx,(%rax,%rcx,4)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    116f <gen_char_to_nt+0x3f>
mov    -0x20(%rbp),%rdx
mov    0x2e3d(%rip),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
lea    0xe41(%rip),%rdi
lea    0xe45(%rip),%rsi
call   1040 <table_int@plt>
lea    0xe3d(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gen_char_to_nt>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    0x2eaf(%rip),%r15
mov    (%r15),%eax
lea    0x1(%rax),%ecx
mov    %rsp,%r14
lea    0xf(,%rcx,4),%rcx
and    $0xfffffffffffffff0,%rcx
sub    %rcx,%r14
mov    %r14,%rsp
xor    %ecx,%ecx
inc    %eax
je     118a <gen_char_to_nt+0x5a>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %ebx,%edi
call   1050 <iupac_char_to_nt@plt>
mov    %eax,(%r14,%rbx,4)
add    $0x1,%rbx
mov    (%r15),%ecx
add    $0x1,%ecx
cmp    %rcx,%rbx
jb     1170 <gen_char_to_nt+0x40>
lea    0xe6f(%rip),%rdi
lea    0xe73(%rip),%rsi
mov    %r14,%rdx
call   1040 <table_int@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    -0x18(%rbp),%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@UCHAR_MAX = global i32 0
@.str = [11 x i8] c"char_to_nt\00"
@.str.1 = [4 x i8] c"%4d\00"
@.str.2 = [2 x i8] c"\0A\00"
define void @gen_char_to_nt() {
%1 = alloca i8*
%2 = alloca i64
%3 = alloca i32
%4 = load i32, i32* @UCHAR_MAX
%5 = add nsw i32 %4, 1
%6 = zext i32 %5 to i64
%7 = call i8* @llvm.stacksave()
store i8* %7, i8** %1
%8 = alloca i32, i64 %6
store i64 %6, i64* %2
store i32 0, i32* %3
br label %9
9: ; preds = %20, %0
%10 = load i32, i32* %3
%11 = load i32, i32* @UCHAR_MAX
%12 = add nsw i32 %11, 1
%13 = icmp ult i32 %10, %12
br i1 %13, label %14, label %23
14: ; preds = %9
%15 = load i32, i32* %3
%16 = call i32 @iupac_char_to_nt(i32 %15)
%17 = load i32, i32* %3
%18 = zext i32 %17 to i64
%19 = getelementptr inbounds i32, i32* %8, i64 %18
store i32 %16, i32* %19
br label %20
20: ; preds = %14
%21 = load i32, i32* %3
%22 = add i32 %21, 1
store i32 %22, i32* %3
br label %9
23: ; preds = %9
%24 = load i32, i32* @UCHAR_MAX
%25 = add nsw i32 %24, 1
%26 = call i32 @table_int(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32* %8, i32 %25)
%27 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%28 = load i8*, i8** %1
ret void
}

LLVM IR (-O2):
@UCHAR_MAX = global i32 0
@.str = [11 x i8] c"char_to_nt\00"
@.str.1 = [4 x i8] c"%4d\00"
define void @gen_char_to_nt() {
%1 = load i32, i32* @UCHAR_MAX
%2 = add nsw i32 %1, 1
%3 = zext i32 %2 to i64
%4 = alloca i32, i64 %3
%5 = icmp eq i32 %2, 0
br i1 %5, label %16, label %6
6: ; preds = %0, %6
%7 = phi i64 [ %11, %6 ], [ 0, %0 ]
%8 = trunc i64 %7 to i32
%9 = tail call i32 @iupac_char_to_nt(i32 %8)
%10 = getelementptr inbounds i32, i32* %4, i64 %7
store i32 %9, i32* %10
%11 = add nuw nsw i64 %7, 1
%12 = load i32, i32* @UCHAR_MAX
%13 = add nsw i32 %12, 1
%14 = zext i32 %13 to i64
%15 = icmp ult i64 %11, %14
br i1 %15, label %6, label %16
16: ; preds = %6, %0
%17 = phi i32 [ 0, %0 ], [ %13, %6 ]
%18 = call i32 @table_int(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32* %4, i32 %17)
%19 = call i32 @putchar(i32 10)
ret void
}