#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 */
size_t strlen(char const *);
int /*<<< orphan*/ velvetFprintf(int /*<<< orphan*/ *, char *, char const *);
void writeFastaSequence(FILE *outfile, const char *str) {
  size_t length = strlen(str);
  size_t start;
  for (start = 0; start < length; start += 60)
    velvetFprintf(outfile, "%.60s\n", &str[start]);
}


x86 assembly (clang, -O0):
<writeFastaSequence>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    117c <writeFastaSequence+0x5c>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
add    -0x20(%rbp),%rdx
lea    0xe9a(%rip),%rsi
call   1040 <velvetFprintf@plt>
mov    -0x20(%rbp),%rax
add    $0x3c,%rax
mov    %rax,-0x20(%rbp)
jmp    1145 <writeFastaSequence+0x25>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<writeFastaSequence>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %rsi,%r15
mov    %rdi,%r14
mov    %rsi,%rdi
call   1030 <strlen@plt>
test   %rax,%rax
je     1168 <writeFastaSequence+0x48>
mov    %rax,%r13
xor    %ebx,%ebx
lea    0xeb8(%rip),%r12
nopl   0x0(%rax,%rax,1)
lea    (%r15,%rbx,1),%rdx
mov    %r14,%rdi
mov    %r12,%rsi
call   1040 <velvetFprintf@plt>
add    $0x3c,%rbx
cmp    %r13,%rbx
jb     1150 <writeFastaSequence+0x30>
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [7 x i8] c"%.60s\0A\00"
define void @writeFastaSequence(i32* %0, i8* %1) {
%3 = alloca i32*
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i64
store i32* %0, i32** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %4
%8 = call i64 @strlen(i8* %7)
store i64 %8, i64* %5
store i64 0, i64* %6
br label %9
9: ; preds = %19, %2
%10 = load i64, i64* %6
%11 = load i64, i64* %5
%12 = icmp ult i64 %10, %11
br i1 %12, label %13, label %22
13: ; preds = %9
%14 = load i32*, i32** %3
%15 = load i8*, i8** %4
%16 = load i64, i64* %6
%17 = getelementptr inbounds i8, i8* %15, i64 %16
%18 = call i32 @velvetFprintf(i32* %14, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %17)
br label %19
19: ; preds = %13
%20 = load i64, i64* %6
%21 = add i64 %20, 60
store i64 %21, i64* %6
br label %9
22: ; preds = %9
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"%.60s\0A\00"
define void @writeFastaSequence(i32* %0, i8* %1) {
%3 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%4 = icmp eq i64 %3, 0
br i1 %4, label %11, label %5
5: ; preds = %2, %5
%6 = phi i64 [ %9, %5 ], [ 0, %2 ]
%7 = getelementptr inbounds i8, i8* %1, i64 %6
%8 = tail call i32 @velvetFprintf(i32* %0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %7)
%9 = add i64 %6, 60
%10 = icmp ult i64 %9, %3
br i1 %10, label %5, label %11
11: ; preds = %5, %2
ret void
}