#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 *, ...);
int /*<<< orphan*/ fputc(char, int /*<<< orphan*/ *);
int /*<<< orphan*/ stderr;
int writeSequence(FILE *fil, int *conv, char *seq, char *id, char *desc,
                  int len) {
  int i;
  if (!fil) {
    fprintf(stderr, "ERROR: writeSequence requires a file\n");
    return 0;
  }
  if (id && *id) {
    fprintf(fil, ">%s", id);
    if (desc && *desc)
      fprintf(fil, " %s", desc);
    fprintf(fil, "\n");
  }
  for (i = 0; i < len; ++i) {
    if (i && !(i % 60))
      fputc('\n', fil);
    if (conv[seq[i]] > 0)
      fputc(conv[seq[i]], fil);
    else {
      fprintf(stderr, "ERROR in writeSequence: %s[%d] = %d does not convert\n",
              id, i, seq[i]);
      return 0;
    }
  }
  fputc('\n', fil);
  return len;
}


x86 assembly (clang, -O0):
<writeSequence>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
mov    %r9d,-0x34(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    116e <writeSequence+0x4e>
mov    0x2e8e(%rip),%rax
mov    (%rax),%edi
lea    0xea5(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
jmp    12c5 <writeSequence+0x1a5>
cmpq   $0x0,-0x28(%rbp)
je     11e8 <writeSequence+0xc8>
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     11e8 <writeSequence+0xc8>
mov    -0x10(%rbp),%rax
mov    %eax,%edi
mov    -0x28(%rbp),%rdx
lea    0xe8c(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
cmpq   $0x0,-0x30(%rbp)
je     11d4 <writeSequence+0xb4>
mov    -0x30(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     11d4 <writeSequence+0xb4>
mov    -0x10(%rbp),%rax
mov    %eax,%edi
mov    -0x30(%rbp),%rdx
lea    0xe5d(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x10(%rbp),%rax
mov    %eax,%edi
lea    0xe43(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    -0x34(%rbp),%eax
jge    12b1 <writeSequence+0x191>
cmpl   $0x0,-0x38(%rbp)
je     1227 <writeSequence+0x107>
mov    -0x38(%rbp),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1227 <writeSequence+0x107>
mov    -0x10(%rbp),%rsi
mov    $0xa,%edi
call   1030 <fputc@plt>
mov    -0x18(%rbp),%rax
mov    -0x20(%rbp),%rcx
movslq -0x38(%rbp),%rdx
movsbq (%rcx,%rdx,1),%rcx
cmpl   $0x0,(%rax,%rcx,4)
jle    1267 <writeSequence+0x147>
mov    -0x18(%rbp),%rax
mov    -0x20(%rbp),%rcx
movslq -0x38(%rbp),%rdx
movsbq (%rcx,%rdx,1),%rcx
mov    (%rax,%rcx,4),%eax
mov    -0x10(%rbp),%rsi
movsbl %al,%edi
call   1030 <fputc@plt>
jmp    129e <writeSequence+0x17e>
mov    0x2d72(%rip),%rax
mov    (%rax),%edi
mov    -0x28(%rbp),%rdx
mov    -0x38(%rbp),%ecx
mov    -0x20(%rbp),%rax
movslq -0x38(%rbp),%rsi
movsbl (%rax,%rsi,1),%r8d
lea    0xda3(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
jmp    12c5 <writeSequence+0x1a5>
jmp    12a3 <writeSequence+0x183>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    11ef <writeSequence+0xcf>
mov    -0x10(%rbp),%rsi
mov    $0xa,%edi
call   1030 <fputc@plt>
mov    -0x34(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<writeSequence>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
test   %rdi,%rdi
je     1218 <writeSequence+0xf8>
mov    %r9d,%r15d
mov    %rcx,%rbp
mov    %rdx,%r12
mov    %rsi,%r13
mov    %rdi,%rbx
test   %rcx,%rcx
je     1195 <writeSequence+0x75>
cmpb   $0x0,0x0(%rbp)
je     1195 <writeSequence+0x75>
mov    %r8,%r14
lea    0xecb(%rip),%rsi
mov    %ebx,%edi
mov    %rbp,%rdx
xor    %eax,%eax
call   1040 <fprintf@plt>
test   %r14,%r14
je     1185 <writeSequence+0x65>
cmpb   $0x0,(%r14)
je     1185 <writeSequence+0x65>
lea    0xeb1(%rip),%rsi
mov    %ebx,%edi
mov    %r14,%rdx
xor    %eax,%eax
call   1040 <fprintf@plt>
lea    0xe98(%rip),%rsi
mov    %ebx,%edi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    %rbp,0x10(%rsp)
mov    %r15d,0xc(%rsp)
test   %r15d,%r15d
jle    1205 <writeSequence+0xe5>
mov    0xc(%rsp),%r14d
xor    %ebp,%ebp
mov    $0x88888889,%r15d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
test   %rbp,%rbp
je     11e3 <writeSequence+0xc3>
mov    %ebp,%eax
imul   %r15,%rax
shr    $0x25,%rax
imul   $0xffffffc4,%eax,%eax
add    %ebp,%eax
jne    11e3 <writeSequence+0xc3>
mov    $0xa,%edi
mov    %rbx,%rsi
call   1030 <fputc@plt>
movsbq (%r12,%rbp,1),%r8
mov    0x0(%r13,%r8,4),%eax
test   %eax,%eax
jle    1233 <writeSequence+0x113>
movsbl %al,%edi
mov    %rbx,%rsi
call   1030 <fputc@plt>
add    $0x1,%rbp
cmp    %rbp,%r14
jne    11c0 <writeSequence+0xa0>
mov    $0xa,%edi
mov    %rbx,%rsi
call   1030 <fputc@plt>
mov    0xc(%rsp),%ebx
jmp    1253 <writeSequence+0x133>
mov    0x2dc1(%rip),%rax
mov    (%rax),%edi
lea    0xdd8(%rip),%rsi
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <fprintf@plt>
jmp    1253 <writeSequence+0x133>
mov    0x2da6(%rip),%rax
mov    (%rax),%edi
lea    0xdeb(%rip),%rsi
xor    %ebx,%ebx
mov    0x10(%rsp),%rdx
mov    %ebp,%ecx
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    %ebx,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [38 x i8] c"ERROR: writeSequence requires a file\0A\00"
@.str.1 = [4 x i8] c">%s\00"
@.str.2 = [4 x i8] c" %s\00"
@.str.3 = [2 x i8] c"\0A\00"
@.str.4 = [54 x i8] c"ERROR in writeSequence: %s[%d] = %d does not convert\0A\00"
define i32 @writeSequence(i32* %0, i32* %1, i8* %2, i8* %3, i8* %4, i32 %5) {
%7 = alloca i32
%8 = alloca i32*
%9 = alloca i32*
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca i32
%14 = alloca i32
store i32* %0, i32** %8
store i32* %1, i32** %9
store i8* %2, i8** %10
store i8* %3, i8** %11
store i8* %4, i8** %12
store i32 %5, i32* %13
%15 = load i32*, i32** %8
%16 = icmp ne i32* %15, null
br i1 %16, label %20, label %17
17: ; preds = %6
%18 = load i32, i32* @stderr
%19 = call i32 (i32, i8*, ...) @fprintf(i32 %18, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %7
br label %107
20: ; preds = %6
%21 = load i8*, i8** %11
%22 = icmp ne i8* %21, null
br i1 %22, label %23, label %49
23: ; preds = %20
%24 = load i8*, i8** %11
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
%27 = icmp ne i32 %26, 0
br i1 %27, label %28, label %49
28: ; preds = %23
%29 = load i32*, i32** %8
%30 = ptrtoint i32* %29 to i32
%31 = load i8*, i8** %11
%32 = call i32 (i32, i8*, ...) @fprintf(i32 %30, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %31)
%33 = load i8*, i8** %12
%34 = icmp ne i8* %33, null
br i1 %34, label %35, label %45
35: ; preds = %28
%36 = load i8*, i8** %12
%37 = load i8, i8* %36
%38 = sext i8 %37 to i32
%39 = icmp ne i32 %38, 0
br i1 %39, label %40, label %45
40: ; preds = %35
%41 = load i32*, i32** %8
%42 = ptrtoint i32* %41 to i32
%43 = load i8*, i8** %12
%44 = call i32 (i32, i8*, ...) @fprintf(i32 %42, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %43)
br label %45
45: ; preds = %40, %35, %28
%46 = load i32*, i32** %8
%47 = ptrtoint i32* %46 to i32
%48 = call i32 (i32, i8*, ...) @fprintf(i32 %47, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %49
49: ; preds = %45, %23, %20
store i32 0, i32* %14
br label %50
50: ; preds = %100, %49
%51 = load i32, i32* %14
%52 = load i32, i32* %13
%53 = icmp slt i32 %51, %52
br i1 %53, label %54, label %103
54: ; preds = %50
%55 = load i32, i32* %14
%56 = icmp ne i32 %55, 0
br i1 %56, label %57, label %64
57: ; preds = %54
%58 = load i32, i32* %14
%59 = srem i32 %58, 60
%60 = icmp ne i32 %59, 0
br i1 %60, label %64, label %61
61: ; preds = %57
%62 = load i32*, i32** %8
%63 = call i32 @fputc(i8 signext 10, i32* %62)
br label %64
64: ; preds = %61, %57, %54
%65 = load i32*, i32** %9
%66 = load i8*, i8** %10
%67 = load i32, i32* %14
%68 = sext i32 %67 to i64
%69 = getelementptr inbounds i8, i8* %66, i64 %68
%70 = load i8, i8* %69
%71 = sext i8 %70 to i64
%72 = getelementptr inbounds i32, i32* %65, i64 %71
%73 = load i32, i32* %72
%74 = icmp sgt i32 %73, 0
br i1 %74, label %75, label %88
75: ; preds = %64
%76 = load i32*, i32** %9
%77 = load i8*, i8** %10
%78 = load i32, i32* %14
%79 = sext i32 %78 to i64
%80 = getelementptr inbounds i8, i8* %77, i64 %79
%81 = load i8, i8* %80
%82 = sext i8 %81 to i64
%83 = getelementptr inbounds i32, i32* %76, i64 %82
%84 = load i32, i32* %83
%85 = trunc i32 %84 to i8
%86 = load i32*, i32** %8
%87 = call i32 @fputc(i8 signext %85, i32* %86)
br label %99
88: ; preds = %64
%89 = load i32, i32* @stderr
%90 = load i8*, i8** %11
%91 = load i32, i32* %14
%92 = load i8*, i8** %10
%93 = load i32, i32* %14
%94 = sext i32 %93 to i64
%95 = getelementptr inbounds i8, i8* %92, i64 %94
%96 = load i8, i8* %95
%97 = sext i8 %96 to i32
%98 = call i32 (i32, i8*, ...) @fprintf(i32 %89, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.4, i64 0, i64 0), i8* %90, i32 %91, i32 %97)
store i32 0, i32* %7
br label %107
99: ; preds = %75
br label %100
100: ; preds = %99
%101 = load i32, i32* %14
%102 = add nsw i32 %101, 1
store i32 %102, i32* %14
br label %50
103: ; preds = %50
%104 = load i32*, i32** %8
%105 = call i32 @fputc(i8 signext 10, i32* %104)
%106 = load i32, i32* %13
store i32 %106, i32* %7
br label %107
107: ; preds = %103, %88, %17
%108 = load i32, i32* %7
ret i32 %108
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [38 x i8] c"ERROR: writeSequence requires a file\0A\00"
@.str.1 = [4 x i8] c">%s\00"
@.str.2 = [4 x i8] c" %s\00"
@.str.3 = [2 x i8] c"\0A\00"
@.str.4 = [54 x i8] c"ERROR in writeSequence: %s[%d] = %d does not convert\0A\00"
define i32 @writeSequence(i32* %0, i32* nocapture %1, i8* nocapture %2, i8* %3, i8* %4, i32 %5) {
%7 = icmp eq i32* %0, null
br i1 %7, label %8, label %11
8: ; preds = %6
%9 = load i32, i32* @stderr
%10 = tail call i32 (i32, i8*, ...) @fprintf(i32 %9, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
br label %60
11: ; preds = %6
%12 = icmp eq i8* %3, null
br i1 %12, label %28, label %13
13: ; preds = %11
%14 = load i8, i8* %3
%15 = icmp eq i8 %14, 0
br i1 %15, label %28, label %16
16: ; preds = %13
%17 = ptrtoint i32* %0 to i64
%18 = trunc i64 %17 to i32
%19 = tail call i32 (i32, i8*, ...) @fprintf(i32 %18, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %3)
%20 = icmp eq i8* %4, null
br i1 %20, label %26, label %21
21: ; preds = %16
%22 = load i8, i8* %4
%23 = icmp eq i8 %22, 0
br i1 %23, label %26, label %24
24: ; preds = %21
%25 = tail call i32 (i32, i8*, ...) @fprintf(i32 %18, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %4)
br label %26
26: ; preds = %24, %21, %16
%27 = tail call i32 (i32, i8*, ...) @fprintf(i32 %18, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %28
28: ; preds = %26, %13, %11
%29 = icmp sgt i32 %5, 0
br i1 %29, label %30, label %58
30: ; preds = %28
%31 = zext i32 %5 to i64
br label %32
32: ; preds = %30, %48
%33 = phi i64 [ 0, %30 ], [ %51, %48 ]
%34 = icmp ne i64 %33, 0
%35 = trunc i64 %33 to i32
%36 = urem i32 %35, 60
%37 = icmp eq i32 %36, 0
%38 = and i1 %34, %37
br i1 %38, label %39, label %41
39: ; preds = %32
%40 = tail call i32 @fputc(i8 signext 10, i32* %0)
br label %41
41: ; preds = %39, %32
%42 = getelementptr inbounds i8, i8* %2, i64 %33
%43 = load i8, i8* %42
%44 = sext i8 %43 to i64
%45 = getelementptr inbounds i32, i32* %1, i64 %44
%46 = load i32, i32* %45
%47 = icmp sgt i32 %46, 0
br i1 %47, label %48, label %53
48: ; preds = %41
%49 = trunc i32 %46 to i8
%50 = tail call i32 @fputc(i8 signext %49, i32* %0)
%51 = add nuw nsw i64 %33, 1
%52 = icmp eq i64 %51, %31
br i1 %52, label %58, label %32
53: ; preds = %41
%54 = trunc i64 %33 to i32
%55 = load i32, i32* @stderr
%56 = sext i8 %43 to i32
%57 = tail call i32 (i32, i8*, ...) @fprintf(i32 %55, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.4, i64 0, i64 0), i8* %3, i32 %54, i32 %56)
br label %60
58: ; preds = %48, %28
%59 = tail call i32 @fputc(i8 signext 10, i32* %0)
br label %60
60: ; preds = %58, %53, %8
%61 = phi i32 [ 0, %53 ], [ %5, %58 ], [ 0, %8 ]
ret i32 %61
}