#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 */
char *endOfData(char const *);
scalar_t__ memcmp(char const *, char const *, int);
char *strchr(char const *, char);
int sameData(const char *l1, const char *l2) {
  char *end1, *end2;
  int length;
  l1 = strchr(l1, ';') + 1;
  l2 = strchr(l2, ';') + 1;
  end1 = endOfData(l1);
  end2 = endOfData(l2);
  length = end1 - l1;
  return length == (end2 - l2) && 0 == memcmp(l1, l2, length);
}


x86 assembly (clang, -O0):
<sameData>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x3b,%esi
call   1030 <strchr@plt>
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x3b,%esi
call   1030 <strchr@plt>
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <endOfData@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <endOfData@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,-0x24(%rbp)
movslq -0x24(%rbp),%rcx
mov    -0x20(%rbp),%rdx
mov    -0x10(%rbp),%rax
sub    %rax,%rdx
xor    %eax,%eax
cmp    %rdx,%rcx
mov    %al,-0x25(%rbp)
jne    11cf <sameData+0x9f>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x24(%rbp),%edx
call   1040 <memcmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
sete   %al
mov    %al,-0x25(%rbp)
mov    -0x25(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sameData>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    $0x3b,%esi
call   1030 <strchr@plt>
mov    %rax,%r14
add    $0x1,%r14
mov    %rbx,%rdi
mov    $0x3b,%esi
call   1030 <strchr@plt>
mov    %rax,%rbx
add    $0x1,%rbx
mov    %r14,%rdi
call   1050 <endOfData@plt>
mov    %rax,%r15
mov    %rbx,%rdi
call   1050 <endOfData@plt>
mov    %rax,%rcx
sub    %r14,%r15
movslq %r15d,%rdx
sub    %rbx,%rcx
xor    %eax,%eax
cmp    %rcx,%rdx
jne    119c <sameData+0x6c>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %r15d,%edx
call   1040 <memcmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
sete   %al
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @sameData(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%8 = load i8*, i8** %3
%9 = call i8* @strchr(i8* %8, i8 signext 59)
%10 = getelementptr inbounds i8, i8* %9, i64 1
store i8* %10, i8** %3
%11 = load i8*, i8** %4
%12 = call i8* @strchr(i8* %11, i8 signext 59)
%13 = getelementptr inbounds i8, i8* %12, i64 1
store i8* %13, i8** %4
%14 = load i8*, i8** %3
%15 = call i8* @endOfData(i8* %14)
store i8* %15, i8** %5
%16 = load i8*, i8** %4
%17 = call i8* @endOfData(i8* %16)
store i8* %17, i8** %6
%18 = load i8*, i8** %5
%19 = load i8*, i8** %3
%20 = ptrtoint i8* %18 to i64
%21 = ptrtoint i8* %19 to i64
%22 = sub i64 %20, %21
%23 = trunc i64 %22 to i32
store i32 %23, i32* %7
%24 = load i32, i32* %7
%25 = sext i32 %24 to i64
%26 = load i8*, i8** %6
%27 = load i8*, i8** %4
%28 = ptrtoint i8* %26 to i64
%29 = ptrtoint i8* %27 to i64
%30 = sub i64 %28, %29
%31 = icmp eq i64 %25, %30
br i1 %31, label %32, label %38
32: ; preds = %2
%33 = load i8*, i8** %3
%34 = load i8*, i8** %4
%35 = load i32, i32* %7
%36 = call i64 @memcmp(i8* %33, i8* %34, i32 %35)
%37 = icmp eq i64 0, %36
br label %38
38: ; preds = %32, %2
%39 = phi i1 [ false, %2 ], [ %37, %32 ]
%40 = zext i1 %39 to i32
ret i32 %40
}

LLVM IR (-O2):
define i32 @sameData(i8* %0, i8* %1) {
%3 = tail call i8* @strchr(i8* dereferenceable(1) %0, i8 signext 59)
%4 = getelementptr inbounds i8, i8* %3, i64 1
%5 = tail call i8* @strchr(i8* dereferenceable(1) %1, i8 signext 59)
%6 = getelementptr inbounds i8, i8* %5, i64 1
%7 = tail call i8* @endOfData(i8* %4)
%8 = tail call i8* @endOfData(i8* %6)
%9 = ptrtoint i8* %7 to i64
%10 = ptrtoint i8* %4 to i64
%11 = sub i64 %9, %10
%12 = shl i64 %11, 32
%13 = ashr exact i64 %12, 32
%14 = ptrtoint i8* %8 to i64
%15 = ptrtoint i8* %6 to i64
%16 = sub i64 %14, %15
%17 = icmp eq i64 %13, %16
br i1 %17, label %18, label %23
18: ; preds = %2
%19 = trunc i64 %11 to i32
%20 = tail call i64 @memcmp(i8* %4, i8* %6, i32 %19)
%21 = icmp eq i64 %20, 0
%22 = zext i1 %21 to i32
br label %23
23: ; preds = %18, %2
%24 = phi i32 [ 0, %2 ], [ %22, %18 ]
ret i32 %24
}