#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 *, char *);
int /*<<< orphan*/ fputc(char, int /*<<< orphan*/ *);
void SeqUtil_writeFasta(FILE *fp, char *header, char *seq, int lineLen) {
  fprintf(fp, ">%s\n", header);
  if (!lineLen)
    lineLen = 60;
  char *chP = seq;
  int linePos = 0;
  while (*chP != '\0') {
    fputc(*chP++, fp);
    linePos++;
    if (linePos == lineLen) {
      fputc('\n', fp);
      linePos = 0;
    }
  }
  if (linePos) {
    fputc('\n', fp);
  }
}


x86 assembly (clang, -O0):
<SeqUtil_writeFasta>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xeba(%rip),%rsi
call   1040 <fprintf@plt>
cmpl   $0x0,-0x1c(%rbp)
jne    115c <SeqUtil_writeFasta+0x3c>
movl   $0x3c,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     11c7 <SeqUtil_writeFasta+0xa7>
mov    -0x28(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x28(%rbp)
mov    (%rax),%al
mov    -0x8(%rbp),%rsi
movsbl %al,%edi
call   1030 <fputc@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jne    11c2 <SeqUtil_writeFasta+0xa2>
mov    -0x8(%rbp),%rsi
mov    $0xa,%edi
call   1030 <fputc@plt>
movl   $0x0,-0x2c(%rbp)
jmp    116b <SeqUtil_writeFasta+0x4b>
cmpl   $0x0,-0x2c(%rbp)
je     11df <SeqUtil_writeFasta+0xbf>
mov    -0x8(%rbp),%rsi
mov    $0xa,%edi
call   1030 <fputc@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SeqUtil_writeFasta>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %ecx,%r15d
mov    %rdx,%rbx
mov    %rsi,%rdx
mov    %rdi,%r14
lea    0xec5(%rip),%rsi
call   1040 <fprintf@plt>
test   %r15d,%r15d
mov    $0x3c,%r12d
cmovne %r15d,%r12d
mov    (%rbx),%al
test   %al,%al
je     11a8 <SeqUtil_writeFasta+0x88>
add    $0x1,%rbx
xor    %ebp,%ebp
jmp    116b <SeqUtil_writeFasta+0x4b>
nopl   0x0(%rax,%rax,1)
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
je     118f <SeqUtil_writeFasta+0x6f>
movsbl %al,%edi
mov    %r14,%rsi
call   1030 <fputc@plt>
add    $0x1,%ebp
cmp    %r12d,%ebp
jne    1160 <SeqUtil_writeFasta+0x40>
mov    $0xa,%edi
mov    %r14,%rsi
call   1030 <fputc@plt>
xor    %ebp,%ebp
jmp    1160 <SeqUtil_writeFasta+0x40>
test   %ebp,%ebp
je     11a8 <SeqUtil_writeFasta+0x88>
mov    $0xa,%edi
mov    %r14,%rsi
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <fputc@plt>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c">%s\0A\00"
define void @SeqUtil_writeFasta(i32* %0, i8* %1, i8* %2, i32 %3) {
%5 = alloca i32*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i32
store i32* %0, i32** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%11 = load i32*, i32** %5
%12 = load i8*, i8** %6
%13 = call i32 @fprintf(i32* %11, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %12)
%14 = load i32, i32* %8
%15 = icmp ne i32 %14, 0
br i1 %15, label %17, label %16
16: ; preds = %4
store i32 60, i32* %8
br label %17
17: ; preds = %16, %4
%18 = load i8*, i8** %7
store i8* %18, i8** %9
store i32 0, i32* %10
br label %19
19: ; preds = %38, %17
%20 = load i8*, i8** %9
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
%23 = icmp ne i32 %22, 0
br i1 %23, label %24, label %39
24: ; preds = %19
%25 = load i8*, i8** %9
%26 = getelementptr inbounds i8, i8* %25, i32 1
store i8* %26, i8** %9
%27 = load i8, i8* %25
%28 = load i32*, i32** %5
%29 = call i32 @fputc(i8 signext %27, i32* %28)
%30 = load i32, i32* %10
%31 = add nsw i32 %30, 1
store i32 %31, i32* %10
%32 = load i32, i32* %10
%33 = load i32, i32* %8
%34 = icmp eq i32 %32, %33
br i1 %34, label %35, label %38
35: ; preds = %24
%36 = load i32*, i32** %5
%37 = call i32 @fputc(i8 signext 10, i32* %36)
store i32 0, i32* %10
br label %38
38: ; preds = %35, %24
br label %19
39: ; preds = %19
%40 = load i32, i32* %10
%41 = icmp ne i32 %40, 0
br i1 %41, label %42, label %45
42: ; preds = %39
%43 = load i32*, i32** %5
%44 = call i32 @fputc(i8 signext 10, i32* %43)
br label %45
45: ; preds = %42, %39
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c">%s\0A\00"
define void @SeqUtil_writeFasta(i32* nocapture %0, i8* %1, i8* nocapture %2, i32 %3) {
%5 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %1)
%6 = icmp eq i32 %3, 0
%7 = select i1 %6, i32 60, i32 %3
%8 = load i8, i8* %2
%9 = icmp eq i8 %8, 0
br i1 %9, label %28, label %10
10: ; preds = %4, %20
%11 = phi i8 [ %22, %20 ], [ %8, %4 ]
%12 = phi i32 [ %21, %20 ], [ 0, %4 ]
%13 = phi i8* [ %14, %20 ], [ %2, %4 ]
%14 = getelementptr inbounds i8, i8* %13, i64 1
%15 = tail call i32 @fputc(i8 signext %11, i32* %0)
%16 = add nsw i32 %12, 1
%17 = icmp eq i32 %16, %7
br i1 %17, label %18, label %20
18: ; preds = %10
%19 = tail call i32 @fputc(i8 signext 10, i32* %0)
br label %20
20: ; preds = %18, %10
%21 = phi i32 [ 0, %18 ], [ %16, %10 ]
%22 = load i8, i8* %14
%23 = icmp eq i8 %22, 0
br i1 %23, label %24, label %10
24: ; preds = %20
%25 = icmp eq i32 %21, 0
br i1 %25, label %28, label %26
26: ; preds = %24
%27 = tail call i32 @fputc(i8 signext 10, i32* %0)
br label %28
28: ; preds = %4, %26, %24
ret void
}