#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*/ deleteCharacter(char *, int);
int strlen(char *);
void trimNs(char *sequence, char *quality) {
  while (strlen(sequence) >= 1 && (sequence[0] == 'N' || sequence[0] == 'n')) {
    deleteCharacter(sequence, 0);
    deleteCharacter(quality, 0);
  }
  while (strlen(sequence) >= 1 && (sequence[strlen(sequence) - 1] == 'N' ||
                                   sequence[strlen(sequence) - 1] == 'n')) {
    deleteCharacter(sequence, strlen(sequence) - 1);
    deleteCharacter(quality, strlen(quality) - 1);
  }
}


x86 assembly (clang, -O0):
<trimNs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x1,%ecx
mov    %al,-0x11(%rbp)
jl     1174 <trimNs+0x54>
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x1,%al
cmp    $0x4e,%ecx
mov    %al,-0x12(%rbp)
je     116e <trimNs+0x4e>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x6e,%eax
sete   %al
mov    %al,-0x12(%rbp)
mov    -0x12(%rbp),%al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    1184 <trimNs+0x64>
jmp    119f <trimNs+0x7f>
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
call   1040 <deleteCharacter@plt>
mov    -0x10(%rbp),%rdi
xor    %esi,%esi
call   1040 <deleteCharacter@plt>
jmp    1130 <trimNs+0x10>
jmp    11a4 <trimNs+0x84>
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x1,%ecx
mov    %al,-0x13(%rbp)
jl     121c <trimNs+0xfc>
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%rax
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%ecx
mov    $0x1,%al
cmp    $0x4e,%ecx
mov    %al,-0x14(%rbp)
je     1216 <trimNs+0xf6>
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x28(%rbp),%rax
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x6e,%eax
sete   %al
mov    %al,-0x14(%rbp)
mov    -0x14(%rbp),%al
mov    %al,-0x13(%rbp)
mov    -0x13(%rbp),%al
test   $0x1,%al
jne    122c <trimNs+0x10c>
jmp    126f <trimNs+0x14f>
mov    -0x8(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x38(%rbp),%rdi
mov    %eax,%esi
sub    $0x1,%esi
call   1040 <deleteCharacter@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x30(%rbp),%rdi
mov    %eax,%esi
sub    $0x1,%esi
call   1040 <deleteCharacter@plt>
jmp    11a4 <trimNs+0x84>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<trimNs>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
nopw   0x0(%rax,%rax,1)
call   1030 <strlen@plt>
test   %eax,%eax
jle    1186 <trimNs+0x66>
movzbl (%rbx),%eax
or     $0x20,%al
cmp    $0x6e,%al
jne    1186 <trimNs+0x66>
mov    %rbx,%rdi
xor    %esi,%esi
call   1040 <deleteCharacter@plt>
mov    %r14,%rdi
xor    %esi,%esi
call   1040 <deleteCharacter@plt>
mov    %rbx,%rdi
jmp    1130 <trimNs+0x10>
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1030 <strlen@plt>
lea    -0x1(%rax),%esi
mov    %rbx,%rdi
call   1040 <deleteCharacter@plt>
mov    %r14,%rdi
call   1030 <strlen@plt>
lea    -0x1(%rax),%esi
mov    %r14,%rdi
call   1040 <deleteCharacter@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
test   %eax,%eax
jle    11b4 <trimNs+0x94>
mov    %rbx,%rdi
call   1030 <strlen@plt>
cltq
cmpb   $0x4e,-0x1(%rax,%rbx,1)
je     1160 <trimNs+0x40>
mov    %rbx,%rdi
call   1030 <strlen@plt>
cltq
cmpb   $0x6e,-0x1(%rax,%rbx,1)
je     1160 <trimNs+0x40>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @trimNs(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
br label %5
5: ; preds = %25, %2
%6 = load i8*, i8** %3
%7 = call i32 @strlen(i8* %6)
%8 = icmp sge i32 %7, 1
br i1 %8, label %9, label %23
9: ; preds = %5
%10 = load i8*, i8** %3
%11 = getelementptr inbounds i8, i8* %10, i64 0
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = icmp eq i32 %13, 78
br i1 %14, label %21, label %15
15: ; preds = %9
%16 = load i8*, i8** %3
%17 = getelementptr inbounds i8, i8* %16, i64 0
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = icmp eq i32 %19, 110
br label %21
21: ; preds = %15, %9
%22 = phi i1 [ true, %9 ], [ %20, %15 ]
br label %23
23: ; preds = %21, %5
%24 = phi i1 [ false, %5 ], [ %22, %21 ]
br i1 %24, label %25, label %30
25: ; preds = %23
%26 = load i8*, i8** %3
%27 = call i32 @deleteCharacter(i8* %26, i32 0)
%28 = load i8*, i8** %4
%29 = call i32 @deleteCharacter(i8* %28, i32 0)
br label %5
30: ; preds = %23
br label %31
31: ; preds = %59, %30
%32 = load i8*, i8** %3
%33 = call i32 @strlen(i8* %32)
%34 = icmp sge i32 %33, 1
br i1 %34, label %35, label %57
35: ; preds = %31
%36 = load i8*, i8** %3
%37 = load i8*, i8** %3
%38 = call i32 @strlen(i8* %37)
%39 = sub nsw i32 %38, 1
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds i8, i8* %36, i64 %40
%42 = load i8, i8* %41
%43 = sext i8 %42 to i32
%44 = icmp eq i32 %43, 78
br i1 %44, label %55, label %45
45: ; preds = %35
%46 = load i8*, i8** %3
%47 = load i8*, i8** %3
%48 = call i32 @strlen(i8* %47)
%49 = sub nsw i32 %48, 1
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds i8, i8* %46, i64 %50
%52 = load i8, i8* %51
%53 = sext i8 %52 to i32
%54 = icmp eq i32 %53, 110
br label %55
55: ; preds = %45, %35
%56 = phi i1 [ true, %35 ], [ %54, %45 ]
br label %57
57: ; preds = %55, %31
%58 = phi i1 [ false, %31 ], [ %56, %55 ]
br i1 %58, label %59, label %70
59: ; preds = %57
%60 = load i8*, i8** %3
%61 = load i8*, i8** %3
%62 = call i32 @strlen(i8* %61)
%63 = sub nsw i32 %62, 1
%64 = call i32 @deleteCharacter(i8* %60, i32 %63)
%65 = load i8*, i8** %4
%66 = load i8*, i8** %4
%67 = call i32 @strlen(i8* %66)
%68 = sub nsw i32 %67, 1
%69 = call i32 @deleteCharacter(i8* %65, i32 %68)
br label %31
70: ; preds = %57
ret void
}

LLVM IR (-O2):
define void @trimNs(i8* %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %0)
%4 = icmp sgt i32 %3, 0
br i1 %4, label %5, label %12
5: ; preds = %2, %7
%6 = load i8, i8* %0
switch i8 %6, label %12 [
i8 78, label %7
i8 110, label %7
]
7: ; preds = %5, %5
%8 = tail call i32 @deleteCharacter(i8* %0, i32 0)
%9 = tail call i32 @deleteCharacter(i8* %1, i32 0)
%10 = tail call i32 @strlen(i8* %0)
%11 = icmp sgt i32 %10, 0
br i1 %11, label %5, label %12
12: ; preds = %7, %5, %2
%13 = tail call i32 @strlen(i8* %0)
%14 = icmp sgt i32 %13, 0
br i1 %14, label %15, label %38
15: ; preds = %12, %29
%16 = tail call i32 @strlen(i8* %0)
%17 = add nsw i32 %16, -1
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i8, i8* %0, i64 %18
%20 = load i8, i8* %19
%21 = icmp eq i8 %20, 78
br i1 %21, label %29, label %22
22: ; preds = %15
%23 = tail call i32 @strlen(i8* %0)
%24 = add nsw i32 %23, -1
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i8, i8* %0, i64 %25
%27 = load i8, i8* %26
%28 = icmp eq i8 %27, 110
br i1 %28, label %29, label %38
29: ; preds = %15, %22
%30 = tail call i32 @strlen(i8* %0)
%31 = add nsw i32 %30, -1
%32 = tail call i32 @deleteCharacter(i8* %0, i32 %31)
%33 = tail call i32 @strlen(i8* %1)
%34 = add nsw i32 %33, -1
%35 = tail call i32 @deleteCharacter(i8* %1, i32 %34)
%36 = tail call i32 @strlen(i8* %0)
%37 = icmp sgt i32 %36, 0
br i1 %37, label %15, label %38
38: ; preds = %22, %29, %12
ret void
}