#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 */
scalar_t__ isIupacLower(char);
char tolower(char);
void iupacFilter(char *in, char *out) {
  char c;
  while ((c = *in++) != 0) {
    c = tolower(c);
    if (isIupacLower(c))
      *out++ = c;
  }
  *out++ = 0;
}


x86 assembly (clang, -O0):
<iupacFilter>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
mov    (%rax),%al
mov    %al,-0x11(%rbp)
movsbl %al,%eax
cmp    $0x0,%eax
je     1188 <iupacFilter+0x68>
movsbl -0x11(%rbp),%edi
call   1040 <tolower@plt>
mov    %al,-0x11(%rbp)
movsbl -0x11(%rbp),%edi
call   1030 <isIupacLower@plt>
cmp    $0x0,%rax
je     1183 <iupacFilter+0x63>
mov    -0x11(%rbp),%cl
mov    -0x10(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x10(%rbp)
mov    %cl,(%rax)
jmp    1130 <iupacFilter+0x10>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x0,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<iupacFilter>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    (%rdi),%al
test   %al,%al
je     116b <iupacFilter+0x4b>
mov    %rdi,%rbx
add    $0x1,%rbx
jmp    114b <iupacFilter+0x2b>
cs nopw 0x0(%rax,%rax,1)
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
je     116b <iupacFilter+0x4b>
movsbl %al,%edi
call   1040 <tolower@plt>
mov    %eax,%ebp
movsbl %al,%edi
call   1030 <isIupacLower@plt>
test   %rax,%rax
je     1140 <iupacFilter+0x20>
mov    %bpl,(%r14)
add    $0x1,%r14
jmp    1140 <iupacFilter+0x20>
movb   $0x0,(%r14)
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @iupacFilter(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8
store i8* %0, i8** %3
store i8* %1, i8** %4
br label %6
6: ; preds = %22, %2
%7 = load i8*, i8** %3
%8 = getelementptr inbounds i8, i8* %7, i32 1
store i8* %8, i8** %3
%9 = load i8, i8* %7
store i8 %9, i8* %5
%10 = sext i8 %9 to i32
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %23
12: ; preds = %6
%13 = load i8, i8* %5
%14 = call signext i8 @tolower(i8 signext %13)
store i8 %14, i8* %5
%15 = load i8, i8* %5
%16 = call i64 @isIupacLower(i8 signext %15)
%17 = icmp ne i64 %16, 0
br i1 %17, label %18, label %22
18: ; preds = %12
%19 = load i8, i8* %5
%20 = load i8*, i8** %4
%21 = getelementptr inbounds i8, i8* %20, i32 1
store i8* %21, i8** %4
store i8 %19, i8* %20
br label %22
22: ; preds = %18, %12
br label %6
23: ; preds = %6
%24 = load i8*, i8** %4
%25 = getelementptr inbounds i8, i8* %24, i32 1
store i8* %25, i8** %4
store i8 0, i8* %24
ret void
}

LLVM IR (-O2):
define void @iupacFilter(i8* nocapture %0, i8* nocapture writeonly %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %19, label %5
5: ; preds = %2, %15
%6 = phi i8 [ %17, %15 ], [ %3, %2 ]
%7 = phi i8* [ %9, %15 ], [ %0, %2 ]
%8 = phi i8* [ %16, %15 ], [ %1, %2 ]
%9 = getelementptr inbounds i8, i8* %7, i64 1
%10 = tail call signext i8 @tolower(i8 signext %6)
%11 = tail call i64 @isIupacLower(i8 signext %10)
%12 = icmp eq i64 %11, 0
br i1 %12, label %15, label %13
13: ; preds = %5
%14 = getelementptr inbounds i8, i8* %8, i64 1
store i8 %10, i8* %8
br label %15
15: ; preds = %13, %5
%16 = phi i8* [ %14, %13 ], [ %8, %5 ]
%17 = load i8, i8* %9
%18 = icmp eq i8 %17, 0
br i1 %18, label %19, label %5
19: ; preds = %15, %2
%20 = phi i8* [ %1, %2 ], [ %16, %15 ]
store i8 0, i8* %20
ret void
}