#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*/ printf(char *, char *);
int strlen(char *);
void fasta_aln_print(char *seq, char *id) {
  int len, i, line_pos;
  char curr_line[(60) + 1];
  len = strlen(seq);
  printf(">%s\n", id);
  line_pos = 0;
  for (i = 0; i < len; i++) {
    if (seq[i] == ' ') {
      curr_line[line_pos++] = 'X';
    } else {
      curr_line[line_pos++] = seq[i];
    }
    if (line_pos == (60)) {
      curr_line[line_pos] = '\0';
      printf("%s\n", curr_line);
      line_pos = 0;
    }
  }
  curr_line[line_pos] = '\0';
  printf("%s\n", curr_line);
}


x86 assembly (clang, -O0):
<fasta_aln_print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xeb9(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11eb <fasta_aln_print+0xcb>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x20,%eax
jne    1192 <fasta_aln_print+0x72>
mov    -0x1c(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x1c(%rbp)
cltq
movb   $0x58,-0x60(%rbp,%rax,1)
jmp    11ae <fasta_aln_print+0x8e>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,1),%cl
mov    -0x1c(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x1c(%rbp)
cltq
mov    %cl,-0x60(%rbp,%rax,1)
cmpl   $0x3c,-0x1c(%rbp)
jne    11d8 <fasta_aln_print+0xb8>
movslq -0x1c(%rbp),%rax
movb   $0x0,-0x60(%rbp,%rax,1)
lea    -0x60(%rbp),%rsi
lea    0xe35(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x1c(%rbp)
jmp    11dd <fasta_aln_print+0xbd>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    115a <fasta_aln_print+0x3a>
movslq -0x1c(%rbp),%rax
movb   $0x0,-0x60(%rbp,%rax,1)
lea    -0x60(%rbp),%rsi
lea    0xe02(%rip),%rdi
call   1040 <printf@plt>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fasta_aln_print>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %rsi,%r14
mov    %rdi,%r12
call   1030 <strlen@plt>
mov    %eax,%ebp
lea    0xebe(%rip),%rdi
mov    %r14,%rsi
call   1040 <printf@plt>
test   %ebp,%ebp
jle    11a6 <fasta_aln_print+0x86>
mov    %ebp,%ebp
xor    %ebx,%ebx
mov    $0x58,%r13d
lea    0xea2(%rip),%r14
mov    %rsp,%r15
xor    %eax,%eax
jmp    1179 <fasta_aln_print+0x59>
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%rbx
cmp    %rbx,%rbp
je     11a8 <fasta_aln_print+0x88>
movzbl (%r12,%rbx,1),%ecx
cmp    $0x20,%cl
cmove  %r13d,%ecx
cltq
mov    %cl,(%rsp,%rax,1)
add    $0x1,%eax
cmp    $0x3c,%eax
jne    1170 <fasta_aln_print+0x50>
movb   $0x0,0x3c(%rsp)
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <printf@plt>
xor    %eax,%eax
jmp    1170 <fasta_aln_print+0x50>
xor    %eax,%eax
cltq
movb   $0x0,(%rsp,%rax,1)
lea    0xe4c(%rip),%rdi
mov    %rsp,%rsi
call   1040 <printf@plt>
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [5 x i8] c">%s\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define void @fasta_aln_print(i8* %0, i8* %1) {
%3 = alloca [61 x i8]
%4 = getelementptr inbounds [61 x i8], [61 x i8]* %3, i64 0, i64 0
%5 = tail call i32 @strlen(i8* %0)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %1)
%7 = icmp sgt i32 %5, 0
br i1 %7, label %8, label %28
8: ; preds = %2
%9 = getelementptr inbounds [61 x i8], [61 x i8]* %3, i64 0, i64 60
%10 = zext i32 %5 to i64
br label %11
11: ; preds = %8, %24
%12 = phi i64 [ 0, %8 ], [ %26, %24 ]
%13 = phi i32 [ 0, %8 ], [ %25, %24 ]
%14 = getelementptr inbounds i8, i8* %0, i64 %12
%15 = load i8, i8* %14
%16 = icmp eq i8 %15, 32
%17 = sext i32 %13 to i64
%18 = getelementptr inbounds [61 x i8], [61 x i8]* %3, i64 0, i64 %17
%19 = select i1 %16, i8 88, i8 %15
store i8 %19, i8* %18
%20 = add nsw i32 %13, 1
%21 = icmp eq i32 %20, 60
br i1 %21, label %22, label %24
22: ; preds = %11
store i8 0, i8* %9
%23 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %4)
br label %24
24: ; preds = %11, %22
%25 = phi i32 [ 0, %22 ], [ %20, %11 ]
%26 = add nuw nsw i64 %12, 1
%27 = icmp eq i64 %26, %10
br i1 %27, label %28, label %11
28: ; preds = %24, %2
%29 = phi i32 [ 0, %2 ], [ %25, %24 ]
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds [61 x i8], [61 x i8]* %3, i64 0, i64 %30
store i8 0, i8* %31
%32 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %4)
ret void
}