#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 scanf(char *, char *, char *);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int main(void) {
  char caractereComProblema, *numeroPtr, numero[128];
  while (scanf("%c %s%*c", &caractereComProblema, numero),
         caractereComProblema != '0' || strcmp(numero, "0") != 0) {
    numeroPtr = numero;
    while (*numeroPtr != '\0') {
      if (*numeroPtr == caractereComProblema) {
        strcpy(numeroPtr, numeroPtr + 1);
      } else {
        numeroPtr++;
      }
    }
    numeroPtr = numero;
    while (*numeroPtr == '0') {
      strcpy(numeroPtr, numeroPtr + 1);
    }
    if (numero[0] == '\0') {
      printf("0\n");
    } else {
      printf("%s\n", numero);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x90(%rbp),%rdx
lea    0xea0(%rip),%rdi
lea    -0x5(%rbp),%rsi
call   1060 <scanf@plt>
movsbl -0x5(%rbp),%ecx
mov    $0x1,%al
cmp    $0x30,%ecx
mov    %al,-0x91(%rbp)
jne    119e <main+0x5e>
lea    -0x90(%rbp),%rdi
lea    0xe7d(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x91(%rbp)
mov    -0x91(%rbp),%al
test   $0x1,%al
jne    11b1 <main+0x71>
jmp    1274 <main+0x134>
lea    -0x90(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1206 <main+0xc6>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
movsbl -0x5(%rbp),%ecx
cmp    %ecx,%eax
jne    11f5 <main+0xb5>
mov    -0x10(%rbp),%rdi
mov    -0x10(%rbp),%rsi
add    $0x1,%rsi
call   1030 <strcpy@plt>
jmp    1201 <main+0xc1>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    11bc <main+0x7c>
lea    -0x90(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x30,%eax
jne    1237 <main+0xf7>
mov    -0x10(%rbp),%rdi
mov    -0x10(%rbp),%rsi
add    $0x1,%rsi
call   1030 <strcpy@plt>
jmp    1211 <main+0xd1>
movsbl -0x90(%rbp),%eax
cmp    $0x0,%eax
jne    125a <main+0x11a>
lea    0xdbd(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    126f <main+0x12f>
lea    -0x90(%rbp),%rsi
lea    0xda6(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1152 <main+0x12>
xor    %eax,%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x98,%rsp
lea    0x11(%rsp),%r12
lea    0xea3(%rip),%r14
lea    0xf(%rsp),%r15
lea    0x10(%rsp),%rbx
lea    0xe9b(%rip),%r13
jmp    1178 <main+0x38>
mov    %r13,%rdi
call   1040 <puts@plt>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
call   1060 <scanf@plt>
cmpb   $0x30,0xf(%rsp)
jne    119d <main+0x5d>
mov    %rbx,%rdi
mov    %r13,%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
je     11f2 <main+0xb2>
mov    0x10(%rsp),%al
test   %al,%al
je     11db <main+0x9b>
mov    %rbx,%rbp
jmp    11c0 <main+0x80>
nopw   0x0(%rax,%rax,1)
mov    %rbp,%rdi
call   1030 <strcpy@plt>
movzbl 0x0(%rbp),%eax
test   %al,%al
je     11db <main+0x9b>
lea    0x1(%rbp),%rsi
cmp    0xf(%rsp),%al
je     11b0 <main+0x70>
mov    %rsi,%rbp
jmp    11b8 <main+0x78>
nop
mov    %rbx,%rdi
mov    %r12,%rsi
call   1030 <strcpy@plt>
movzbl 0x10(%rsp),%eax
cmp    $0x30,%al
je     11d0 <main+0x90>
test   %al,%al
je     1170 <main+0x30>
mov    %rbx,%rdi
call   1040 <puts@plt>
jmp    1178 <main+0x38>
xor    %eax,%eax
add    $0x98,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [9 x i8] c"%c %s%*c\00"
@str = [2 x i8] c"0\00"
define i32 @main() {
%1 = alloca i8
%2 = alloca [128 x i8]
%3 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%4 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 1
br label %5
5: ; preds = %36, %0
%6 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %1, i8* %3)
%7 = load i8, i8* %1
%8 = icmp eq i8 %7, 48
br i1 %8, label %9, label %12
9: ; preds = %5
%10 = call i64 @strcmp(i8* %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
%11 = icmp eq i64 %10, 0
br i1 %11, label %37, label %12
12: ; preds = %5, %9
%13 = load i8, i8* %3
%14 = icmp eq i8 %13, 0
br i1 %14, label %27, label %15
15: ; preds = %12, %23
%16 = phi i8 [ %25, %23 ], [ %13, %12 ]
%17 = phi i8* [ %24, %23 ], [ %3, %12 ]
%18 = load i8, i8* %1
%19 = icmp eq i8 %16, %18
%20 = getelementptr inbounds i8, i8* %17, i64 1
br i1 %19, label %21, label %23
21: ; preds = %15
%22 = call i32 @strcpy(i8* %17, i8* %20)
br label %23
23: ; preds = %15, %21
%24 = phi i8* [ %17, %21 ], [ %20, %15 ]
%25 = load i8, i8* %24
%26 = icmp eq i8 %25, 0
br i1 %26, label %27, label %15
27: ; preds = %23, %12
br label %28
28: ; preds = %27, %30
%29 = load i8, i8* %3
switch i8 %29, label %34 [
i8 48, label %30
i8 0, label %32
]
30: ; preds = %28
%31 = call i32 @strcpy(i8* %3, i8* %4)
br label %28
32: ; preds = %28
%33 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
br label %36
34: ; preds = %28
%35 = call i32 @puts(i8* %3)
br label %36
36: ; preds = %34, %32
br label %5
37: ; preds = %9
ret i32 0
}