#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 */
unsigned int strlen(unsigned char *);
int find_difference(unsigned char *sen_0, unsigned char *sen_1) {
  int i = 0;
  unsigned int sen0_len, sen1_len, act_len;
  sen0_len = strlen(sen_0);
  sen1_len = strlen(sen_1);
  act_len = (sen0_len < sen1_len) ? sen0_len : sen1_len;
  for (i = 0; i < act_len; i++)
    if (sen_0[i] != sen_1[i])
      break;
  i = (i == act_len) ? -1 : i;
  return i;
}


x86 assembly (clang, -O0):
<find_difference>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jae    1156 <find_difference+0x46>
mov    -0x18(%rbp),%eax
mov    %eax,-0x24(%rbp)
jmp    115c <find_difference+0x4c>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
mov    %eax,-0x20(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x20(%rbp),%eax
jae    11ad <find_difference+0x9d>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
mov    -0x10(%rbp),%rcx
movslq -0x14(%rbp),%rdx
movzbl (%rcx,%rdx,1),%ecx
cmp    %ecx,%eax
je     119a <find_difference+0x8a>
jmp    11ad <find_difference+0x9d>
jmp    119f <find_difference+0x8f>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1169 <find_difference+0x59>
mov    -0x14(%rbp),%eax
cmp    -0x20(%rbp),%eax
jne    11c6 <find_difference+0xb6>
mov    $0xffffffff,%eax
mov    %eax,-0x28(%rbp)
jmp    11cc <find_difference+0xbc>
mov    -0x14(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x28(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<find_difference>:
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>
cmp    %eax,%ebx
cmovb  %ebx,%eax
test   %eax,%eax
je     1158 <find_difference+0x48>
mov    %eax,%edx
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
movzbl 0x0(%rbp,%rcx,1),%ebx
cmp    (%r14,%rcx,1),%bl
jne    115a <find_difference+0x4a>
add    $0x1,%rcx
cmp    %rcx,%rdx
jne    1140 <find_difference+0x30>
mov    %eax,%ecx
jmp    115a <find_difference+0x4a>
xor    %ecx,%ecx
cmp    %eax,%ecx
mov    $0xffffffff,%eax
cmovne %ecx,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

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