#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 count(char, char *);
int /*<<< orphan*/ freopen(char *, char *, int /*<<< orphan*/);
int /*<<< orphan*/ gets(char *);
int /*<<< orphan*/ printf(char *, char, int);
int /*<<< orphan*/ stdin;
int strlen(char *);
int main(int argc, char *argv[]) {
  char str1[6], str2[81];
  int i, len;
  freopen("input.txt", "r", stdin);
  do {
    gets(str1);
    if (str1[0] == '#')
      break;
    gets(str2);
    for (i = 0, len = strlen(str1); i < len; i++) {
      printf("%c %d\n", str1[i], count(str1[i], str2));
    }
  } while (1);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e78(%rip),%rax
mov    (%rax),%edx
lea    0xe87(%rip),%rdi
lea    0xe8a(%rip),%rsi
call   1060 <freopen@plt>
lea    -0x16(%rbp),%rdi
call   1070 <gets@plt>
movsbl -0x16(%rbp),%eax
cmp    $0x23,%eax
jne    11a0 <main+0x50>
jmp    121d <main+0xcd>
lea    -0x70(%rbp),%rdi
call   1070 <gets@plt>
movl   $0x0,-0x74(%rbp)
lea    -0x16(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x78(%rbp)
mov    -0x74(%rbp),%eax
cmp    -0x78(%rbp),%eax
jge    1209 <main+0xb9>
movslq -0x74(%rbp),%rax
mov    -0x16(%rbp,%rax,1),%al
mov    %al,-0x79(%rbp)
movslq -0x74(%rbp),%rax
mov    -0x16(%rbp,%rax,1),%al
lea    -0x70(%rbp),%rsi
movsbl %al,%edi
call   1030 <count@plt>
mov    %eax,%edx
mov    -0x79(%rbp),%al
lea    0xe19(%rip),%rdi
movsbl %al,%esi
call   1050 <printf@plt>
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    11bc <main+0x6c>
jmp    120e <main+0xbe>
mov    $0x1,%al
test   $0x1,%al
jne    1185 <main+0x35>
jmp    121d <main+0xcd>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x68,%rsp
mov    0x2e83(%rip),%rax
mov    (%rax),%edx
lea    0xe92(%rip),%rdi
lea    0xe95(%rip),%rsi
call   1060 <freopen@plt>
lea    0xa(%rsp),%rdi
call   1070 <gets@plt>
cmpb   $0x23,0xa(%rsp)
jne    119c <main+0x4c>
xor    %eax,%eax
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0x10(%rsp),%r12
lea    0xa(%rsp),%r14
lea    0xe5f(%rip),%r15
jmp    11bf <main+0x6f>
nop
mov    %r14,%rdi
call   1070 <gets@plt>
cmpb   $0x23,0xa(%rsp)
je     118b <main+0x3b>
mov    %r12,%rdi
call   1070 <gets@plt>
mov    %r14,%rdi
call   1040 <strlen@plt>
test   %eax,%eax
jle    11b0 <main+0x60>
mov    %eax,%r13d
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
movsbl 0xa(%rsp,%rbx,1),%ebp
mov    %ebp,%edi
mov    %r12,%rsi
call   1030 <count@plt>
mov    %r15,%rdi
mov    %ebp,%esi
mov    %eax,%edx
call   1050 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r13
jne    11e0 <main+0x90>
jmp    11b0 <main+0x60>

LLVM IR (-O0):
@.str = [10 x i8] c"input.txt\00"
@.str.1 = [2 x i8] c"r\00"
@stdin = global i32 0
@.str.2 = [7 x i8] c"%c %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [6 x i8]
%7 = alloca [81 x i8]
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = load i32, i32* @stdin
%11 = call i32 @freopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 %10)
br label %12
12: ; preds = %45, %2
%13 = getelementptr inbounds [6 x i8], [6 x i8]* %6, i64 0, i64 0
%14 = call i32 @gets(i8* %13)
%15 = getelementptr inbounds [6 x i8], [6 x i8]* %6, i64 0, i64 0
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = icmp eq i32 %17, 35
br i1 %18, label %19, label %20
19: ; preds = %12
br label %46
20: ; preds = %12
%21 = getelementptr inbounds [81 x i8], [81 x i8]* %7, i64 0, i64 0
%22 = call i32 @gets(i8* %21)
store i32 0, i32* %8
%23 = getelementptr inbounds [6 x i8], [6 x i8]* %6, i64 0, i64 0
%24 = call i32 @strlen(i8* %23)
store i32 %24, i32* %9
br label %25
25: ; preds = %41, %20
%26 = load i32, i32* %8
%27 = load i32, i32* %9
%28 = icmp slt i32 %26, %27
br i1 %28, label %29, label %44
29: ; preds = %25
%30 = load i32, i32* %8
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [6 x i8], [6 x i8]* %6, i64 0, i64 %31
%33 = load i8, i8* %32
%34 = load i32, i32* %8
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds [6 x i8], [6 x i8]* %6, i64 0, i64 %35
%37 = load i8, i8* %36
%38 = getelementptr inbounds [81 x i8], [81 x i8]* %7, i64 0, i64 0
%39 = call i32 @count(i8 signext %37, i8* %38)
%40 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8 signext %33, i32 %39)
br label %41
41: ; preds = %29
%42 = load i32, i32* %8
%43 = add nsw i32 %42, 1
store i32 %43, i32* %8
br label %25
44: ; preds = %25
br label %45
45: ; preds = %44
br i1 true, label %12, label %46
46: ; preds = %45, %19
ret i32 0
}

LLVM IR (-O2):
@.str = [10 x i8] c"input.txt\00"
@.str.1 = [2 x i8] c"r\00"
@stdin = global i32 0
@.str.2 = [7 x i8] c"%c %d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [6 x i8]
%4 = alloca [81 x i8]
%5 = getelementptr inbounds [6 x i8], [6 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [81 x i8], [81 x i8]* %4, i64 0, i64 0
%7 = load i32, i32* @stdin
%8 = tail call i32 @freopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 %7)
%9 = call i32 @gets(i8* %5)
%10 = load i8, i8* %5
%11 = icmp eq i8 %10, 35
br i1 %11, label %30, label %16
12: ; preds = %22, %16
%13 = call i32 @gets(i8* %5)
%14 = load i8, i8* %5
%15 = icmp eq i8 %14, 35
br i1 %15, label %30, label %16
16: ; preds = %2, %12
%17 = call i32 @gets(i8* %6)
%18 = call i32 @strlen(i8* %5)
%19 = icmp sgt i32 %18, 0
br i1 %19, label %20, label %12
20: ; preds = %16
%21 = zext i32 %18 to i64
br label %22
22: ; preds = %20, %22
%23 = phi i64 [ 0, %20 ], [ %28, %22 ]
%24 = getelementptr inbounds [6 x i8], [6 x i8]* %3, i64 0, i64 %23
%25 = load i8, i8* %24
%26 = call i32 @count(i8 signext %25, i8* %6)
%27 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8 signext %25, i32 %26)
%28 = add nuw nsw i64 %23, 1
%29 = icmp eq i64 %28, %21
br i1 %29, label %12, label %22
30: ; preds = %12, %2
ret i32 0
}