#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 */
bool checkThatOnlyOneInsertOrRemove(char *str1, char *str2) {
  bool diffFlag = false;
  while (*str1 && *str2) {
    if (*(str1++) != *(str2++)) {
      if (diffFlag) {
        return false;
      }
      diffFlag = true;
      str1++;
    }
  }
  return true;
}


x86 assembly (clang, -O0):
<checkThatOnlyOneInsertOrRemove>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x1d(%rbp)
je     1138 <checkThatOnlyOneInsertOrRemove+0x38>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x1d(%rbp)
mov    -0x1d(%rbp),%al
test   $0x1,%al
jne    1148 <checkThatOnlyOneInsertOrRemove+0x48>
jmp    11a2 <checkThatOnlyOneInsertOrRemove+0xa2>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movsbl (%rax),%eax
mov    -0x18(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x18(%rbp)
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     119d <checkThatOnlyOneInsertOrRemove+0x9d>
cmpl   $0x0,-0x1c(%rbp)
je     118a <checkThatOnlyOneInsertOrRemove+0x8a>
movl   $0x0,-0x4(%rbp)
jmp    11a9 <checkThatOnlyOneInsertOrRemove+0xa9>
movl   $0x1,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1113 <checkThatOnlyOneInsertOrRemove+0x13>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<checkThatOnlyOneInsertOrRemove>:
mov    (%rdi),%dl
mov    $0x1,%eax
test   %dl,%dl
je     113b <checkThatOnlyOneInsertOrRemove+0x3b>
xor    %r8d,%r8d
jmp    111f <checkThatOnlyOneInsertOrRemove+0x1f>
add    $0x1,%rdi
add    $0x1,%rsi
movzbl (%rdi),%edx
test   %dl,%dl
je     113b <checkThatOnlyOneInsertOrRemove+0x3b>
movzbl (%rsi),%ecx
test   %cl,%cl
je     113b <checkThatOnlyOneInsertOrRemove+0x3b>
cmp    %cl,%dl
je     1110 <checkThatOnlyOneInsertOrRemove+0x10>
test   %r8d,%r8d
jne    113c <checkThatOnlyOneInsertOrRemove+0x3c>
add    $0x2,%rdi
mov    $0x1,%r8d
jmp    1114 <checkThatOnlyOneInsertOrRemove+0x14>
ret
xor    %eax,%eax
ret

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

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