#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__ isspace(char);
int strcmp(char *, char *);
int areEqual(char *s1, size_t l1, char *s2, size_t l2) {
  while (l1 && isspace(s1[l1 - 1]))
    --l1;
  while (l2 && isspace(s2[l2 - 1]))
    --l2;
  s1[l1] = s2[l2] = '\0';
  return strcmp(s1, s2);
}


x86 assembly (clang, -O0):
<areEqual>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x10(%rbp)
mov    %al,-0x21(%rbp)
je     1167 <areEqual+0x47>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    $0x1,%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <isspace@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%al
test   $0x1,%al
jne    1177 <areEqual+0x57>
jmp    1188 <areEqual+0x68>
mov    -0x10(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x10(%rbp)
jmp    1138 <areEqual+0x18>
jmp    118d <areEqual+0x6d>
xor    %eax,%eax
cmpq   $0x0,-0x20(%rbp)
mov    %al,-0x22(%rbp)
je     11bc <areEqual+0x9c>
mov    -0x18(%rbp),%rax
mov    -0x20(%rbp),%rcx
sub    $0x1,%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <isspace@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x22(%rbp)
mov    -0x22(%rbp),%al
test   $0x1,%al
jne    11cc <areEqual+0xac>
jmp    11dd <areEqual+0xbd>
mov    -0x20(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x20(%rbp)
jmp    118d <areEqual+0x6d>
mov    -0x18(%rbp),%rax
mov    -0x20(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <strcmp@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<areEqual>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %rcx,%r12
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %rdi,%r15
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rbx,%r13
sub    $0x1,%rbx
jb     1170 <areEqual+0x50>
movsbl -0x1(%r15,%r13,1),%edi
call   1030 <isspace@plt>
test   %rax,%rax
jne    1140 <areEqual+0x20>
jmp    1170 <areEqual+0x50>
nopl   0x0(%rax,%rax,1)
movsbl -0x1(%r14,%rbx,1),%edi
call   1030 <isspace@plt>
test   %rax,%rax
je     1179 <areEqual+0x59>
mov    %r12,%rbx
sub    $0x1,%r12
jae    1160 <areEqual+0x40>
movb   $0x0,(%r14,%rbx,1)
movb   $0x0,(%r15,%r13,1)
mov    %r15,%rdi
mov    %r14,%rsi
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
jmp    1040 <strcmp@plt>

LLVM IR (-O0):
define i32 @areEqual(i8* %0, i64 %1, i8* %2, i64 %3) {
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i8*
%8 = alloca i64
store i8* %0, i8** %5
store i64 %1, i64* %6
store i8* %2, i8** %7
store i64 %3, i64* %8
br label %9
9: ; preds = %22, %4
%10 = load i64, i64* %6
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %20
12: ; preds = %9
%13 = load i8*, i8** %5
%14 = load i64, i64* %6
%15 = sub i64 %14, 1
%16 = getelementptr inbounds i8, i8* %13, i64 %15
%17 = load i8, i8* %16
%18 = call i64 @isspace(i8 signext %17)
%19 = icmp ne i64 %18, 0
br label %20
20: ; preds = %12, %9
%21 = phi i1 [ false, %9 ], [ %19, %12 ]
br i1 %21, label %22, label %25
22: ; preds = %20
%23 = load i64, i64* %6
%24 = add i64 %23, -1
store i64 %24, i64* %6
br label %9
25: ; preds = %20
br label %26
26: ; preds = %39, %25
%27 = load i64, i64* %8
%28 = icmp ne i64 %27, 0
br i1 %28, label %29, label %37
29: ; preds = %26
%30 = load i8*, i8** %7
%31 = load i64, i64* %8
%32 = sub i64 %31, 1
%33 = getelementptr inbounds i8, i8* %30, i64 %32
%34 = load i8, i8* %33
%35 = call i64 @isspace(i8 signext %34)
%36 = icmp ne i64 %35, 0
br label %37
37: ; preds = %29, %26
%38 = phi i1 [ false, %26 ], [ %36, %29 ]
br i1 %38, label %39, label %42
39: ; preds = %37
%40 = load i64, i64* %8
%41 = add i64 %40, -1
store i64 %41, i64* %8
br label %26
42: ; preds = %37
%43 = load i8*, i8** %7
%44 = load i64, i64* %8
%45 = getelementptr inbounds i8, i8* %43, i64 %44
store i8 0, i8* %45
%46 = load i8*, i8** %5
%47 = load i64, i64* %6
%48 = getelementptr inbounds i8, i8* %46, i64 %47
store i8 0, i8* %48
%49 = load i8*, i8** %5
%50 = load i8*, i8** %7
%51 = call i32 @strcmp(i8* %49, i8* %50)
ret i32 %51
}

LLVM IR (-O2):
define i32 @areEqual(i8* nocapture %0, i64 %1, i8* nocapture %2, i64 %3) {
br label %5
5: ; preds = %8, %4
%6 = phi i64 [ %1, %4 ], [ %9, %8 ]
%7 = icmp eq i64 %6, 0
br i1 %7, label %14, label %8
8: ; preds = %5
%9 = add i64 %6, -1
%10 = getelementptr inbounds i8, i8* %0, i64 %9
%11 = load i8, i8* %10
%12 = tail call i64 @isspace(i8 signext %11)
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %5
14: ; preds = %5, %8
br label %15
15: ; preds = %14, %18
%16 = phi i64 [ %19, %18 ], [ %3, %14 ]
%17 = icmp eq i64 %16, 0
br i1 %17, label %24, label %18
18: ; preds = %15
%19 = add i64 %16, -1
%20 = getelementptr inbounds i8, i8* %2, i64 %19
%21 = load i8, i8* %20
%22 = tail call i64 @isspace(i8 signext %21)
%23 = icmp eq i64 %22, 0
br i1 %23, label %24, label %15
24: ; preds = %15, %18
%25 = getelementptr inbounds i8, i8* %2, i64 %16
store i8 0, i8* %25
%26 = getelementptr inbounds i8, i8* %0, i64 %6
store i8 0, i8* %26
%27 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(1) %2)
ret i32 %27
}