#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__ strlen(char *);
char *alphabetic(char *s) {
  static char alphstr[128 + 1];
  int i, pos;
  pos = 0;
  for (i = 0; i < (int)strlen(s); i++)
    if (((s[i] >= 'A') && (s[i] <= 'Z')) || ((s[i] >= 'a') && (s[i] <= 'z')))
      alphstr[pos++] = s[i];
  alphstr[pos] = '\0';
  return (alphstr);
}


x86 assembly (clang, -O0):
<alphabetic>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,%rcx
mov    -0x14(%rbp),%eax
cmp    %ecx,%eax
jge    11d1 <alphabetic+0xc1>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x41,%eax
jl     1171 <alphabetic+0x61>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x5a,%eax
jle    119b <alphabetic+0x8b>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x61,%eax
jl     11be <alphabetic+0xae>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x7a,%eax
jg     11be <alphabetic+0xae>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x10(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x10(%rbp)
movslq %eax,%rcx
lea    0x2e85(%rip),%rax
mov    %dl,(%rax,%rcx,1)
jmp    11c3 <alphabetic+0xb3>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    112a <alphabetic+0x1a>
movslq -0x10(%rbp),%rcx
lea    0x2e64(%rip),%rax
movb   $0x0,(%rax,%rcx,1)
lea    0x2e59(%rip),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<alphabetic>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1030 <strlen@plt>
test   %eax,%eax
jle    1171 <alphabetic+0x61>
xor    %ebp,%ebp
lea    0x2f14(%rip),%r15
xor    %r14d,%r14d
jmp    1153 <alphabetic+0x43>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x1,%rbp
mov    %rbx,%rdi
call   1030 <strlen@plt>
cltq
cmp    %rax,%rbp
jge    1174 <alphabetic+0x64>
movzbl (%rbx,%rbp,1),%eax
mov    %eax,%ecx
and    $0xdf,%cl
add    $0xbf,%cl
cmp    $0x19,%cl
ja     1140 <alphabetic+0x30>
movslq %r14d,%rcx
add    $0x1,%r14d
mov    %al,(%rcx,%r15,1)
jmp    1140 <alphabetic+0x30>
xor    %r14d,%r14d
movslq %r14d,%rcx
lea    0x2ec2(%rip),%rax
movb   $0x0,(%rcx,%rax,1)
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@alphabetic.alphstr = internal global [129 x i8] zeroinitializer
define i8* @alphabetic(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %4
store i32 0, i32* %3
br label %5
5: ; preds = %54, %1
%6 = load i32, i32* %3
%7 = load i8*, i8** %2
%8 = call i64 @strlen(i8* %7)
%9 = trunc i64 %8 to i32
%10 = icmp slt i32 %6, %9
br i1 %10, label %11, label %57
11: ; preds = %5
%12 = load i8*, i8** %2
%13 = load i32, i32* %3
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i8, i8* %12, i64 %14
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = icmp sge i32 %17, 65
br i1 %18, label %19, label %27
19: ; preds = %11
%20 = load i8*, i8** %2
%21 = load i32, i32* %3
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i8, i8* %20, i64 %22
%24 = load i8, i8* %23
%25 = sext i8 %24 to i32
%26 = icmp sle i32 %25, 90
br i1 %26, label %43, label %27
27: ; preds = %19, %11
%28 = load i8*, i8** %2
%29 = load i32, i32* %3
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i8, i8* %28, i64 %30
%32 = load i8, i8* %31
%33 = sext i8 %32 to i32
%34 = icmp sge i32 %33, 97
br i1 %34, label %35, label %53
35: ; preds = %27
%36 = load i8*, i8** %2
%37 = load i32, i32* %3
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds i8, i8* %36, i64 %38
%40 = load i8, i8* %39
%41 = sext i8 %40 to i32
%42 = icmp sle i32 %41, 122
br i1 %42, label %43, label %53
43: ; preds = %35, %19
%44 = load i8*, i8** %2
%45 = load i32, i32* %3
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds i8, i8* %44, i64 %46
%48 = load i8, i8* %47
%49 = load i32, i32* %4
%50 = add nsw i32 %49, 1
store i32 %50, i32* %4
%51 = sext i32 %49 to i64
%52 = getelementptr inbounds [129 x i8], [129 x i8]* @alphabetic.alphstr, i64 0, i64 %51
store i8 %48, i8* %52
br label %53
53: ; preds = %43, %35, %27
br label %54
54: ; preds = %53
%55 = load i32, i32* %3
%56 = add nsw i32 %55, 1
store i32 %56, i32* %3
br label %5
57: ; preds = %5
%58 = load i32, i32* %4
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds [129 x i8], [129 x i8]* @alphabetic.alphstr, i64 0, i64 %59
store i8 0, i8* %60
ret i8* getelementptr inbounds ([129 x i8], [129 x i8]* @alphabetic.alphstr, i64 0, i64 0)
}

LLVM IR (-O2):
@alphabetic.alphstr = internal global [129 x i8] zeroinitializer
define i8* @alphabetic(i8* nocapture %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = trunc i64 %2 to i32
%4 = icmp sgt i32 %3, 0
br i1 %4, label %5, label %24
5: ; preds = %1, %17
%6 = phi i64 [ %19, %17 ], [ 0, %1 ]
%7 = phi i32 [ %18, %17 ], [ 0, %1 ]
%8 = getelementptr inbounds i8, i8* %0, i64 %6
%9 = load i8, i8* %8
%10 = and i8 %9, -33
%11 = add i8 %10, -65
%12 = icmp ult i8 %11, 26
br i1 %12, label %13, label %17
13: ; preds = %5
%14 = add nsw i32 %7, 1
%15 = sext i32 %7 to i64
%16 = getelementptr inbounds [129 x i8], [129 x i8]* @alphabetic.alphstr, i64 0, i64 %15
store i8 %9, i8* %16
br label %17
17: ; preds = %5, %13
%18 = phi i32 [ %14, %13 ], [ %7, %5 ]
%19 = add nuw nsw i64 %6, 1
%20 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%21 = shl i64 %20, 32
%22 = ashr exact i64 %21, 32
%23 = icmp slt i64 %19, %22
br i1 %23, label %5, label %24
24: ; preds = %17, %1
%25 = phi i32 [ 0, %1 ], [ %18, %17 ]
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [129 x i8], [129 x i8]* @alphabetic.alphstr, i64 0, i64 %26
store i8 0, i8* %27
ret i8* getelementptr inbounds ([129 x i8], [129 x i8]* @alphabetic.alphstr, i64 0, i64 0)
}