#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 *);
bool checkWin(char *correctWord, char *playingWord) {
  char temp[50];
  bool result = 1;
  for (int i = 0; i < strlen(correctWord); i++) {
    if (correctWord[i] != playingWord[(i * 2) + 1]) {
      result = 0;
    }
  }
  return (result);
}


x86 assembly (clang, -O0):
<checkWin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x54(%rbp)
movl   $0x0,-0x58(%rbp)
mov    -0x58(%rbp),%eax
mov    %eax,-0x5c(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x5c(%rbp),%eax
cmp    %ecx,%eax
jge    118c <checkWin+0x7c>
mov    -0x8(%rbp),%rax
movslq -0x58(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
mov    -0x10(%rbp),%rcx
mov    -0x58(%rbp),%edx
shl    $0x1,%edx
add    $0x1,%edx
movslq %edx,%rdx
movsbl (%rcx,%rdx,1),%ecx
cmp    %ecx,%eax
je     1179 <checkWin+0x69>
movl   $0x0,-0x54(%rbp)
jmp    117e <checkWin+0x6e>
mov    -0x58(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x58(%rbp)
jmp    112e <checkWin+0x1e>
mov    -0x54(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<checkWin>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r12
call   1030 <strlen@plt>
mov    $0x1,%ebp
test   %eax,%eax
jle    1161 <checkWin+0x51>
xor    %r15d,%r15d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movzbl (%r12,%rbx,1),%eax
cmp    0x1(%r14,%rbx,2),%al
cmovne %r15d,%ebp
add    $0x1,%rbx
mov    %r12,%rdi
call   1030 <strlen@plt>
cltq
cmp    %rax,%rbx
jl     1140 <checkWin+0x30>
mov    %ebp,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

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