#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*/ assert(int /*<<< orphan*/);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, unsigned int);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ trim_r(char *);
int main() {
  char first[1001], second[1001];
  char *fp, *sp;
  unsigned errors;
  assert(fgets(first, 1001, stdin));
  assert(fgets(second, 1001, stdin));
  fp = first;
  sp = second;
  trim_r(fp);
  trim_r(sp);
  for (errors = 0; *fp != '\0' && *sp != '\0'; fp++, sp++) {
    if (*fp != *sp)
      errors++;
  }
  printf("%d\n", errors);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x800,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x3f0(%rbp),%rdi
mov    0x2e88(%rip),%rax
mov    (%rax),%edx
mov    $0x3e9,%esi
call   1050 <fgets@plt>
mov    %eax,%edi
call   1060 <assert@plt>
lea    -0x7e0(%rbp),%rdi
mov    0x2e67(%rip),%rax
mov    (%rax),%edx
mov    $0x3e9,%esi
call   1050 <fgets@plt>
mov    %eax,%edi
call   1060 <assert@plt>
lea    -0x3f0(%rbp),%rax
mov    %rax,-0x7e8(%rbp)
lea    -0x7e0(%rbp),%rax
mov    %rax,-0x7f0(%rbp)
mov    -0x7e8(%rbp),%rdi
call   1030 <trim_r@plt>
mov    -0x7f0(%rbp),%rdi
call   1030 <trim_r@plt>
movl   $0x0,-0x7f4(%rbp)
mov    -0x7e8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x7f5(%rbp)
je     1203 <main+0xc3>
mov    -0x7f0(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x7f5(%rbp)
mov    -0x7f5(%rbp),%al
test   $0x1,%al
jne    1216 <main+0xd6>
jmp    126f <main+0x12f>
mov    -0x7e8(%rbp),%rax
movsbl (%rax),%eax
mov    -0x7f0(%rbp),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     1241 <main+0x101>
mov    -0x7f4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x7f4(%rbp)
jmp    1246 <main+0x106>
mov    -0x7e8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x7e8(%rbp)
mov    -0x7f0(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x7f0(%rbp)
jmp    11d2 <main+0x92>
mov    -0x7f4(%rbp),%esi
lea    0xd84(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x800,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x7e8,%rsp
mov    0x2e97(%rip),%rbx
mov    (%rbx),%edx
mov    %rsp,%r14
mov    %r14,%rdi
mov    $0x3e9,%esi
call   1050 <fgets@plt>
mov    %eax,%edi
call   1060 <assert@plt>
mov    (%rbx),%edx
lea    0x3f0(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x3e9,%esi
call   1050 <fgets@plt>
mov    %eax,%edi
call   1060 <assert@plt>
mov    %r14,%rdi
call   1030 <trim_r@plt>
mov    %rbx,%rdi
call   1030 <trim_r@plt>
mov    (%rsp),%cl
test   %cl,%cl
je     11d5 <main+0x95>
xor    %eax,%eax
xor    %esi,%esi
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movzbl 0x3f0(%rsp,%rax,1),%edx
test   %dl,%dl
je     11d7 <main+0x97>
xor    %edi,%edi
cmp    %dl,%cl
setne  %dil
add    %edi,%esi
movzbl 0x1(%rsp,%rax,1),%ecx
add    $0x1,%rax
test   %cl,%cl
jne    11b0 <main+0x70>
jmp    11d7 <main+0x97>
xor    %esi,%esi
lea    0xe22(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x7e8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@stdin = global i32 0
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [1001 x i8]
%3 = alloca [1001 x i8]
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
store i32 0, i32* %1
%7 = getelementptr inbounds [1001 x i8], [1001 x i8]* %2, i64 0, i64 0
%8 = load i32, i32* @stdin
%9 = call i32 @fgets(i8* %7, i32 1001, i32 %8)
%10 = call i32 @assert(i32 %9)
%11 = getelementptr inbounds [1001 x i8], [1001 x i8]* %3, i64 0, i64 0
%12 = load i32, i32* @stdin
%13 = call i32 @fgets(i8* %11, i32 1001, i32 %12)
%14 = call i32 @assert(i32 %13)
%15 = getelementptr inbounds [1001 x i8], [1001 x i8]* %2, i64 0, i64 0
store i8* %15, i8** %4
%16 = getelementptr inbounds [1001 x i8], [1001 x i8]* %3, i64 0, i64 0
store i8* %16, i8** %5
%17 = load i8*, i8** %4
%18 = call i32 @trim_r(i8* %17)
%19 = load i8*, i8** %5
%20 = call i32 @trim_r(i8* %19)
store i32 0, i32* %6
br label %21
21: ; preds = %45, %0
%22 = load i8*, i8** %4
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = icmp ne i32 %24, 0
br i1 %25, label %26, label %31
26: ; preds = %21
%27 = load i8*, i8** %5
%28 = load i8, i8* %27
%29 = sext i8 %28 to i32
%30 = icmp ne i32 %29, 0
br label %31
31: ; preds = %26, %21
%32 = phi i1 [ false, %21 ], [ %30, %26 ]
br i1 %32, label %33, label %50
33: ; preds = %31
%34 = load i8*, i8** %4
%35 = load i8, i8* %34
%36 = sext i8 %35 to i32
%37 = load i8*, i8** %5
%38 = load i8, i8* %37
%39 = sext i8 %38 to i32
%40 = icmp ne i32 %36, %39
br i1 %40, label %41, label %44
41: ; preds = %33
%42 = load i32, i32* %6
%43 = add i32 %42, 1
store i32 %43, i32* %6
br label %44
44: ; preds = %41, %33
br label %45
45: ; preds = %44
%46 = load i8*, i8** %4
%47 = getelementptr inbounds i8, i8* %46, i32 1
store i8* %47, i8** %4
%48 = load i8*, i8** %5
%49 = getelementptr inbounds i8, i8* %48, i32 1
store i8* %49, i8** %5
br label %21
50: ; preds = %31
%51 = load i32, i32* %6
%52 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %51)
ret i32 0
}

LLVM IR (-O2):
@stdin = global i32 0
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca [1001 x i8]
%2 = alloca [1001 x i8]
%3 = getelementptr inbounds [1001 x i8], [1001 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [1001 x i8], [1001 x i8]* %2, i64 0, i64 0
%5 = load i32, i32* @stdin
%6 = call i32 @fgets(i8* %3, i32 1001, i32 %5)
%7 = call i32 @assert(i32 %6)
%8 = load i32, i32* @stdin
%9 = call i32 @fgets(i8* %4, i32 1001, i32 %8)
%10 = call i32 @assert(i32 %9)
%11 = call i32 @trim_r(i8* %3)
%12 = call i32 @trim_r(i8* %4)
%13 = load i8, i8* %3
%14 = icmp eq i8 %13, 0
br i1 %14, label %30, label %15
15: ; preds = %0, %22
%16 = phi i8 [ %28, %22 ], [ %13, %0 ]
%17 = phi i32 [ %25, %22 ], [ 0, %0 ]
%18 = phi i8* [ %27, %22 ], [ %4, %0 ]
%19 = phi i8* [ %26, %22 ], [ %3, %0 ]
%20 = load i8, i8* %18
%21 = icmp eq i8 %20, 0
br i1 %21, label %30, label %22
22: ; preds = %15
%23 = icmp ne i8 %16, %20
%24 = zext i1 %23 to i32
%25 = add i32 %17, %24
%26 = getelementptr inbounds i8, i8* %19, i64 1
%27 = getelementptr inbounds i8, i8* %18, i64 1
%28 = load i8, i8* %26
%29 = icmp eq i8 %28, 0
br i1 %29, label %30, label %15
30: ; preds = %15, %22, %0
%31 = phi i32 [ 0, %0 ], [ %25, %22 ], [ %17, %15 ]
%32 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %31)
ret i32 0
}