#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 strlen(char *);
int exactMatch(char *w1, char *w2) {
  int i;
  int len = strlen(w1);
  if (len != strlen(w2))
    return 0;
  for (i = 0; i < len; ++i) {
    if (w1[i] != w2[i])
      return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<exactMatch>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x24(%rbp),%eax
cmp    %ecx,%eax
je     1154 <exactMatch+0x44>
movl   $0x0,-0x4(%rbp)
jmp    11ad <exactMatch+0x9d>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    11a6 <exactMatch+0x96>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
mov    -0x18(%rbp),%rcx
movslq -0x1c(%rbp),%rdx
movsbl (%rcx,%rdx,1),%ecx
cmp    %ecx,%eax
je     1193 <exactMatch+0x83>
movl   $0x0,-0x4(%rbp)
jmp    11ad <exactMatch+0x9d>
jmp    1198 <exactMatch+0x88>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    115b <exactMatch+0x4b>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<exactMatch>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbp
call   1030 <strlen@plt>
mov    %eax,%ebx
mov    %r14,%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    %ecx,%ebx
jne    1158 <exactMatch+0x48>
mov    $0x1,%eax
test   %ebx,%ebx
jle    1158 <exactMatch+0x48>
mov    %ebx,%ecx
xor    %edx,%edx
xchg   %ax,%ax
movzbl 0x0(%rbp,%rdx,1),%ebx
cmp    (%r14,%rdx,1),%bl
jne    1156 <exactMatch+0x46>
add    $0x1,%rdx
cmp    %rdx,%rcx
jne    1140 <exactMatch+0x30>
jmp    1158 <exactMatch+0x48>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @exactMatch(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
%8 = load i8*, i8** %4
%9 = call i32 @strlen(i8* %8)
store i32 %9, i32* %7
%10 = load i32, i32* %7
%11 = load i8*, i8** %5
%12 = call i32 @strlen(i8* %11)
%13 = icmp ne i32 %10, %12
br i1 %13, label %14, label %15
14: ; preds = %2
store i32 0, i32* %3
br label %40
15: ; preds = %2
store i32 0, i32* %6
br label %16
16: ; preds = %36, %15
%17 = load i32, i32* %6
%18 = load i32, i32* %7
%19 = icmp slt i32 %17, %18
br i1 %19, label %20, label %39
20: ; preds = %16
%21 = load i8*, i8** %4
%22 = load i32, i32* %6
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i8, i8* %21, i64 %23
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
%27 = load i8*, i8** %5
%28 = load i32, i32* %6
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i8, i8* %27, i64 %29
%31 = load i8, i8* %30
%32 = sext i8 %31 to i32
%33 = icmp ne i32 %26, %32
br i1 %33, label %34, label %35
34: ; preds = %20
store i32 0, i32* %3
br label %40
35: ; preds = %20
br label %36
36: ; preds = %35
%37 = load i32, i32* %6
%38 = add nsw i32 %37, 1
store i32 %38, i32* %6
br label %16
39: ; preds = %16
store i32 1, i32* %3
br label %40
40: ; preds = %39, %34, %14
%41 = load i32, i32* %3
ret i32 %41
}

LLVM IR (-O2):
define i32 @exactMatch(i8* %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %0)
%4 = tail call i32 @strlen(i8* %1)
%5 = icmp eq i32 %3, %4
br i1 %5, label %6, label %20
6: ; preds = %2
%7 = icmp sgt i32 %3, 0
br i1 %7, label %8, label %20
8: ; preds = %6
%9 = zext i32 %3 to i64
br label %12
10: ; preds = %12
%11 = icmp eq i64 %19, %9
br i1 %11, label %20, label %12
12: ; preds = %8, %10
%13 = phi i64 [ 0, %8 ], [ %19, %10 ]
%14 = getelementptr inbounds i8, i8* %0, i64 %13
%15 = load i8, i8* %14
%16 = getelementptr inbounds i8, i8* %1, i64 %13
%17 = load i8, i8* %16
%18 = icmp eq i8 %15, %17
%19 = add nuw nsw i64 %13, 1
br i1 %18, label %10, label %20
20: ; preds = %12, %10, %6, %2
%21 = phi i32 [ 0, %2 ], [ 1, %6 ], [ 0, %12 ], [ 1, %10 ]
ret i32 %21
}