#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 strlen(char *);
bool has_repeating_letter(char *text) {
  int i = 0;
  for (; i < strlen(text) - 2; i++) {
    if (text[i] == text[i + 2]) {
      return true;
    }
  }
  return false;
}


x86 assembly (clang, -O0):
<has_repeating_letter>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
sub    $0x2,%ecx
cmp    %ecx,%eax
jge    1186 <has_repeating_letter+0x76>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
mov    -0x10(%rbp),%rcx
mov    -0x14(%rbp),%edx
add    $0x2,%edx
movslq %edx,%rdx
movsbl (%rcx,%rdx,1),%ecx
cmp    %ecx,%eax
jne    1173 <has_repeating_letter+0x63>
movl   $0x1,-0x4(%rbp)
jmp    118d <has_repeating_letter+0x7d>
jmp    1178 <has_repeating_letter+0x68>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1123 <has_repeating_letter+0x13>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<has_repeating_letter>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1030 <strlen@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x3,%ecx
jl     115b <has_repeating_letter+0x4b>
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
movzbl (%r14,%rbx,1),%eax
cmp    0x2(%r14,%rbx,1),%al
je     1156 <has_repeating_letter+0x46>
add    $0x1,%rbx
mov    %r14,%rdi
call   1030 <strlen@plt>
add    $0xfffffffe,%eax
cltq
cmp    %rax,%rbx
jl     1130 <has_repeating_letter+0x20>
xor    %eax,%eax
jmp    115b <has_repeating_letter+0x4b>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @has_repeating_letter(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 0, i32* %4
br label %5
5: ; preds = %28, %1
%6 = load i32, i32* %4
%7 = load i8*, i8** %3
%8 = call i32 @strlen(i8* %7)
%9 = sub nsw i32 %8, 2
%10 = icmp slt i32 %6, %9
br i1 %10, label %11, label %31
11: ; preds = %5
%12 = load i8*, i8** %3
%13 = load i32, i32* %4
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i8, i8* %12, i64 %14
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = load i8*, i8** %3
%19 = load i32, i32* %4
%20 = add nsw i32 %19, 2
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i8, i8* %18, i64 %21
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = icmp eq i32 %17, %24
br i1 %25, label %26, label %27
26: ; preds = %11
store i32 1, i32* %2
br label %32
27: ; preds = %11
br label %28
28: ; preds = %27
%29 = load i32, i32* %4
%30 = add nsw i32 %29, 1
store i32 %30, i32* %4
br label %5
31: ; preds = %5
store i32 0, i32* %2
br label %32
32: ; preds = %31, %26
%33 = load i32, i32* %2
ret i32 %33
}

LLVM IR (-O2):
define i32 @has_repeating_letter(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = icmp sgt i32 %2, 2
br i1 %3, label %9, label %18
4: ; preds = %9
%5 = tail call i32 @strlen(i8* %0)
%6 = add nsw i32 %5, -2
%7 = sext i32 %6 to i64
%8 = icmp slt i64 %17, %7
br i1 %8, label %9, label %18
9: ; preds = %1, %4
%10 = phi i64 [ %17, %4 ], [ 0, %1 ]
%11 = getelementptr inbounds i8, i8* %0, i64 %10
%12 = load i8, i8* %11
%13 = add nuw nsw i64 %10, 2
%14 = getelementptr inbounds i8, i8* %0, i64 %13
%15 = load i8, i8* %14
%16 = icmp eq i8 %12, %15
%17 = add nuw nsw i64 %10, 1
br i1 %16, label %18, label %4
18: ; preds = %9, %4, %1
%19 = phi i32 [ 0, %1 ], [ 0, %4 ], [ 1, %9 ]
ret i32 %19
}