#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 *, ...);
void poa_showAlignment(char *readseq, char *refseq, int readlen) {
  int i;
  printf("Alignment: \n");
  printf("Read: ");
  for (i = readlen - 1; i >= 0; i--) {
    printf("%c", readseq[i]);
  }
  printf("\n");
  printf("      ");
  for (i = readlen - 1; i >= 0; i--) {
    if (readseq[i] == refseq[i]) {
      printf("|");
    } else {
      printf(" ");
    }
  }
  printf("\n");
  printf("Ref:  ");
  for (i = readlen - 1; i >= 0; i--) {
    printf("%c", refseq[i]);
  }
  printf("\n\n");
}


x86 assembly (clang, -O0):
<poa_showAlignment>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
lea    0xed6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jl     117a <poa_showAlignment+0x6a>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%esi
lea    0xeaf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x18(%rbp)
jmp    1148 <poa_showAlignment+0x38>
lea    0xea7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe88(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jl     11fd <poa_showAlignment+0xed>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
mov    -0x10(%rbp),%rcx
movslq -0x18(%rbp),%rdx
movsbl (%rcx,%rdx,1),%ecx
cmp    %ecx,%eax
jne    11dc <poa_showAlignment+0xcc>
lea    0xe4e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11ea <poa_showAlignment+0xda>
lea    0xe39(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11ef <poa_showAlignment+0xdf>
mov    -0x18(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x18(%rbp)
jmp    119f <poa_showAlignment+0x8f>
lea    0xe24(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe0e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jl     1254 <poa_showAlignment+0x144>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%esi
lea    0xdd5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x18(%rbp)
jmp    1222 <poa_showAlignment+0x112>
lea    0xdcc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<poa_showAlignment>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %edx,%r14d
mov    %rsi,%r15
mov    %rdi,%r12
lea    0xecc(%rip),%rdi
call   1040 <puts@plt>
lea    0xeab(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    -0x1(%r14),%eax
mov    %eax,%r13d
test   %r14d,%r14d
jle    11d4 <poa_showAlignment+0xa4>
mov    %r13,%rbx
nopl   0x0(%rax,%rax,1)
movsbl (%r12,%rbx,1),%edi
call   1030 <putchar@plt>
add    $0xffffffffffffffff,%rbx
jb     1170 <poa_showAlignment+0x40>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe76(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
test   %r14d,%r14d
jle    1222 <poa_showAlignment+0xf2>
lea    0x1(%r13),%rbx
jmp    11bb <poa_showAlignment+0x8b>
nopw   0x0(%rax,%rax,1)
call   1030 <putchar@plt>
add    $0xffffffffffffffff,%rbx
jle    11ec <poa_showAlignment+0xbc>
movzbl -0x1(%r12,%rbx,1),%eax
mov    $0x7c,%edi
cmp    -0x1(%r15,%rbx,1),%al
je     11b0 <poa_showAlignment+0x80>
mov    $0x20,%edi
jmp    11b0 <poa_showAlignment+0x80>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe22(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe11(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
test   %r14d,%r14d
jle    123a <poa_showAlignment+0x10a>
nopl   0x0(%rax)
movsbl (%r15,%r13,1),%edi
call   1030 <putchar@plt>
add    $0xffffffffffffffff,%r13
jb     1210 <poa_showAlignment+0xe0>
jmp    123a <poa_showAlignment+0x10a>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xddb(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xde0(%rip),%rdi
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
jmp    1040 <puts@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"Alignment: \0A\00"
@.str.1 = [7 x i8] c"Read: \00"
@.str.2 = [3 x i8] c"%c\00"
@.str.3 = [2 x i8] c"\0A\00"
@.str.4 = [7 x i8] c" \00"
@.str.5 = [2 x i8] c"|\00"
@.str.6 = [2 x i8] c" \00"
@.str.7 = [7 x i8] c"Ref: \00"
@.str.8 = [3 x i8] c"\0A\0A\00"
define void @poa_showAlignment(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%10 = load i32, i32* %6
%11 = sub nsw i32 %10, 1
store i32 %11, i32* %7
br label %12
12: ; preds = %23, %3
%13 = load i32, i32* %7
%14 = icmp sge i32 %13, 0
br i1 %14, label %15, label %26
15: ; preds = %12
%16 = load i8*, i8** %4
%17 = load i32, i32* %7
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i8, i8* %16, i64 %18
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %21)
br label %23
23: ; preds = %15
%24 = load i32, i32* %7
%25 = add nsw i32 %24, -1
store i32 %25, i32* %7
br label %12
26: ; preds = %12
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%29 = load i32, i32* %6
%30 = sub nsw i32 %29, 1
store i32 %30, i32* %7
br label %31
31: ; preds = %53, %26
%32 = load i32, i32* %7
%33 = icmp sge i32 %32, 0
br i1 %33, label %34, label %56
34: ; preds = %31
%35 = load i8*, i8** %4
%36 = load i32, i32* %7
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds i8, i8* %35, i64 %37
%39 = load i8, i8* %38
%40 = sext i8 %39 to i32
%41 = load i8*, i8** %5
%42 = load i32, i32* %7
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds i8, i8* %41, i64 %43
%45 = load i8, i8* %44
%46 = sext i8 %45 to i32
%47 = icmp eq i32 %40, %46
br i1 %47, label %48, label %50
48: ; preds = %34
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %52
50: ; preds = %34
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
br label %52
52: ; preds = %50, %48
br label %53
53: ; preds = %52
%54 = load i32, i32* %7
%55 = add nsw i32 %54, -1
store i32 %55, i32* %7
br label %31
56: ; preds = %31
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0))
%59 = load i32, i32* %6
%60 = sub nsw i32 %59, 1
store i32 %60, i32* %7
br label %61
61: ; preds = %72, %56
%62 = load i32, i32* %7
%63 = icmp sge i32 %62, 0
br i1 %63, label %64, label %75
64: ; preds = %61
%65 = load i8*, i8** %5
%66 = load i32, i32* %7
%67 = sext i32 %66 to i64
%68 = getelementptr inbounds i8, i8* %65, i64 %67
%69 = load i8, i8* %68
%70 = sext i8 %69 to i32
%71 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %70)
br label %72
72: ; preds = %64
%73 = load i32, i32* %7
%74 = add nsw i32 %73, -1
store i32 %74, i32* %7
br label %61
75: ; preds = %61
%76 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str.1 = [7 x i8] c"Read: \00"
@.str.4 = [7 x i8] c" \00"
@.str.7 = [7 x i8] c"Ref: \00"
@str = [12 x i8] c"Alignment: \00"
@str.9 = [2 x i8] c"\0A\00"
define void @poa_showAlignment(i8* nocapture %0, i8* nocapture %1, i32 %2) {
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%6 = add i32 %2, -1
%7 = icmp sgt i32 %2, 0
br i1 %7, label %8, label %34
8: ; preds = %3
%9 = zext i32 %6 to i64
br label %10
10: ; preds = %8, %10
%11 = phi i64 [ %9, %8 ], [ %16, %10 ]
%12 = getelementptr inbounds i8, i8* %0, i64 %11
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = tail call i32 @putchar(i32 %14)
%16 = add nsw i64 %11, -1
%17 = icmp eq i64 %11, 0
br i1 %17, label %18, label %10
18: ; preds = %10
%19 = tail call i32 @putchar(i32 10)
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
br i1 %7, label %21, label %50
21: ; preds = %18
%22 = zext i32 %6 to i64
br label %23
23: ; preds = %21, %23
%24 = phi i64 [ %22, %21 ], [ %32, %23 ]
%25 = getelementptr inbounds i8, i8* %0, i64 %24
%26 = load i8, i8* %25
%27 = getelementptr inbounds i8, i8* %1, i64 %24
%28 = load i8, i8* %27
%29 = icmp eq i8 %26, %28
%30 = select i1 %29, i32 124, i32 32
%31 = tail call i32 @putchar(i32 %30)
%32 = add nsw i64 %24, -1
%33 = icmp sgt i64 %24, 0
br i1 %33, label %23, label %37
34: ; preds = %3
%35 = tail call i32 @putchar(i32 10)
%36 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
br label %37
37: ; preds = %23, %34
%38 = tail call i32 @putchar(i32 10)
%39 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0))
br i1 %7, label %40, label %53
40: ; preds = %37
%41 = zext i32 %6 to i64
br label %42
42: ; preds = %40, %42
%43 = phi i64 [ %41, %40 ], [ %48, %42 ]
%44 = getelementptr inbounds i8, i8* %1, i64 %43
%45 = load i8, i8* %44
%46 = sext i8 %45 to i32
%47 = tail call i32 @putchar(i32 %46)
%48 = add nsw i64 %43, -1
%49 = icmp eq i64 %43, 0
br i1 %49, label %53, label %42
50: ; preds = %18
%51 = tail call i32 @putchar(i32 10)
%52 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0))
br label %53
53: ; preds = %42, %50, %37
%54 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.9, i64 0, i64 0))
ret void
}