#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*/ isNucleotide(char);
int strlen(char *);
short isValidNucleotideContents(char *dna) {
  int lenght = strlen(dna);
  int current = 0;
  if (lenght == 0)
    return 0;
  while (current < lenght)
    if (!isNucleotide(dna[current++]))
      return 0;
  return 1;
}


x86 assembly (clang, -O0):
<isValidNucleotideContents>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    1154 <isValidNucleotideContents+0x34>
movw   $0x0,-0x2(%rbp)
jmp    119f <isValidNucleotideContents+0x7f>
jmp    1159 <isValidNucleotideContents+0x39>
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1199 <isValidNucleotideContents+0x79>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x18(%rbp)
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%edi
call   1040 <isNucleotide@plt>
cmp    $0x0,%eax
jne    1194 <isValidNucleotideContents+0x74>
movw   $0x0,-0x2(%rbp)
jmp    119f <isValidNucleotideContents+0x7f>
jmp    1159 <isValidNucleotideContents+0x39>
movw   $0x1,-0x2(%rbp)
movswl -0x2(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isValidNucleotideContents>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
call   1030 <strlen@plt>
xor    %ebx,%ebx
test   %eax,%eax
je     115f <isValidNucleotideContents+0x3f>
mov    %eax,%r15d
cmovle %ebx,%r15d
nopw   0x0(%rax,%rax,1)
cmp    %rbx,%r15
je     115b <isValidNucleotideContents+0x3b>
movsbl (%r14,%rbx,1),%edi
add    $0x1,%rbx
call   1040 <isNucleotide@plt>
test   %eax,%eax
jne    1140 <isValidNucleotideContents+0x20>
xor    %ebx,%ebx
jmp    115f <isValidNucleotideContents+0x3f>
mov    $0x1,%bx
mov    %ebx,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define signext i16 @isValidNucleotideContents(i8* %0) {
%2 = alloca i16
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %3
%6 = load i8*, i8** %3
%7 = call i32 @strlen(i8* %6)
store i32 %7, i32* %4
store i32 0, i32* %5
%8 = load i32, i32* %4
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %1
store i16 0, i16* %2
br label %28
11: ; preds = %1
br label %12
12: ; preds = %26, %11
%13 = load i32, i32* %5
%14 = load i32, i32* %4
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %27
16: ; preds = %12
%17 = load i8*, i8** %3
%18 = load i32, i32* %5
%19 = add nsw i32 %18, 1
store i32 %19, i32* %5
%20 = sext i32 %18 to i64
%21 = getelementptr inbounds i8, i8* %17, i64 %20
%22 = load i8, i8* %21
%23 = call i32 @isNucleotide(i8 signext %22)
%24 = icmp ne i32 %23, 0
br i1 %24, label %26, label %25
25: ; preds = %16
store i16 0, i16* %2
br label %28
26: ; preds = %16
br label %12
27: ; preds = %12
store i16 1, i16* %2
br label %28
28: ; preds = %27, %25, %10
%29 = load i16, i16* %2
ret i16 %29
}

LLVM IR (-O2):
define signext i16 @isValidNucleotideContents(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = icmp eq i32 %2, 0
br i1 %3, label %16, label %4
4: ; preds = %1
%5 = call i32 @llvm.smax.i32(i32 %2, i32 0)
%6 = zext i32 %5 to i64
br label %7
7: ; preds = %4, %10
%8 = phi i64 [ 0, %4 ], [ %11, %10 ]
%9 = icmp eq i64 %8, %6
br i1 %9, label %16, label %10
10: ; preds = %7
%11 = add nuw nsw i64 %8, 1
%12 = getelementptr inbounds i8, i8* %0, i64 %8
%13 = load i8, i8* %12
%14 = tail call i32 @isNucleotide(i8 signext %13)
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %7
16: ; preds = %7, %10, %1
%17 = phi i16 [ 0, %1 ], [ 1, %7 ], [ 0, %10 ]
ret i16 %17
}