#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*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, char *);
int main() {
  char orig_str[100] = {0};
  char squeeze_str[100] = {0};
  char new_str[100] = {0};
  int i, j, k;
  int flag = 0;
  printf("Enter orig_str: ");
  scanf(" %s", orig_str);
  printf("orig_str : %s\n", orig_str);
  printf("Enter string(whose chars)to remove\n");
  scanf(" %s", squeeze_str);
  for (i = 0, k = 0; orig_str[i] != '\0'; i++) {
    flag = 0;
    for (j = 0; squeeze_str[j] != '\0'; j++) {
      if (orig_str[i] == squeeze_str[j]) {
        flag = 1;
        break;
      }
    }
    if (flag != 1) {
      new_str[k++] = orig_str[i];
    }
  }
  new_str[k] = '\0';
  printf("new str : %s\n", new_str);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x160,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x70(%rbp),%rdi
xor    %esi,%esi
mov    $0x64,%edx
call   1040 <memset@plt>
lea    -0xe0(%rbp),%rdi
xor    %esi,%esi
mov    $0x64,%edx
call   1040 <memset@plt>
lea    -0x150(%rbp),%rdi
xor    %esi,%esi
mov    $0x64,%edx
call   1040 <memset@plt>
movl   $0x0,-0x160(%rbp)
lea    0xe77(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x70(%rbp),%rsi
lea    0xe76(%rip),%rdi
call   1050 <scanf@plt>
lea    -0x70(%rbp),%rsi
lea    0xe6a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe6b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0xe0(%rbp),%rsi
lea    0xe43(%rip),%rdi
call   1050 <scanf@plt>
movl   $0x0,-0x154(%rbp)
movl   $0x0,-0x15c(%rbp)
movslq -0x154(%rbp),%rax
movsbl -0x70(%rbp,%rax,1),%eax
cmp    $0x0,%eax
je     12be <main+0x18e>
movl   $0x0,-0x160(%rbp)
movl   $0x0,-0x158(%rbp)
movslq -0x158(%rbp),%rax
movsbl -0xe0(%rbp,%rax,1),%eax
ff
cmp    $0x0,%eax
je     1273 <main+0x143>
movslq -0x154(%rbp),%rax
movsbl -0x70(%rbp,%rax,1),%eax
movslq -0x158(%rbp),%rcx
movsbl -0xe0(%rbp,%rcx,1),%ecx
ff
cmp    %ecx,%eax
jne    125a <main+0x12a>
movl   $0x1,-0x160(%rbp)
jmp    1273 <main+0x143>
jmp    125f <main+0x12f>
mov    -0x158(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x158(%rbp)
jmp    1210 <main+0xe0>
cmpl   $0x1,-0x160(%rbp)
je     12a5 <main+0x175>
movslq -0x154(%rbp),%rax
mov    -0x70(%rbp,%rax,1),%cl
mov    -0x15c(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x15c(%rbp)
cltq
mov    %cl,-0x150(%rbp,%rax,1)
jmp    12aa <main+0x17a>
mov    -0x154(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x154(%rbp)
jmp    11e7 <main+0xb7>
movslq -0x15c(%rbp),%rax
movb   $0x0,-0x150(%rbp,%rax,1)
lea    -0x150(%rbp),%rsi
lea    0xd6d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x160,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x150,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x130(%rsp)
movaps %xmm0,0x120(%rsp)
movaps %xmm0,0x110(%rsp)
movaps %xmm0,0x100(%rsp)
movaps %xmm0,0xf0(%rsp)
movaps %xmm0,0xe0(%rsp)
movl   $0x0,0x140(%rsp)
movaps %xmm0,0xc0(%rsp)
movaps %xmm0,0xb0(%rsp)
movaps %xmm0,0xa0(%rsp)
movaps %xmm0,0x90(%rsp)
movaps %xmm0,0x80(%rsp)
movaps %xmm0,0x70(%rsp)
movl   $0x0,0xd0(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
movl   $0x0,0x60(%rsp)
lea    0xe23(%rip),%rdi
xor    %ebp,%ebp
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe24(%rip),%r14
lea    0xe0(%rsp),%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
lea    0xe0e(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe1a(%rip),%rdi
call   1030 <puts@plt>
lea    0x70(%rsp),%rsi
mov    %r14,%rdi
call   1050 <scanf@plt>
mov    0xe0(%rsp),%dl
test   %dl,%dl
je     1291 <main+0x161>
mov    0x70(%rsp),%bl
xor    %ecx,%ecx
lea    0x71(%rsp),%rsi
xor    %ebp,%ebp
jmp    1268 <main+0x138>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movslq %ebp,%rax
add    $0x1,%ebp
mov    %dl,(%rsp,%rax,1)
mov    0xe1(%rsp,%rcx,1),%dl
add    $0x1,%rcx
test   %dl,%dl
je     1291 <main+0x161>
test   %bl,%bl
je     1250 <main+0x120>
mov    %rsi,%rdi
mov    %ebx,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
cmp    %al,%dl
je     1259 <main+0x129>
movzbl (%rdi),%eax
add    $0x1,%rdi
test   %al,%al
jne    1280 <main+0x150>
jmp    1250 <main+0x120>
movslq %ebp,%rax
movb   $0x0,(%rsp,%rax,1)
lea    0xd85(%rip),%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x150,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [17 x i8] c"Enter orig_str: \00"
@.str.1 = [4 x i8] c" %s\00"
@.str.2 = [15 x i8] c"orig_str : %s\0A\00"
@.str.4 = [14 x i8] c"new str : %s\0A\00"
@str = [35 x i8] c"Enter string(whose chars)to remove\00"
define i32 @main() {
%1 = alloca [100 x i8]
%2 = alloca [100 x i8]
%3 = alloca [100 x i8]
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%5 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%6 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8* %4)
%10 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %5)
%12 = load i8, i8* %4
%13 = icmp eq i8 %12, 0
br i1 %13, label %40, label %14
14: ; preds = %0
%15 = load i8, i8* %5
%16 = icmp eq i8 %15, 0
br label %17
17: ; preds = %14, %34
%18 = phi i64 [ 0, %14 ], [ %36, %34 ]
%19 = phi i8 [ %12, %14 ], [ %38, %34 ]
%20 = phi i32 [ 0, %14 ], [ %35, %34 ]
br i1 %16, label %30, label %25
21: ; preds = %25
%22 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %29
%23 = load i8, i8* %22
%24 = icmp eq i8 %23, 0
br i1 %24, label %30, label %25
25: ; preds = %17, %21
%26 = phi i64 [ %29, %21 ], [ 0, %17 ]
%27 = phi i8 [ %23, %21 ], [ %15, %17 ]
%28 = icmp eq i8 %19, %27
%29 = add nuw i64 %26, 1
br i1 %28, label %34, label %21
30: ; preds = %21, %17
%31 = add nsw i32 %20, 1
%32 = sext i32 %20 to i64
%33 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 %32
store i8 %19, i8* %33
br label %34
34: ; preds = %25, %30
%35 = phi i32 [ %31, %30 ], [ %20, %25 ]
%36 = add nuw i64 %18, 1
%37 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 %36
%38 = load i8, i8* %37
%39 = icmp eq i8 %38, 0
br i1 %39, label %40, label %17
40: ; preds = %34, %0
%41 = phi i32 [ 0, %0 ], [ %35, %34 ]
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 %42
store i8 0, i8* %43
%44 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i8* %6)
ret i32 0
}