#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__ gets(char *);
int /*<<< orphan*/ memset(int *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, char, int);
int /*<<< orphan*/ strcmp(char *, char *);
int strlen(char *);
int main() {
  int i, j, time[10];
  char line1[10], line2[100];
  while (gets(line1)) {
    if (!strcmp(line1, "#"))
      return 0;
    gets(line2);
    memset(time, 0, sizeof(int) * 10);
    for (i = 0; i < strlen(line1); i++) {
      for (j = 0; j < strlen(line2); j++) {
        if (line1[i] == line2[j])
          time[i]++;
      }
    }
    for (i = 0; i < strlen(line1); i++)
      printf("%c %d\n", line1[i], time[i]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x4a(%rbp),%rdi
call   1070 <gets@plt>
cmp    $0x0,%rax
je     12b8 <main+0x168>
lea    -0x4a(%rbp),%rdi
lea    0xe80(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%eax
jne    119a <main+0x4a>
movl   $0x0,-0x4(%rbp)
jmp    12bf <main+0x16f>
lea    -0xb0(%rbp),%rdi
call   1070 <gets@plt>
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1050 <memset@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xb4(%rbp)
lea    -0x4a(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0xb4(%rbp),%eax
cmp    %ecx,%eax
jge    125d <main+0x10d>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0xb8(%rbp)
lea    -0xb0(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0xb8(%rbp),%eax
cmp    %ecx,%eax
jge    124a <main+0xfa>
movslq -0x8(%rbp),%rax
movsbl -0x4a(%rbp,%rax,1),%eax
movslq -0xc(%rbp),%rcx
movsbl -0xb0(%rbp,%rcx,1),%ecx
ff
cmp    %ecx,%eax
jne    1237 <main+0xe7>
movslq -0x8(%rbp),%rax
mov    -0x40(%rbp,%rax,4),%ecx
add    $0x1,%ecx
mov    %ecx,-0x40(%rbp,%rax,4)
jmp    123c <main+0xec>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11e6 <main+0x96>
jmp    124f <main+0xff>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11bd <main+0x6d>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xbc(%rbp)
lea    -0x4a(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0xbc(%rbp),%eax
cmp    %ecx,%eax
jge    12b3 <main+0x163>
movslq -0x8(%rbp),%rax
mov    -0x4a(%rbp,%rax,1),%al
movslq -0x8(%rbp),%rcx
mov    -0x40(%rbp,%rcx,4),%edx
lea    0xd65(%rip),%rdi
movsbl %al,%esi
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1264 <main+0x114>
jmp    1162 <main+0x12>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xa8,%rsp
lea    0x6(%rsp),%rdi
call   1060 <gets@plt>
test   %rax,%rax
je     1279 <main+0x139>
lea    0x40(%rsp),%r13
lea    0x10(%rsp),%r14
lea    0x6(%rsp),%r15
lea    0xe88(%rip),%r12
jmp    1191 <main+0x51>
nopl   0x0(%rax)
mov    %r15,%rdi
call   1060 <gets@plt>
test   %rax,%rax
je     1279 <main+0x139>
cmpw   $0x23,0x6(%rsp)
je     1279 <main+0x139>
mov    %r13,%rdi
call   1060 <gets@plt>
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1050 <memset@plt>
mov    %r15,%rdi
call   1030 <strlen@plt>
test   %eax,%eax
jle    1230 <main+0xf0>
xor    %ebx,%ebx
jmp    11e3 <main+0xa3>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x1,%rbx
mov    %r15,%rdi
call   1030 <strlen@plt>
cltq
cmp    %rax,%rbx
jge    1230 <main+0xf0>
mov    %r13,%rdi
call   1030 <strlen@plt>
test   %eax,%eax
jle    11d0 <main+0x90>
xor    %ebp,%ebp
jmp    1213 <main+0xd3>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0x1,%rbp
mov    %r13,%rdi
call   1030 <strlen@plt>
cltq
cmp    %rax,%rbp
jge    11d0 <main+0x90>
movzbl 0x6(%rsp,%rbx,1),%eax
cmp    0x40(%rsp,%rbp,1),%al
jne    1200 <main+0xc0>
addl   $0x1,0x10(%rsp,%rbx,4)
jmp    1200 <main+0xc0>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r15,%rdi
call   1030 <strlen@plt>
test   %eax,%eax
jle    1180 <main+0x40>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsbl 0x6(%rsp,%rbx,1),%esi
mov    0x10(%rsp,%rbx,4),%edx
mov    %r12,%rdi
call   1040 <printf@plt>
add    $0x1,%rbx
mov    %r15,%rdi
call   1030 <strlen@plt>
cltq
cmp    %rax,%rbx
jl     1250 <main+0x110>
jmp    1180 <main+0x40>
xor    %eax,%eax
add    $0xa8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"#\00"
@.str.1 = [7 x i8] c"%c %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [10 x i32]
%5 = alloca [10 x i8]
%6 = alloca [100 x i8]
store i32 0, i32* %1
br label %7
7: ; preds = %77, %0
%8 = getelementptr inbounds [10 x i8], [10 x i8]* %5, i64 0, i64 0
%9 = call i64 @gets(i8* %8)
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %78
11: ; preds = %7
%12 = getelementptr inbounds [10 x i8], [10 x i8]* %5, i64 0, i64 0
%13 = call i32 @strcmp(i8* %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%14 = icmp ne i32 %13, 0
br i1 %14, label %16, label %15
15: ; preds = %11
store i32 0, i32* %1
br label %79
16: ; preds = %11
%17 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%18 = call i64 @gets(i8* %17)
%19 = getelementptr inbounds [10 x i32], [10 x i32]* %4, i64 0, i64 0
%20 = call i32 @memset(i32* %19, i32 0, i32 40)
store i32 0, i32* %2
br label %21
21: ; preds = %55, %16
%22 = load i32, i32* %2
%23 = getelementptr inbounds [10 x i8], [10 x i8]* %5, i64 0, i64 0
%24 = call i32 @strlen(i8* %23)
%25 = icmp slt i32 %22, %24
br i1 %25, label %26, label %58
26: ; preds = %21
store i32 0, i32* %3
br label %27
27: ; preds = %51, %26
%28 = load i32, i32* %3
%29 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%30 = call i32 @strlen(i8* %29)
%31 = icmp slt i32 %28, %30
br i1 %31, label %32, label %54
32: ; preds = %27
%33 = load i32, i32* %2
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds [10 x i8], [10 x i8]* %5, i64 0, i64 %34
%36 = load i8, i8* %35
%37 = sext i8 %36 to i32
%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 %37, %42
br i1 %43, label %44, label %50
44: ; preds = %32
%45 = load i32, i32* %2
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds [10 x i32], [10 x i32]* %4, i64 0, i64 %46
%48 = load i32, i32* %47
%49 = add nsw i32 %48, 1
store i32 %49, i32* %47
br label %50
50: ; preds = %44, %32
br label %51
51: ; preds = %50
%52 = load i32, i32* %3
%53 = add nsw i32 %52, 1
store i32 %53, i32* %3
br label %27
54: ; preds = %27
br label %55
55: ; preds = %54
%56 = load i32, i32* %2
%57 = add nsw i32 %56, 1
store i32 %57, i32* %2
br label %21
58: ; preds = %21
store i32 0, i32* %2
br label %59
59: ; preds = %74, %58
%60 = load i32, i32* %2
%61 = getelementptr inbounds [10 x i8], [10 x i8]* %5, i64 0, i64 0
%62 = call i32 @strlen(i8* %61)
%63 = icmp slt i32 %60, %62
br i1 %63, label %64, label %77
64: ; preds = %59
%65 = load i32, i32* %2
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds [10 x i8], [10 x i8]* %5, i64 0, i64 %66
%68 = load i8, i8* %67
%69 = load i32, i32* %2
%70 = sext i32 %69 to i64
%71 = getelementptr inbounds [10 x i32], [10 x i32]* %4, i64 0, i64 %70
%72 = load i32, i32* %71
%73 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8 signext %68, i32 %72)
br label %74
74: ; preds = %64
%75 = load i32, i32* %2
%76 = add nsw i32 %75, 1
store i32 %76, i32* %2
br label %59
77: ; preds = %59
br label %7
78: ; preds = %7
store i32 0, i32* %1
br label %79
79: ; preds = %78, %15
%80 = load i32, i32* %1
ret i32 %80
}

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