#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__ strcmp(char *, char *);
int strlen(char *);
int split_strcmp(int start1, int end1, char *input1, int start2, int end2,
                 char *input2) {
  int i, j;
  int len1 = strlen(input1);
  int len2 = strlen(input2);
  char buffer1[len1 + 1], buffer2[len2 + 1];
  j = 0;
  for (i = start1; i <= end1; i++) {
    buffer1[j] = input1[i];
    j++;
  }
  buffer1[j] = '\0';
  j = 0;
  for (i = start2; i <= end2; i++) {
    buffer2[j] = input2[i];
    j++;
  }
  buffer2[j] = '\0';
  if (strcmp(buffer1, buffer2) == 0)
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<split_strcmp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
mov    %r9,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x34(%rbp)
mov    -0x28(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x38(%rbp)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %rsp,%rcx
mov    %rcx,-0x40(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x68(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x48(%rbp)
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x60(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x50(%rbp)
movl   $0x0,-0x30(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     11e6 <split_strcmp+0xc6>
mov    -0x68(%rbp),%rax
mov    -0x18(%rbp),%rcx
movslq -0x2c(%rbp),%rdx
mov    (%rcx,%rdx,1),%dl
movslq -0x30(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    11ad <split_strcmp+0x8d>
mov    -0x68(%rbp),%rax
movslq -0x30(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
movl   $0x0,-0x30(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jg     1238 <split_strcmp+0x118>
mov    -0x60(%rbp),%rax
mov    -0x28(%rbp),%rcx
movslq -0x2c(%rbp),%rdx
mov    (%rcx,%rdx,1),%dl
movslq -0x30(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    11ff <split_strcmp+0xdf>
mov    -0x60(%rbp),%rsi
mov    -0x68(%rbp),%rdi
movslq -0x30(%rbp),%rax
movb   $0x0,(%rsi,%rax,1)
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    126a <split_strcmp+0x14a>
movl   $0x1,-0x4(%rbp)
movl   $0x1,-0x54(%rbp)
jmp    1278 <split_strcmp+0x158>
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x54(%rbp)
mov    -0x40(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<split_strcmp>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %r9,%r13
mov    %r8,-0x48(%rbp)
mov    %ecx,-0x2c(%rbp)
mov    %esi,%r12d
mov    %edi,%r15d
mov    %rdx,-0x38(%rbp)
mov    %rdx,%rdi
call   1030 <strlen@plt>
mov    %eax,%ebx
mov    %r13,-0x40(%rbp)
mov    %r13,%rdi
call   1030 <strlen@plt>
add    $0x1,%ebx
mov    %rsp,%r13
add    $0xf,%rbx
and    $0xfffffffffffffff0,%rbx
sub    %rbx,%r13
mov    %r13,%rsp
add    $0x1,%eax
mov    %rsp,%r14
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r14
mov    %r14,%rsp
sub    %r15d,%r12d
jge    119c <split_strcmp+0x6c>
xor    %eax,%eax
jmp    11b8 <split_strcmp+0x88>
movslq %r15d,%rax
mov    -0x38(%rbp),%rsi
add    %rax,%rsi
add    $0x1,%r12
mov    %r13,%rdi
mov    %r12,%rdx
call   1050 <memcpy@plt>
mov    %r12d,%eax
movb   $0x0,0x0(%r13,%rax,1)
mov    -0x2c(%rbp),%eax
mov    -0x48(%rbp),%rbx
sub    %eax,%ebx
jge    11cd <split_strcmp+0x9d>
xor    %eax,%eax
jmp    11e7 <split_strcmp+0xb7>
cltq
mov    -0x40(%rbp),%rsi
add    %rax,%rsi
add    $0x1,%rbx
mov    %r14,%rdi
mov    %rbx,%rdx
call   1050 <memcpy@plt>
mov    %ebx,%eax
movb   $0x0,(%r14,%rax,1)
mov    %r13,%rdi
mov    %r14,%rsi
call   1040 <strcmp@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
mov    %ecx,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @split_strcmp(i32 %0, i32 %1, i8* %2, i32 %3, i32 %4, i8* %5) {
%7 = tail call i32 @strlen(i8* %2)
%8 = tail call i32 @strlen(i8* %5)
%9 = add nsw i32 %7, 1
%10 = zext i32 %9 to i64
%11 = alloca i8, i64 %10
%12 = add nsw i32 %8, 1
%13 = zext i32 %12 to i64
%14 = alloca i8, i64 %13
%15 = icmp slt i32 %1, %0
br i1 %15, label %23, label %16
16: ; preds = %6
%17 = sext i32 %0 to i64
%18 = getelementptr i8, i8* %2, i64 %17
%19 = sub i32 %1, %0
%20 = zext i32 %19 to i64
%21 = add nuw nsw i64 %20, 1
%22 = and i64 %21, 4294967295
br label %23
23: ; preds = %16, %6
%24 = phi i64 [ 0, %6 ], [ %22, %16 ]
%25 = getelementptr inbounds i8, i8* %11, i64 %24
store i8 0, i8* %25
%26 = icmp slt i32 %4, %3
br i1 %26, label %34, label %27
27: ; preds = %23
%28 = sext i32 %3 to i64
%29 = getelementptr i8, i8* %5, i64 %28
%30 = sub i32 %4, %3
%31 = zext i32 %30 to i64
%32 = add nuw nsw i64 %31, 1
%33 = and i64 %32, 4294967295
br label %34
34: ; preds = %27, %23
%35 = phi i64 [ 0, %23 ], [ %33, %27 ]
%36 = getelementptr inbounds i8, i8* %14, i64 %35
store i8 0, i8* %36
%37 = call i64 @strcmp(i8* %11, i8* %14)
%38 = icmp eq i64 %37, 0
%39 = zext i1 %38 to i32
ret i32 %39
}