#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__ isUpperAlpha(char);
int /*<<< orphan*/ printf(char *, ...);
void strfilter(char randStr[], char uStr[], char resetChar) {
  char filteredStr[41] = "\0";
  unsigned int i = 0;
  unsigned int arrLength = 0;
  while (isUpperAlpha(*(randStr + i))) {
    *(filteredStr + i) = *(randStr + i);
    while (isUpperAlpha(*(uStr + arrLength))) {
      if (*(randStr + i) == *(uStr + arrLength))
        *(filteredStr + i) = resetChar;
      arrLength++;
    }
    i++;
    arrLength = 0;
  }
  printf("filtered s1 = {\"%s\"}\n", filteredStr);
  printf("Please input at least 2 upper case letters to reset followed by a "
         "space and a \"reset\" character.\n");
  printf("Or type \"No\" to quit.\n");
}


x86 assembly (clang, -O0):
<strfilter>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %dl,%al
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x29,%edx
call   1040 <memset@plt>
movl   $0x0,-0x44(%rbp)
movl   $0x0,-0x48(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x44(%rbp),%ecx
movsbl (%rax,%rcx,1),%edi
call   1050 <isUpperAlpha@plt>
cmp    $0x0,%rax
je     11f3 <strfilter+0xc3>
mov    -0x8(%rbp),%rax
mov    -0x44(%rbp),%ecx
mov    (%rax,%rcx,1),%cl
mov    -0x44(%rbp),%eax
mov    %cl,-0x40(%rbp,%rax,1)
mov    -0x10(%rbp),%rax
mov    -0x48(%rbp),%ecx
movsbl (%rax,%rcx,1),%edi
call   1050 <isUpperAlpha@plt>
cmp    $0x0,%rax
je     11de <strfilter+0xae>
mov    -0x8(%rbp),%rax
mov    -0x44(%rbp),%ecx
movsbl (%rax,%rcx,1),%eax
mov    -0x10(%rbp),%rcx
mov    -0x48(%rbp),%edx
movsbl (%rcx,%rdx,1),%ecx
cmp    %ecx,%eax
jne    11d0 <strfilter+0xa0>
mov    -0x11(%rbp),%cl
mov    -0x44(%rbp),%eax
mov    %cl,-0x40(%rbp,%rax,1)
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
jmp    118e <strfilter+0x5e>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
movl   $0x0,-0x48(%rbp)
jmp    1163 <strfilter+0x33>
lea    -0x40(%rbp),%rsi
lea    0xe02(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe0a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe5e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strfilter>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %edx,%r15d
mov    %rsi,%r14
mov    %rdi,%rbx
xorps  %xmm0,%xmm0
movups %xmm0,0x29(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movsbl (%rdi),%edi
call   1050 <isUpperAlpha@plt>
test   %rax,%rax
je     11e8 <strfilter+0xb8>
xor    %r12d,%r12d
mov    %rbx,%r13
mov    %rbx,0x8(%rsp)
jmp    119c <strfilter+0x6c>
nopw   0x0(%rax,%rax,1)
add    $0x1,%r12d
mov    0x8(%rsp),%rbx
lea    (%rbx,%r12,1),%r13
movsbl (%rbx,%r12,1),%edi
call   1050 <isUpperAlpha@plt>
test   %rax,%rax
je     11e8 <strfilter+0xb8>
mov    (%rbx,%r12,1),%al
mov    %al,0x10(%rsp,%r12,1)
movsbl (%r14),%edi
call   1050 <isUpperAlpha@plt>
test   %rax,%rax
je     1180 <strfilter+0x50>
mov    $0x1,%ebp
mov    %r14,%rbx
jmp    11d8 <strfilter+0xa8>
nopl   (%rax)
mov    %ebp,%eax
lea    (%r14,%rax,1),%rbx
movsbl (%r14,%rax,1),%edi
call   1050 <isUpperAlpha@plt>
add    $0x1,%ebp
test   %rax,%rax
je     1180 <strfilter+0x50>
movzbl 0x0(%r13),%eax
cmp    (%rbx),%al
jne    11c0 <strfilter+0x90>
mov    %r15b,0x10(%rsp,%r12,1)
jmp    11c0 <strfilter+0x90>
lea    0xe11(%rip),%rdi
lea    0x10(%rsp),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe14(%rip),%rdi
call   1030 <puts@plt>
lea    0xe69(%rip),%rdi
call   1030 <puts@plt>
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [22 x i8] c"filtered s1 = {\22%s\22}\0A\00"
@.str.1 = [98 x i8] c"Please input at least 2 upper case letters to reset followed by a space and a \22reset\22 character.\0A\00"
@.str.2 = [23 x i8] c"Or type \22No\22 to quit.\0A\00"
define void @strfilter(i8* %0, i8* %1, i8 signext %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8
%7 = alloca [41 x i8]
%8 = alloca i32
%9 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8 %2, i8* %6
%10 = bitcast [41 x i8]* %7 to i8*
store i32 0, i32* %8
store i32 0, i32* %9
br label %11
11: ; preds = %60, %3
%12 = load i8*, i8** %4
%13 = load i32, i32* %8
%14 = zext i32 %13 to i64
%15 = getelementptr inbounds i8, i8* %12, i64 %14
%16 = load i8, i8* %15
%17 = call i64 @isUpperAlpha(i8 signext %16)
%18 = icmp ne i64 %17, 0
br i1 %18, label %19, label %63
19: ; preds = %11
%20 = load i8*, i8** %4
%21 = load i32, i32* %8
%22 = zext i32 %21 to i64
%23 = getelementptr inbounds i8, i8* %20, i64 %22
%24 = load i8, i8* %23
%25 = getelementptr inbounds [41 x i8], [41 x i8]* %7, i64 0, i64 0
%26 = load i32, i32* %8
%27 = zext i32 %26 to i64
%28 = getelementptr inbounds i8, i8* %25, i64 %27
store i8 %24, i8* %28
br label %29
29: ; preds = %57, %19
%30 = load i8*, i8** %5
%31 = load i32, i32* %9
%32 = zext i32 %31 to i64
%33 = getelementptr inbounds i8, i8* %30, i64 %32
%34 = load i8, i8* %33
%35 = call i64 @isUpperAlpha(i8 signext %34)
%36 = icmp ne i64 %35, 0
br i1 %36, label %37, label %60
37: ; preds = %29
%38 = load i8*, i8** %4
%39 = load i32, i32* %8
%40 = zext i32 %39 to i64
%41 = getelementptr inbounds i8, i8* %38, i64 %40
%42 = load i8, i8* %41
%43 = sext i8 %42 to i32
%44 = load i8*, i8** %5
%45 = load i32, i32* %9
%46 = zext i32 %45 to i64
%47 = getelementptr inbounds i8, i8* %44, i64 %46
%48 = load i8, i8* %47
%49 = sext i8 %48 to i32
%50 = icmp eq i32 %43, %49
br i1 %50, label %51, label %57
51: ; preds = %37
%52 = load i8, i8* %6
%53 = getelementptr inbounds [41 x i8], [41 x i8]* %7, i64 0, i64 0
%54 = load i32, i32* %8
%55 = zext i32 %54 to i64
%56 = getelementptr inbounds i8, i8* %53, i64 %55
store i8 %52, i8* %56
br label %57
57: ; preds = %51, %37
%58 = load i32, i32* %9
%59 = add i32 %58, 1
store i32 %59, i32* %9
br label %29
60: ; preds = %29
%61 = load i32, i32* %8
%62 = add i32 %61, 1
store i32 %62, i32* %8
store i32 0, i32* %9
br label %11
63: ; preds = %11
%64 = getelementptr inbounds [41 x i8], [41 x i8]* %7, i64 0, i64 0
%65 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %64)
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([98 x i8], [98 x i8]* @.str.1, i64 0, i64 0))
%67 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [22 x i8] c"filtered s1 = {\22%s\22}\0A\00"
@str = [97 x i8] c"Please input at least 2 upper case letters to reset followed by a space and a \22reset\22 character.\00"
@str.3 = [22 x i8] c"Or type \22No\22 to quit.\00"
define void @strfilter(i8* nocapture %0, i8* nocapture %1, i8 signext %2) {
%4 = alloca [41 x i8]
%5 = getelementptr inbounds [41 x i8], [41 x i8]* %4, i64 0, i64 0
%6 = load i8, i8* %0
%7 = tail call i64 @isUpperAlpha(i8 signext %6)
%8 = icmp eq i64 %7, 0
br i1 %8, label %38, label %9
9: ; preds = %3, %31
%10 = phi i8* [ %34, %31 ], [ %0, %3 ]
%11 = phi i64 [ %33, %31 ], [ 0, %3 ]
%12 = load i8, i8* %10
%13 = getelementptr inbounds [41 x i8], [41 x i8]* %4, i64 0, i64 %11
store i8 %12, i8* %13
%14 = load i8, i8* %1
%15 = tail call i64 @isUpperAlpha(i8 signext %14)
%16 = icmp eq i64 %15, 0
br i1 %16, label %31, label %17
17: ; preds = %9, %24
%18 = phi i8* [ %27, %24 ], [ %1, %9 ]
%19 = phi i32 [ %25, %24 ], [ 0, %9 ]
%20 = load i8, i8* %10
%21 = load i8, i8* %18
%22 = icmp eq i8 %20, %21
br i1 %22, label %23, label %24
23: ; preds = %17
store i8 %2, i8* %13
br label %24
24: ; preds = %23, %17
%25 = add i32 %19, 1
%26 = zext i32 %25 to i64
%27 = getelementptr inbounds i8, i8* %1, i64 %26
%28 = load i8, i8* %27
%29 = tail call i64 @isUpperAlpha(i8 signext %28)
%30 = icmp eq i64 %29, 0
br i1 %30, label %31, label %17
31: ; preds = %24, %9
%32 = add nuw nsw i64 %11, 1
%33 = and i64 %32, 4294967295
%34 = getelementptr inbounds i8, i8* %0, i64 %33
%35 = load i8, i8* %34
%36 = tail call i64 @isUpperAlpha(i8 signext %35)
%37 = icmp eq i64 %36, 0
br i1 %37, label %38, label %9
38: ; preds = %31, %3
%39 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %5)
%40 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([97 x i8], [97 x i8]* @str, i64 0, i64 0))
%41 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.3, i64 0, i64 0))
ret void
}