#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 */
int getStringSize(char *);
int /*<<< orphan*/ memset(char *, char, int);
int /*<<< orphan*/ strcmp(char *, char *);
int /*<<< orphan*/ strncpy(char *, char *, int);
int checkforRepetition(char *decimals, int i, int j) {
  int size = j - i, stringSize = getStringSize(decimals);
  char str1[size + 1], str2[size + 1], str3[size + 1], str4[size + 1];
  int k, l;
  k = j + size;
  l = k + size;
  if (stringSize <= ((size * 2) + i) || (l + size) > 3999) {
    return 0;
  }
  memset(str1, '\x0', size + 1);
  memset(str2, '\x0', size + 1);
  memset(str3, '\x0', size + 1);
  memset(str4, '\x0', size + 1);
  strncpy(str1, decimals + i, size);
  strncpy(str2, decimals + j, size);
  strncpy(str3, decimals + k, size);
  strncpy(str4, decimals + l, size);
  if (!strcmp(str1, str2) && !strcmp(str1, str3) && !strcmp(str1, str4)) {
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<checkforRepetition>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    -0x14(%rbp),%ecx
sub    %ecx,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rdi
call   1060 <getStringSize@plt>
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %rsp,%rcx
mov    %rcx,-0x28(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x78(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x30(%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,-0x70(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x38(%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,-0x40(%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,-0x60(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x48(%rbp)
mov    -0x18(%rbp),%eax
add    -0x1c(%rbp),%eax
mov    %eax,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
add    -0x1c(%rbp),%eax
mov    %eax,-0x50(%rbp)
mov    -0x20(%rbp),%eax
mov    -0x1c(%rbp),%ecx
shl    $0x1,%ecx
add    -0x14(%rbp),%ecx
cmp    %ecx,%eax
jle    1232 <checkforRepetition+0xf2>
mov    -0x50(%rbp),%eax
add    -0x1c(%rbp),%eax
cmp    $0xf9f,%eax
jle    1245 <checkforRepetition+0x105>
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x54(%rbp)
jmp    1348 <checkforRepetition+0x208>
mov    -0x78(%rbp),%rdi
mov    -0x1c(%rbp),%edx
add    $0x1,%edx
xor    %esi,%esi
call   1040 <memset@plt>
mov    -0x70(%rbp),%rdi
mov    -0x1c(%rbp),%edx
add    $0x1,%edx
xor    %esi,%esi
call   1040 <memset@plt>
mov    -0x68(%rbp),%rdi
mov    -0x1c(%rbp),%edx
add    $0x1,%edx
xor    %esi,%esi
call   1040 <memset@plt>
mov    -0x60(%rbp),%rdi
mov    -0x1c(%rbp),%edx
add    $0x1,%edx
xor    %esi,%esi
call   1040 <memset@plt>
mov    -0x78(%rbp),%rdi
mov    -0x10(%rbp),%rsi
movslq -0x14(%rbp),%rax
add    %rax,%rsi
mov    -0x1c(%rbp),%edx
call   1030 <strncpy@plt>
mov    -0x70(%rbp),%rdi
mov    -0x10(%rbp),%rsi
movslq -0x18(%rbp),%rax
add    %rax,%rsi
mov    -0x1c(%rbp),%edx
call   1030 <strncpy@plt>
mov    -0x68(%rbp),%rdi
mov    -0x10(%rbp),%rsi
movslq -0x4c(%rbp),%rax
add    %rax,%rsi
mov    -0x1c(%rbp),%edx
call   1030 <strncpy@plt>
mov    -0x60(%rbp),%rdi
mov    -0x10(%rbp),%rsi
movslq -0x50(%rbp),%rax
add    %rax,%rsi
mov    -0x1c(%rbp),%edx
call   1030 <strncpy@plt>
mov    -0x78(%rbp),%rdi
mov    -0x70(%rbp),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    133a <checkforRepetition+0x1fa>
mov    -0x68(%rbp),%rsi
mov    -0x78(%rbp),%rdi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    133a <checkforRepetition+0x1fa>
mov    -0x60(%rbp),%rsi
mov    -0x78(%rbp),%rdi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    133a <checkforRepetition+0x1fa>
movl   $0x1,-0x4(%rbp)
movl   $0x1,-0x54(%rbp)
jmp    1348 <checkforRepetition+0x208>
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x54(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<checkforRepetition>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %esi,%r14d
mov    %rdx,-0x30(%rbp)
mov    %edx,%ebx
sub    %esi,%ebx
mov    %rdi,-0x60(%rbp)
call   1060 <getStringSize@plt>
lea    0x1(%rbx),%r13d
lea    0xf(%r13),%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdi
sub    %rcx,%rdi
mov    %rdi,%rsp
mov    %rsp,%r12
sub    %rcx,%r12
mov    %r12,%rsp
mov    %rsp,%r15
sub    %rcx,%r15
mov    %r15,%rsp
mov    %rsp,%rsi
sub    %rcx,%rsi
mov    %rsi,%rsp
mov    %r14,-0x58(%rbp)
lea    (%r14,%rbx,2),%ecx
xor    %edx,%edx
cmp    %ecx,%eax
jle    1284 <checkforRepetition+0x144>
mov    -0x30(%rbp),%rax
lea    (%rbx,%rax,1),%r8d
lea    (%r8,%rbx,1),%ecx
lea    (%rcx,%rbx,1),%eax
cmp    $0xf9f,%eax
jg     1284 <checkforRepetition+0x144>
mov    %rsi,%r14
mov    %rsi,-0x40(%rbp)
mov    %rdi,-0x38(%rbp)
xor    %esi,%esi
mov    %r13d,%edx
mov    %rcx,-0x50(%rbp)
mov    %r8,-0x48(%rbp)
call   1040 <memset@plt>
mov    %r12,%rdi
xor    %esi,%esi
mov    %r13d,%edx
call   1040 <memset@plt>
mov    %r15,%rdi
xor    %esi,%esi
mov    %r13d,%edx
call   1040 <memset@plt>
mov    %r14,%rdi
xor    %esi,%esi
mov    %r13d,%edx
call   1040 <memset@plt>
movslq -0x58(%rbp),%rsi
mov    -0x60(%rbp),%r13
add    %r13,%rsi
mov    -0x38(%rbp),%r14
mov    %r14,%rdi
mov    %ebx,%edx
call   1030 <strncpy@plt>
movslq -0x30(%rbp),%rsi
add    %r13,%rsi
mov    %r12,%rdi
mov    %ebx,%edx
call   1030 <strncpy@plt>
movslq -0x48(%rbp),%rsi
add    %r13,%rsi
mov    %r15,%rdi
mov    %ebx,%edx
call   1030 <strncpy@plt>
movslq -0x50(%rbp),%rsi
add    %r13,%rsi
mov    -0x40(%rbp),%rdi
mov    %rdi,%r13
mov    %ebx,%edx
call   1030 <strncpy@plt>
mov    %r14,%rdi
mov    %r12,%rsi
call   1050 <strcmp@plt>
test   %eax,%eax
jne    1282 <checkforRepetition+0x142>
mov    %r14,%rdi
mov    %r15,%rsi
call   1050 <strcmp@plt>
test   %eax,%eax
jne    1282 <checkforRepetition+0x142>
mov    %r14,%rdi
mov    %r13,%rsi
call   1050 <strcmp@plt>
test   %eax,%eax
je     1295 <checkforRepetition+0x155>
xor    %edx,%edx
mov    %edx,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    $0x1,%edx
jmp    1284 <checkforRepetition+0x144>

LLVM IR (-O0):
define i32 @checkforRepetition(i8* %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i8*
%11 = alloca i64
%12 = alloca i64
%13 = alloca i64
%14 = alloca i64
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
store i8* %0, i8** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
%18 = load i32, i32* %7
%19 = load i32, i32* %6
%20 = sub nsw i32 %18, %19
store i32 %20, i32* %8
%21 = load i8*, i8** %5
%22 = call i32 @getStringSize(i8* %21)
store i32 %22, i32* %9
%23 = load i32, i32* %8
%24 = add nsw i32 %23, 1
%25 = zext i32 %24 to i64
%26 = call i8* @llvm.stacksave()
store i8* %26, i8** %10
%27 = alloca i8, i64 %25
store i64 %25, i64* %11
%28 = load i32, i32* %8
%29 = add nsw i32 %28, 1
%30 = zext i32 %29 to i64
%31 = alloca i8, i64 %30
store i64 %30, i64* %12
%32 = load i32, i32* %8
%33 = add nsw i32 %32, 1
%34 = zext i32 %33 to i64
%35 = alloca i8, i64 %34
store i64 %34, i64* %13
%36 = load i32, i32* %8
%37 = add nsw i32 %36, 1
%38 = zext i32 %37 to i64
%39 = alloca i8, i64 %38
store i64 %38, i64* %14
%40 = load i32, i32* %7
%41 = load i32, i32* %8
%42 = add nsw i32 %40, %41
store i32 %42, i32* %15
%43 = load i32, i32* %15
%44 = load i32, i32* %8
%45 = add nsw i32 %43, %44
store i32 %45, i32* %16
%46 = load i32, i32* %9
%47 = load i32, i32* %8
%48 = mul nsw i32 %47, 2
%49 = load i32, i32* %6
%50 = add nsw i32 %48, %49
%51 = icmp sle i32 %46, %50
br i1 %51, label %57, label %52
52: ; preds = %3
%53 = load i32, i32* %16
%54 = load i32, i32* %8
%55 = add nsw i32 %53, %54
%56 = icmp sgt i32 %55, 3999
br i1 %56, label %57, label %58
57: ; preds = %52, %3
store i32 0, i32* %4
store i32 1, i32* %17
br label %105
58: ; preds = %52
%59 = load i32, i32* %8
%60 = add nsw i32 %59, 1
%61 = call i32 @memset(i8* %27, i8 signext 0, i32 %60)
%62 = load i32, i32* %8
%63 = add nsw i32 %62, 1
%64 = call i32 @memset(i8* %31, i8 signext 0, i32 %63)
%65 = load i32, i32* %8
%66 = add nsw i32 %65, 1
%67 = call i32 @memset(i8* %35, i8 signext 0, i32 %66)
%68 = load i32, i32* %8
%69 = add nsw i32 %68, 1
%70 = call i32 @memset(i8* %39, i8 signext 0, i32 %69)
%71 = load i8*, i8** %5
%72 = load i32, i32* %6
%73 = sext i32 %72 to i64
%74 = getelementptr inbounds i8, i8* %71, i64 %73
%75 = load i32, i32* %8
%76 = call i32 @strncpy(i8* %27, i8* %74, i32 %75)
%77 = load i8*, i8** %5
%78 = load i32, i32* %7
%79 = sext i32 %78 to i64
%80 = getelementptr inbounds i8, i8* %77, i64 %79
%81 = load i32, i32* %8
%82 = call i32 @strncpy(i8* %31, i8* %80, i32 %81)
%83 = load i8*, i8** %5
%84 = load i32, i32* %15
%85 = sext i32 %84 to i64
%86 = getelementptr inbounds i8, i8* %83, i64 %85
%87 = load i32, i32* %8
%88 = call i32 @strncpy(i8* %35, i8* %86, i32 %87)
%89 = load i8*, i8** %5
%90 = load i32, i32* %16
%91 = sext i32 %90 to i64
%92 = getelementptr inbounds i8, i8* %89, i64 %91
%93 = load i32, i32* %8
%94 = call i32 @strncpy(i8* %39, i8* %92, i32 %93)
%95 = call i32 @strcmp(i8* %27, i8* %31)
%96 = icmp ne i32 %95, 0
br i1 %96, label %104, label %97
97: ; preds = %58
%98 = call i32 @strcmp(i8* %27, i8* %35)
%99 = icmp ne i32 %98, 0
br i1 %99, label %104, label %100
100: ; preds = %97
%101 = call i32 @strcmp(i8* %27, i8* %39)
%102 = icmp ne i32 %101, 0
br i1 %102, label %104, label %103
103: ; preds = %100
store i32 1, i32* %4
store i32 1, i32* %17
br label %105
104: ; preds = %100, %97, %58
store i32 0, i32* %4
store i32 1, i32* %17
br label %105
105: ; preds = %104, %103, %57
%106 = load i8*, i8** %10
%107 = load i32, i32* %4
ret i32 %107
}

LLVM IR (-O2):
define i32 @checkforRepetition(i8* %0, i32 %1, i32 %2) {
%4 = sub nsw i32 %2, %1
%5 = tail call i32 @getStringSize(i8* %0)
%6 = add nsw i32 %4, 1
%7 = zext i32 %6 to i64
%8 = alloca i8, i64 %7
%9 = alloca i8, i64 %7
%10 = alloca i8, i64 %7
%11 = alloca i8, i64 %7
%12 = add nsw i32 %4, %2
%13 = add nsw i32 %12, %4
%14 = shl nsw i32 %4, 1
%15 = add nsw i32 %14, %1
%16 = icmp sle i32 %5, %15
%17 = add nsw i32 %13, %4
%18 = icmp sgt i32 %17, 3999
%19 = select i1 %16, i1 true, i1 %18
br i1 %19, label %46, label %20
20: ; preds = %3
%21 = call i32 @memset(i8* %8, i8 signext 0, i32 %6)
%22 = call i32 @memset(i8* %9, i8 signext 0, i32 %6)
%23 = call i32 @memset(i8* %10, i8 signext 0, i32 %6)
%24 = call i32 @memset(i8* %11, i8 signext 0, i32 %6)
%25 = sext i32 %1 to i64
%26 = getelementptr inbounds i8, i8* %0, i64 %25
%27 = call i32 @strncpy(i8* %8, i8* %26, i32 %4)
%28 = sext i32 %2 to i64
%29 = getelementptr inbounds i8, i8* %0, i64 %28
%30 = call i32 @strncpy(i8* %9, i8* %29, i32 %4)
%31 = sext i32 %12 to i64
%32 = getelementptr inbounds i8, i8* %0, i64 %31
%33 = call i32 @strncpy(i8* %10, i8* %32, i32 %4)
%34 = sext i32 %13 to i64
%35 = getelementptr inbounds i8, i8* %0, i64 %34
%36 = call i32 @strncpy(i8* %11, i8* %35, i32 %4)
%37 = call i32 @strcmp(i8* %8, i8* %9)
%38 = icmp eq i32 %37, 0
br i1 %38, label %39, label %45
39: ; preds = %20
%40 = call i32 @strcmp(i8* %8, i8* %10)
%41 = icmp eq i32 %40, 0
br i1 %41, label %42, label %45
42: ; preds = %39
%43 = call i32 @strcmp(i8* %8, i8* %11)
%44 = icmp eq i32 %43, 0
br i1 %44, label %46, label %45
45: ; preds = %42, %39, %20
br label %46
46: ; preds = %42, %3, %45
%47 = phi i32 [ 0, %45 ], [ 0, %3 ], [ 1, %42 ]
ret i32 %47
}