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


x86 assembly (clang, -O0):
<has_double_letters>:
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    $0x1,%ecx
cmp    %ecx,%eax
jge    1186 <has_double_letters+0x76>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
mov    -0x10(%rbp),%rcx
mov    -0x14(%rbp),%edx
add    $0x1,%edx
movslq %edx,%rdx
movsbl (%rcx,%rdx,1),%ecx
cmp    %ecx,%eax
jne    1173 <has_double_letters+0x63>
movl   $0x1,-0x4(%rbp)
jmp    118d <has_double_letters+0x7d>
jmp    1178 <has_double_letters+0x68>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1123 <has_double_letters+0x13>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<has_double_letters>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r15
xor    %r14d,%r14d
xor    %ebx,%ebx
nopl   (%rax)
mov    %r15,%rdi
call   1030 <strlen@plt>
add    $0xffffffff,%eax
cltq
cmp    %rax,%rbx
jge    114b <has_double_letters+0x3b>
movzbl (%r15,%rbx,1),%eax
lea    0x1(%rbx),%rcx
cmp    0x1(%r15,%rbx,1),%al
mov    %rcx,%rbx
jne    1120 <has_double_letters+0x10>
mov    $0x1,%r14d
mov    %r14d,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @has_double_letters(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, 1
%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, 1
%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_double_letters(i8* %0) {
br label %2
2: ; preds = %8, %1
%3 = phi i64 [ %11, %8 ], [ 0, %1 ]
%4 = tail call i32 @strlen(i8* %0)
%5 = add nsw i32 %4, -1
%6 = sext i32 %5 to i64
%7 = icmp slt i64 %3, %6
br i1 %7, label %8, label %15
8: ; preds = %2
%9 = getelementptr inbounds i8, i8* %0, i64 %3
%10 = load i8, i8* %9
%11 = add nuw nsw i64 %3, 1
%12 = getelementptr inbounds i8, i8* %0, i64 %11
%13 = load i8, i8* %12
%14 = icmp eq i8 %10, %13
br i1 %14, label %15, label %2
15: ; preds = %2, %8
%16 = phi i32 [ 1, %8 ], [ 0, %2 ]
ret i32 %16
}