#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*/ gets(char *);
int /*<<< orphan*/ memmove(char *, char *, scalar_t__);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ puts(char *);
scalar_t__ strlen(char *);
main() {
  char str[20];
  int i;
  puts("enter a string: ");
  gets(str);
  for (i = 0; str[i]; i++) {
    if (!((str[i] >= 'a') && (str[i] <= 'z')) ||
        ((str[i] >= 'A') && (str[i] <= 'Z'))) {
      memmove(str + i, str + i + 1, strlen(str + i + 1) + 1);
      i--;
    }
  }
  printf("%s\n", str);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe9a(%rip),%rdi
call   1030 <puts@plt>
lea    -0x20(%rbp),%rdi
call   1060 <gets@plt>
movl   $0x0,-0x24(%rbp)
movslq -0x24(%rbp),%rax
cmpb   $0x0,-0x20(%rbp,%rax,1)
je     1238 <main+0xe8>
movslq -0x24(%rbp),%rax
movsbl -0x20(%rbp,%rax,1),%eax
cmp    $0x61,%eax
jl     11d2 <main+0x82>
movslq -0x24(%rbp),%rax
movsbl -0x20(%rbp,%rax,1),%eax
cmp    $0x7a,%eax
jg     11d2 <main+0x82>
movslq -0x24(%rbp),%rax
movsbl -0x20(%rbp,%rax,1),%eax
cmp    $0x41,%eax
jl     1225 <main+0xd5>
movslq -0x24(%rbp),%rax
movsbl -0x20(%rbp,%rax,1),%eax
cmp    $0x5a,%eax
jg     1225 <main+0xd5>
lea    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0x38(%rbp)
lea    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
add    %rcx,%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
lea    -0x20(%rbp),%rdi
movslq -0x24(%rbp),%rax
add    %rax,%rdi
add    $0x1,%rdi
call   1040 <strlen@plt>
mov    -0x38(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    %rax,%rdx
add    $0x1,%rdx
call   1070 <memmove@plt>
mov    -0x24(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x24(%rbp)
jmp    122a <main+0xda>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    117b <main+0x2b>
lea    -0x20(%rbp),%rsi
lea    0xdce(%rip),%rdi
call   1050 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x20,%rsp
lea    0xea0(%rip),%rdi
call   1030 <puts@plt>
mov    %rsp,%r15
mov    %r15,%rdi
call   1060 <gets@plt>
mov    (%rsp),%al
test   %al,%al
je     11be <main+0x6e>
xor    %ebx,%ebx
jmp    1198 <main+0x48>
nopl   0x0(%rax,%rax,1)
movslq %ebx,%rax
lea    0x1(%rax),%rbx
lea    (%rsp,%rax,1),%r15
add    $0x1,%r15
movzbl 0x1(%rsp,%rax,1),%eax
test   %al,%al
je     11be <main+0x6e>
add    $0x9f,%al
cmp    $0x1a,%al
jb     1180 <main+0x30>
lea    0x1(%r15),%r14
mov    %r14,%rdi
call   1040 <strlen@plt>
lea    0x1(%rax),%rdx
mov    %r15,%rdi
mov    %r14,%rsi
call   1070 <memmove@plt>
add    $0xffffffff,%ebx
jmp    1180 <main+0x30>
lea    0xe4c(%rip),%rdi
mov    %rsp,%rsi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [17 x i8] c"enter a string: \00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [20 x i8]
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 @puts(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%5 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%6 = call i32 @gets(i8* %5)
store i32 0, i32* %3
br label %7
7: ; preds = %62, %0
%8 = load i32, i32* %3
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 %9
%11 = load i8, i8* %10
%12 = icmp ne i8 %11, 0
br i1 %12, label %13, label %65
13: ; preds = %7
%14 = load i32, i32* %3
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 %15
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = icmp sge i32 %18, 97
br i1 %19, label %20, label %41
20: ; preds = %13
%21 = load i32, i32* %3
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 %22
%24 = load i8, i8* %23
%25 = sext i8 %24 to i32
%26 = icmp sle i32 %25, 122
br i1 %26, label %27, label %41
27: ; preds = %20
%28 = load i32, i32* %3
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 %29
%31 = load i8, i8* %30
%32 = sext i8 %31 to i32
%33 = icmp sge i32 %32, 65
br i1 %33, label %34, label %61
34: ; preds = %27
%35 = load i32, i32* %3
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 %36
%38 = load i8, i8* %37
%39 = sext i8 %38 to i32
%40 = icmp sle i32 %39, 90
br i1 %40, label %41, label %61
41: ; preds = %34, %20, %13
%42 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%43 = load i32, i32* %3
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds i8, i8* %42, i64 %44
%46 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%47 = load i32, i32* %3
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds i8, i8* %46, i64 %48
%50 = getelementptr inbounds i8, i8* %49, i64 1
%51 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%52 = load i32, i32* %3
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds i8, i8* %51, i64 %53
%55 = getelementptr inbounds i8, i8* %54, i64 1
%56 = call i64 @strlen(i8* %55)
%57 = add nsw i64 %56, 1
%58 = call i32 @memmove(i8* %45, i8* %50, i64 %57)
%59 = load i32, i32* %3
%60 = add nsw i32 %59, -1
store i32 %60, i32* %3
br label %61
61: ; preds = %41, %34, %27
br label %62
62: ; preds = %61
%63 = load i32, i32* %3
%64 = add nsw i32 %63, 1
store i32 %64, i32* %3
br label %7
65: ; preds = %7
%66 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%67 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %66)
%68 = load i32, i32* %1
ret i32 %68
}

LLVM IR (-O2):
@.str = [17 x i8] c"enter a string: \00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca [20 x i8]
%2 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @gets(i8* %2)
%5 = load i8, i8* %2
%6 = icmp eq i8 %5, 0
br i1 %6, label %26, label %7
7: ; preds = %0, %19
%8 = phi i8 [ %24, %19 ], [ %5, %0 ]
%9 = phi i8* [ %23, %19 ], [ %2, %0 ]
%10 = phi i32 [ %21, %19 ], [ 0, %0 ]
%11 = add i8 %8, -97
%12 = icmp ult i8 %11, 26
br i1 %12, label %19, label %13
13: ; preds = %7
%14 = getelementptr inbounds i8, i8* %9, i64 1
%15 = call i64 @strlen(i8* %14)
%16 = add nsw i64 %15, 1
%17 = call i32 @memmove(i8* %9, i8* %14, i64 %16)
%18 = add nsw i32 %10, -1
br label %19
19: ; preds = %7, %13
%20 = phi i32 [ %18, %13 ], [ %10, %7 ]
%21 = add nsw i32 %20, 1
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 %22
%24 = load i8, i8* %23
%25 = icmp eq i8 %24, 0
br i1 %25, label %26, label %7
26: ; preds = %19, %0
%27 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %2)
ret i32 0
}