#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*/ high_index(unsigned char *, char *, int);
int /*<<< orphan*/ index_string(int *, char *, int);
int /*<<< orphan*/ printf(char *, int, int, int);
int /*<<< orphan*/ reverse_transcribe(char *, char *, int);
void flat_index_contig_high(int *index, char *contig, int L, int depth,
                            int high_depth, unsigned char *double_high) {
  int i, stop;
  char flip[256];
  for (i = 0; i < L; i++) {
    stop = ((depth < L - i) ? depth : L - i);
    if (i % 1000000 == 0)
      printf("\nIndex %d bases out of %d at depth %d", i, L, stop);
    if ((*(contig + i)) != 'N') {
      index_string(index, contig + i, stop);
      if (i + high_depth < L) {
        high_index(double_high, contig + i, high_depth);
        reverse_transcribe(contig + i, flip, high_depth);
        high_index(double_high, flip, high_depth);
      }
    }
  }
}


x86 assembly (clang, -O0):
<flat_index_contig_high>:
push   %rbp
mov    %rsp,%rbp
sub    $0x140,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    %r9,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1268 <flat_index_contig_high+0x128>
mov    -0x18(%rbp),%eax
mov    -0x14(%rbp),%ecx
sub    -0x2c(%rbp),%ecx
cmp    %ecx,%eax
jge    1193 <flat_index_contig_high+0x53>
mov    -0x18(%rbp),%eax
mov    %eax,-0x134(%rbp)
jmp    119f <flat_index_contig_high+0x5f>
mov    -0x14(%rbp),%eax
sub    -0x2c(%rbp),%eax
mov    %eax,-0x134(%rbp)
mov    -0x134(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    -0x2c(%rbp),%eax
mov    $0xf4240,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11d1 <flat_index_contig_high+0x91>
mov    -0x2c(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    -0x30(%rbp),%ecx
lea    0xe34(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x4e,%eax
je     1255 <flat_index_contig_high+0x115>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
movslq -0x2c(%rbp),%rax
add    %rax,%rsi
mov    -0x30(%rbp),%edx
call   1050 <index_string@plt>
mov    -0x2c(%rbp),%eax
add    -0x1c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1250 <flat_index_contig_high+0x110>
mov    -0x28(%rbp),%rdi
mov    -0x10(%rbp),%rsi
movslq -0x2c(%rbp),%rax
add    %rax,%rsi
mov    -0x1c(%rbp),%edx
call   1060 <high_index@plt>
mov    -0x10(%rbp),%rdi
movslq -0x2c(%rbp),%rax
add    %rax,%rdi
lea    -0x130(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1040 <reverse_transcribe@plt>
mov    -0x28(%rbp),%rdi
lea    -0x130(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1060 <high_index@plt>
jmp    1255 <flat_index_contig_high+0x115>
jmp    125a <flat_index_contig_high+0x11a>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1168 <flat_index_contig_high+0x28>
add    $0x140,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<flat_index_contig_high>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x138,%rsp
mov    %r9,0x20(%rsp)
mov    %r8d,(%rsp)
mov    %rsi,0x18(%rsp)
mov    %rdi,0x28(%rsp)
test   %edx,%edx
jle    1254 <flat_index_contig_high+0x114>
mov    %ecx,%ebx
mov    %edx,%ebp
mov    %edx,%eax
mov    %rax,0x10(%rsp)
mov    (%rsp),%eax
mov    %rax,0x8(%rsp)
xor    %r15d,%r15d
mov    %edx,%r14d
mov    %edx,0x4(%rsp)
jmp    11a3 <flat_index_contig_high+0x63>
nopl   0x0(%rax,%rax,1)
add    $0x1,%r15
add    $0xffffffff,%r14d
cmp    %r15,0x10(%rsp)
je     1254 <flat_index_contig_high+0x114>
mov    %r15d,%eax
imul   $0x431bde83,%rax,%rax
shr    $0x32,%rax
imul   $0xfff0bdc0,%eax,%eax
cmp    %ebx,%r14d
mov    %r14d,%r12d
cmovg  %ebx,%r12d
add    %r15d,%eax
jne    11dd <flat_index_contig_high+0x9d>
lea    0xe33(%rip),%rdi
mov    %r15d,%esi
mov    0x10(%rsp),%rdx
mov    %r12d,%ecx
call   1030 <printf@plt>
mov    0x18(%rsp),%rax
cmpb   $0x4e,(%rax,%r15,1)
je     1190 <flat_index_contig_high+0x50>
mov    0x18(%rsp),%rax
lea    (%rax,%r15,1),%r13
mov    0x28(%rsp),%rdi
mov    %r13,%rsi
mov    %r12d,%edx
call   1050 <index_string@plt>
mov    0x8(%rsp),%rax
add    %r15d,%eax
cmp    %ebp,%eax
jge    1190 <flat_index_contig_high+0x50>
mov    0x20(%rsp),%rbp
mov    %rbp,%rdi
mov    %r13,%rsi
mov    0x8(%rsp),%rdx
call   1060 <high_index@plt>
mov    %r13,%rdi
lea    0x30(%rsp),%r13
mov    %r13,%rsi
mov    %ebx,%r12d
mov    (%rsp),%ebx
mov    %ebx,%edx
call   1040 <reverse_transcribe@plt>
mov    %rbp,%rdi
mov    0x4(%rsp),%ebp
mov    %r13,%rsi
mov    %ebx,%edx
mov    %r12d,%ebx
call   1060 <high_index@plt>
jmp    1190 <flat_index_contig_high+0x50>
add    $0x138,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [38 x i8] c"\0AIndex %d bases out of %d at depth %d\00"
define void @flat_index_contig_high(i32* %0, i8* %1, i32 %2, i32 %3, i32 %4, i8* %5) {
%7 = alloca i32*
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i8*
%13 = alloca i32
%14 = alloca i32
%15 = alloca [256 x i8]
store i32* %0, i32** %7
store i8* %1, i8** %8
store i32 %2, i32* %9
store i32 %3, i32* %10
store i32 %4, i32* %11
store i8* %5, i8** %12
store i32 0, i32* %13
br label %16
16: ; preds = %84, %6
%17 = load i32, i32* %13
%18 = load i32, i32* %9
%19 = icmp slt i32 %17, %18
br i1 %19, label %20, label %87
20: ; preds = %16
%21 = load i32, i32* %10
%22 = load i32, i32* %9
%23 = load i32, i32* %13
%24 = sub nsw i32 %22, %23
%25 = icmp slt i32 %21, %24
br i1 %25, label %26, label %28
26: ; preds = %20
%27 = load i32, i32* %10
br label %32
28: ; preds = %20
%29 = load i32, i32* %9
%30 = load i32, i32* %13
%31 = sub nsw i32 %29, %30
br label %32
32: ; preds = %28, %26
%33 = phi i32 [ %27, %26 ], [ %31, %28 ]
store i32 %33, i32* %14
%34 = load i32, i32* %13
%35 = srem i32 %34, 1000000
%36 = icmp eq i32 %35, 0
br i1 %36, label %37, label %42
37: ; preds = %32
%38 = load i32, i32* %13
%39 = load i32, i32* %9
%40 = load i32, i32* %14
%41 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i32 %38, i32 %39, i32 %40)
br label %42
42: ; preds = %37, %32
%43 = load i8*, i8** %8
%44 = load i32, i32* %13
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds i8, i8* %43, i64 %45
%47 = load i8, i8* %46
%48 = sext i8 %47 to i32
%49 = icmp ne i32 %48, 78
br i1 %49, label %50, label %83
50: ; preds = %42
%51 = load i32*, i32** %7
%52 = load i8*, i8** %8
%53 = load i32, i32* %13
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds i8, i8* %52, i64 %54
%56 = load i32, i32* %14
%57 = call i32 @index_string(i32* %51, i8* %55, i32 %56)
%58 = load i32, i32* %13
%59 = load i32, i32* %11
%60 = add nsw i32 %58, %59
%61 = load i32, i32* %9
%62 = icmp slt i32 %60, %61
br i1 %62, label %63, label %82
63: ; preds = %50
%64 = load i8*, i8** %12
%65 = load i8*, i8** %8
%66 = load i32, i32* %13
%67 = sext i32 %66 to i64
%68 = getelementptr inbounds i8, i8* %65, i64 %67
%69 = load i32, i32* %11
%70 = call i32 @high_index(i8* %64, i8* %68, i32 %69)
%71 = load i8*, i8** %8
%72 = load i32, i32* %13
%73 = sext i32 %72 to i64
%74 = getelementptr inbounds i8, i8* %71, i64 %73
%75 = getelementptr inbounds [256 x i8], [256 x i8]* %15, i64 0, i64 0
%76 = load i32, i32* %11
%77 = call i32 @reverse_transcribe(i8* %74, i8* %75, i32 %76)
%78 = load i8*, i8** %12
%79 = getelementptr inbounds [256 x i8], [256 x i8]* %15, i64 0, i64 0
%80 = load i32, i32* %11
%81 = call i32 @high_index(i8* %78, i8* %79, i32 %80)
br label %82
82: ; preds = %63, %50
br label %83
83: ; preds = %82, %42
br label %84
84: ; preds = %83
%85 = load i32, i32* %13
%86 = add nsw i32 %85, 1
store i32 %86, i32* %13
br label %16
87: ; preds = %16
ret void
}

LLVM IR (-O2):
@.str = [38 x i8] c"\0AIndex %d bases out of %d at depth %d\00"
define void @flat_index_contig_high(i32* %0, i8* %1, i32 %2, i32 %3, i32 %4, i8* %5) {
%7 = alloca [256 x i8]
%8 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%9 = icmp sgt i32 %2, 0
br i1 %9, label %10, label %37
10: ; preds = %6
%11 = zext i32 %2 to i64
br label %12
12: ; preds = %10, %34
%13 = phi i64 [ 0, %10 ], [ %35, %34 ]
%14 = trunc i64 %13 to i32
%15 = sub nsw i32 %2, %14
%16 = icmp sgt i32 %15, %3
%17 = select i1 %16, i32 %3, i32 %15
%18 = urem i32 %14, 1000000
%19 = icmp eq i32 %18, 0
br i1 %19, label %20, label %22
20: ; preds = %12
%21 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i32 %14, i32 %2, i32 %17)
br label %22
22: ; preds = %20, %12
%23 = getelementptr inbounds i8, i8* %1, i64 %13
%24 = load i8, i8* %23
%25 = icmp eq i8 %24, 78
br i1 %25, label %34, label %26
26: ; preds = %22
%27 = call i32 @index_string(i32* %0, i8* %23, i32 %17)
%28 = add nsw i32 %14, %4
%29 = icmp slt i32 %28, %2
br i1 %29, label %30, label %34
30: ; preds = %26
%31 = call i32 @high_index(i8* %5, i8* %23, i32 %4)
%32 = call i32 @reverse_transcribe(i8* %23, i8* %8, i32 %4)
%33 = call i32 @high_index(i8* %5, i8* %8, i32 %4)
br label %34
34: ; preds = %22, %30, %26
%35 = add nuw nsw i64 %13, 1
%36 = icmp eq i64 %35, %11
br i1 %36, label %37, label %12
37: ; preds = %34, %6
ret void
}