#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*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, char *);
int strlen(char *);
int main() {
  int aux = 0, i, tam;
  char dig, valor[100];
  scanf("%c ", &dig);
  gets(valor);
  while (dig != '0' && valor[0] != '0') {
    tam = strlen(valor);
    for (i = 0; i < tam; ++i) {
      if (valor[i] == dig || valor[i] == '0')
        continue;
      else {
        printf("%c", valor[i]);
        ++aux;
      }
    }
    if (aux == 0)
      printf("0");
    aux = 0;
    printf("\n");
    scanf("%c ", &dig);
    gets(valor);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
lea    0xea0(%rip),%rdi
lea    -0x11(%rbp),%rsi
call   1060 <scanf@plt>
lea    -0x80(%rbp),%rdi
call   1050 <gets@plt>
movsbl -0x11(%rbp),%ecx
xor    %eax,%eax
cmp    $0x30,%ecx
mov    %al,-0x81(%rbp)
je     1197 <main+0x57>
movsbl -0x80(%rbp),%eax
cmp    $0x30,%eax
setne  %al
mov    %al,-0x81(%rbp)
mov    -0x81(%rbp),%al
test   $0x1,%al
jne    11aa <main+0x6a>
jmp    1273 <main+0x133>
lea    -0x80(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x10(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1228 <main+0xe8>
movslq -0xc(%rbp),%rax
movsbl -0x80(%rbp,%rax,1),%eax
movsbl -0x11(%rbp),%ecx
cmp    %ecx,%eax
je     11f0 <main+0xb0>
movslq -0xc(%rbp),%rax
movsbl -0x80(%rbp,%rax,1),%eax
cmp    $0x30,%eax
jne    11f5 <main+0xb5>
jmp    121a <main+0xda>
movslq -0xc(%rbp),%rax
movsbl -0x80(%rbp,%rax,1),%esi
lea    0xdff(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    121a <main+0xda>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11bd <main+0x7d>
cmpl   $0x0,-0x8(%rbp)
jne    1240 <main+0x100>
lea    0xdce(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x8(%rbp)
lea    0xdbb(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xda4(%rip),%rdi
lea    -0x11(%rbp),%rsi
call   1060 <scanf@plt>
lea    -0x80(%rbp),%rdi
call   1050 <gets@plt>
jmp    1172 <main+0x32>
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
lea    0xeab(%rip),%rdi
lea    0xf(%rsp),%rsi
call   1060 <scanf@plt>
lea    0x10(%rsp),%rdi
call   1050 <gets@plt>
cmpb   $0x30,0xf(%rsp)
je     121d <main+0xdd>
cmpb   $0x30,0x10(%rsp)
je     121d <main+0xdd>
lea    0x10(%rsp),%r12
lea    0xe75(%rip),%r14
lea    0xf(%rsp),%r15
mov    %r12,%rdi
call   1040 <strlen@plt>
test   %eax,%eax
jle    11e4 <main+0xa4>
mov    %eax,%r13d
xor    %ebx,%ebx
xor    %ebp,%ebp
jmp    11b9 <main+0x79>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%rbx
cmp    %rbx,%r13
je     11e0 <main+0xa0>
movsbl 0x10(%rsp,%rbx,1),%edi
cmp    $0x30,%edi
je     11b0 <main+0x70>
cmp    0xf(%rsp),%dil
je     11b0 <main+0x70>
call   1030 <putchar@plt>
add    $0x1,%ebp
jmp    11b0 <main+0x70>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
test   %ebp,%ebp
jne    11ee <main+0xae>
mov    $0x30,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %r14,%rdi
mov    %r15,%rsi
call   1060 <scanf@plt>
mov    %r12,%rdi
call   1050 <gets@plt>
cmpb   $0x30,0xf(%rsp)
je     121d <main+0xdd>
cmpb   $0x30,0x10(%rsp)
jne    1190 <main+0x50>
xor    %eax,%eax
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%c \00"
define i32 @main() {
%1 = alloca i8
%2 = alloca [100 x i8]
%3 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%4 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %1)
%5 = call i32 @gets(i8* %3)
%6 = load i8, i8* %1
%7 = icmp ne i8 %6, 48
%8 = load i8, i8* %3
%9 = icmp ne i8 %8, 48
%10 = select i1 %7, i1 %9, i1 false
br i1 %10, label %11, label %46
11: ; preds = %0, %37
%12 = call i32 @strlen(i8* %3)
%13 = icmp sgt i32 %12, 0
br i1 %13, label %14, label %35
14: ; preds = %11
%15 = zext i32 %12 to i64
br label %16
16: ; preds = %14, %29
%17 = phi i64 [ 0, %14 ], [ %31, %29 ]
%18 = phi i32 [ 0, %14 ], [ %30, %29 ]
%19 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %17
%20 = load i8, i8* %19
%21 = load i8, i8* %1
%22 = icmp eq i8 %20, %21
%23 = icmp eq i8 %20, 48
%24 = or i1 %23, %22
br i1 %24, label %29, label %25
25: ; preds = %16
%26 = sext i8 %20 to i32
%27 = call i32 @putchar(i32 %26)
%28 = add nsw i32 %18, 1
br label %29
29: ; preds = %16, %25
%30 = phi i32 [ %18, %16 ], [ %28, %25 ]
%31 = add nuw nsw i64 %17, 1
%32 = icmp eq i64 %31, %15
br i1 %32, label %33, label %16
33: ; preds = %29
%34 = icmp eq i32 %30, 0
br i1 %34, label %35, label %37
35: ; preds = %11, %33
%36 = call i32 @putchar(i32 48)
br label %37
37: ; preds = %35, %33
%38 = call i32 @putchar(i32 10)
%39 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %1)
%40 = call i32 @gets(i8* %3)
%41 = load i8, i8* %1
%42 = icmp ne i8 %41, 48
%43 = load i8, i8* %3
%44 = icmp ne i8 %43, 48
%45 = select i1 %42, i1 %44, i1 false
br i1 %45, label %11, label %46
46: ; preds = %37, %0
ret i32 0
}