#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 Strings_Length(char *, unsigned int);
int /*<<< orphan*/ memcpy(char *, char *, unsigned int);
void Strings_FindDiff(char *stringVal1_, unsigned int _stringVal1_high,
                      char *stringVal2_, unsigned int _stringVal2_high,
                      unsigned int *differenceFound,
                      unsigned int *posOfDifference) {
  unsigned int i;
  unsigned int s1h;
  unsigned int s2h;
  char stringVal1[_stringVal1_high + 1];
  char stringVal2[_stringVal2_high + 1];
  memcpy(stringVal1, stringVal1_, _stringVal1_high + 1);
  memcpy(stringVal2, stringVal2_, _stringVal2_high + 1);
  s1h = Strings_Length((char *)stringVal1, _stringVal1_high);
  s2h = Strings_Length((char *)stringVal2, _stringVal2_high);
  i = 0;
  while ((i < s1h) && (i < s2h)) {
    if (stringVal1[i] == stringVal2[i]) {
      i += 1;
    } else {
      (*differenceFound) = (1 == 1);
      (*posOfDifference) = i;
      return;
    }
  }
  if (s1h == s2h) {
    (*differenceFound) = (1 == 0);
  } else {
    (*differenceFound) = (1 == 1);
    (*posOfDifference) = i;
  }
}


x86 assembly (clang, -O0):
<Strings_FindDiff>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %rsp,%rcx
mov    %rcx,-0x48(%rbp)
mov    %rax,%rcx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdi
sub    %rcx,%rdi
mov    %rdi,-0x70(%rbp)
mov    %rdi,%rsp
mov    %rax,-0x50(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x68(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x58(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
add    $0x1,%edx
call   1030 <memcpy@plt>
mov    -0x68(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
add    $0x1,%edx
call   1030 <memcpy@plt>
mov    -0x70(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1040 <Strings_Length@plt>
mov    -0x68(%rbp),%rdi
mov    %eax,-0x38(%rbp)
mov    -0x1c(%rbp),%esi
call   1040 <Strings_Length@plt>
mov    %eax,-0x3c(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%ecx
xor    %eax,%eax
cmp    -0x38(%rbp),%ecx
mov    %al,-0x71(%rbp)
jae    11f0 <Strings_FindDiff+0xd0>
mov    -0x34(%rbp),%eax
cmp    -0x3c(%rbp),%eax
setb   %al
mov    %al,-0x71(%rbp)
mov    -0x71(%rbp),%al
test   $0x1,%al
jne    1200 <Strings_FindDiff+0xe0>
jmp    1250 <Strings_FindDiff+0x130>
mov    -0x68(%rbp),%rcx
mov    -0x70(%rbp),%rax
mov    -0x34(%rbp),%edx
movsbl (%rax,%rdx,1),%eax
mov    -0x34(%rbp),%edx
movsbl (%rcx,%rdx,1),%ecx
cmp    %ecx,%eax
jne    122c <Strings_FindDiff+0x10c>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    124b <Strings_FindDiff+0x12b>
mov    -0x28(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x34(%rbp),%ecx
mov    -0x30(%rbp),%rax
mov    %ecx,(%rax)
movl   $0x1,-0x5c(%rbp)
jmp    1285 <Strings_FindDiff+0x165>
jmp    11d3 <Strings_FindDiff+0xb3>
mov    -0x38(%rbp),%eax
cmp    -0x3c(%rbp),%eax
jne    126b <Strings_FindDiff+0x14b>
mov    -0x28(%rbp),%rax
movl   $0x0,(%rax)
jmp    127e <Strings_FindDiff+0x15e>
mov    -0x28(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x34(%rbp),%ecx
mov    -0x30(%rbp),%rax
mov    %ecx,(%rax)
movl   $0x0,-0x5c(%rbp)
mov    -0x48(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Strings_FindDiff>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r9,-0x38(%rbp)
mov    %r8,-0x30(%rbp)
mov    %ecx,%ebx
mov    %rdx,-0x40(%rbp)
mov    %esi,%r13d
mov    %rdi,%rsi
lea    0x1(%r13),%edx
mov    %rsp,%r12
lea    0xf(%rdx),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r12
mov    %r12,%rsp
lea    0x1(%rbx),%r15d
mov    %rsp,%r14
lea    0xf(%r15),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r14
mov    %r14,%rsp
mov    %r12,%rdi
call   1030 <memcpy@plt>
mov    %r14,%rdi
mov    -0x40(%rbp),%rsi
mov    %r15d,%edx
call   1030 <memcpy@plt>
mov    %r12,%rdi
mov    %r13d,%esi
call   1040 <Strings_Length@plt>
mov    %eax,%r13d
mov    %r14,%rdi
mov    %ebx,%esi
call   1040 <Strings_Length@plt>
xor    %ecx,%ecx
test   %r13d,%r13d
je     11c9 <Strings_FindDiff+0xa9>
test   %eax,%eax
je     11c9 <Strings_FindDiff+0xa9>
mov    %eax,%edx
mov    %r13d,%esi
xor    %ecx,%ecx
movzbl (%r12,%rcx,1),%ebx
cmp    (%r14,%rcx,1),%bl
jne    11da <Strings_FindDiff+0xba>
add    $0x1,%rcx
cmp    %rsi,%rcx
jae    11c9 <Strings_FindDiff+0xa9>
cmp    %rdx,%rcx
jb     11b0 <Strings_FindDiff+0x90>
cmp    %eax,%r13d
jne    11da <Strings_FindDiff+0xba>
mov    -0x30(%rbp),%rax
movl   $0x0,(%rax)
jmp    11ea <Strings_FindDiff+0xca>
mov    -0x30(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x38(%rbp),%rax
mov    %ecx,(%rax)
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @Strings_FindDiff(i8* %0, i32 %1, i8* %2, i32 %3, i32* %4, i32* %5) {
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i32
%11 = alloca i32*
%12 = alloca i32*
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i8*
%17 = alloca i64
%18 = alloca i64
%19 = alloca i32
store i8* %0, i8** %7
store i32 %1, i32* %8
store i8* %2, i8** %9
store i32 %3, i32* %10
store i32* %4, i32** %11
store i32* %5, i32** %12
%20 = load i32, i32* %8
%21 = add i32 %20, 1
%22 = zext i32 %21 to i64
%23 = call i8* @llvm.stacksave()
store i8* %23, i8** %16
%24 = alloca i8, i64 %22
store i64 %22, i64* %17
%25 = load i32, i32* %10
%26 = add i32 %25, 1
%27 = zext i32 %26 to i64
%28 = alloca i8, i64 %27
store i64 %27, i64* %18
%29 = load i8*, i8** %7
%30 = load i32, i32* %8
%31 = add i32 %30, 1
%32 = call i32 @memcpy(i8* %24, i8* %29, i32 %31)
%33 = load i8*, i8** %9
%34 = load i32, i32* %10
%35 = add i32 %34, 1
%36 = call i32 @memcpy(i8* %28, i8* %33, i32 %35)
%37 = load i32, i32* %8
%38 = call i32 @Strings_Length(i8* %24, i32 %37)
store i32 %38, i32* %14
%39 = load i32, i32* %10
%40 = call i32 @Strings_Length(i8* %28, i32 %39)
store i32 %40, i32* %15
store i32 0, i32* %13
br label %41
41: ; preds = %70, %6
%42 = load i32, i32* %13
%43 = load i32, i32* %14
%44 = icmp ult i32 %42, %43
br i1 %44, label %45, label %49
45: ; preds = %41
%46 = load i32, i32* %13
%47 = load i32, i32* %15
%48 = icmp ult i32 %46, %47
br label %49
49: ; preds = %45, %41
%50 = phi i1 [ false, %41 ], [ %48, %45 ]
br i1 %50, label %51, label %71
51: ; preds = %49
%52 = load i32, i32* %13
%53 = zext i32 %52 to i64
%54 = getelementptr inbounds i8, i8* %24, i64 %53
%55 = load i8, i8* %54
%56 = sext i8 %55 to i32
%57 = load i32, i32* %13
%58 = zext i32 %57 to i64
%59 = getelementptr inbounds i8, i8* %28, i64 %58
%60 = load i8, i8* %59
%61 = sext i8 %60 to i32
%62 = icmp eq i32 %56, %61
br i1 %62, label %63, label %66
63: ; preds = %51
%64 = load i32, i32* %13
%65 = add i32 %64, 1
store i32 %65, i32* %13
br label %70
66: ; preds = %51
%67 = load i32*, i32** %11
store i32 1, i32* %67
%68 = load i32, i32* %13
%69 = load i32*, i32** %12
store i32 %68, i32* %69
store i32 1, i32* %19
br label %82
70: ; preds = %63
br label %41
71: ; preds = %49
%72 = load i32, i32* %14
%73 = load i32, i32* %15
%74 = icmp eq i32 %72, %73
br i1 %74, label %75, label %77
75: ; preds = %71
%76 = load i32*, i32** %11
store i32 0, i32* %76
br label %81
77: ; preds = %71
%78 = load i32*, i32** %11
store i32 1, i32* %78
%79 = load i32, i32* %13
%80 = load i32*, i32** %12
store i32 %79, i32* %80
br label %81
81: ; preds = %77, %75
store i32 0, i32* %19
br label %82
82: ; preds = %81, %66
%83 = load i8*, i8** %16
%84 = load i32, i32* %19
switch i32 %84, label %86 [
i32 0, label %85
i32 1, label %85
]
85: ; preds = %82, %82
ret void
86: ; preds = %82
unreachable
}

LLVM IR (-O2):
define void @Strings_FindDiff(i8* %0, i32 %1, i8* %2, i32 %3, i32* nocapture writeonly %4, i32* nocapture writeonly %5) {
%7 = add i32 %1, 1
%8 = zext i32 %7 to i64
%9 = alloca i8, i64 %8
%10 = add i32 %3, 1
%11 = zext i32 %10 to i64
%12 = alloca i8, i64 %11
%13 = call i32 @memcpy(i8* %9, i8* %0, i32 %7)
%14 = call i32 @memcpy(i8* %12, i8* %2, i32 %10)
%15 = call i32 @Strings_Length(i8* %9, i32 %1)
%16 = call i32 @Strings_Length(i8* %12, i32 %3)
%17 = icmp ne i32 %15, 0
%18 = icmp ne i32 %16, 0
%19 = select i1 %17, i1 %18, i1 false
br i1 %19, label %20, label %39
20: ; preds = %6
%21 = zext i32 %16 to i64
%22 = zext i32 %15 to i64
br label %23
23: ; preds = %20, %30
%24 = phi i64 [ 0, %20 ], [ %31, %30 ]
%25 = getelementptr inbounds i8, i8* %9, i64 %24
%26 = load i8, i8* %25
%27 = getelementptr inbounds i8, i8* %12, i64 %24
%28 = load i8, i8* %27
%29 = icmp eq i8 %26, %28
br i1 %29, label %30, label %35
30: ; preds = %23
%31 = add nuw nsw i64 %24, 1
%32 = icmp ult i64 %31, %22
%33 = icmp ult i64 %31, %21
%34 = select i1 %32, i1 %33, i1 false
br i1 %34, label %23, label %37
35: ; preds = %23
%36 = trunc i64 %24 to i32
store i32 1, i32* %4
store i32 %36, i32* %5
br label %44
37: ; preds = %30
%38 = trunc i64 %31 to i32
br label %39
39: ; preds = %37, %6
%40 = phi i32 [ 0, %6 ], [ %38, %37 ]
%41 = icmp eq i32 %15, %16
br i1 %41, label %42, label %43
42: ; preds = %39
store i32 0, i32* %4
br label %44
43: ; preds = %39
store i32 1, i32* %4
store i32 %40, i32* %5
br label %44
44: ; preds = %42, %43, %35
ret void
}