#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__ isalpha(char);
int valid_characters(char *line) {
  int valid = 1;
  char *line_pos = NULL;
  for (line_pos = line; valid && *line_pos != '\n'; line_pos++) {
    if (isalpha(*line_pos))
      valid = 0;
  }
  return valid;
}


x86 assembly (clang, -O0):
<valid_characters>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0xc(%rbp)
mov    %al,-0x19(%rbp)
je     1152 <valid_characters+0x42>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xa,%eax
setne  %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    1162 <valid_characters+0x52>
jmp    1195 <valid_characters+0x85>
mov    -0x18(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isalpha@plt>
cmp    $0x0,%rax
je     117f <valid_characters+0x6f>
movl   $0x0,-0xc(%rbp)
jmp    1184 <valid_characters+0x74>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1133 <valid_characters+0x23>
mov    -0xc(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<valid_characters>:
push   %rbx
mov    %rdi,%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movzbl (%rbx),%eax
cmp    $0xa,%al
je     113c <valid_characters+0x2c>
movsbl %al,%edi
call   1030 <isalpha@plt>
add    $0x1,%rbx
test   %rax,%rax
je     1120 <valid_characters+0x10>
xor    %eax,%eax
pop    %rbx
ret
mov    $0x1,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @valid_characters(i8* nocapture %0) {
br label %2
2: ; preds = %1, %6
%3 = phi i8* [ %0, %1 ], [ %9, %6 ]
%4 = load i8, i8* %3
%5 = icmp eq i8 %4, 10
br i1 %5, label %10, label %6
6: ; preds = %2
%7 = tail call i64 @isalpha(i8 signext %4)
%8 = icmp eq i64 %7, 0
%9 = getelementptr inbounds i8, i8* %3, i64 1
br i1 %8, label %2, label %10
10: ; preds = %6, %2
%11 = phi i32 [ 0, %6 ], [ 1, %2 ]
ret i32 %11
}