#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 */
size_t strlen(char const *);
int contains_two_letters_in_row(char const *str) {
  size_t i, j;
  size_t len = strlen(str);
  for (i = 0; i < len; i++) {
    if ((i + 1) > len) {
      return 0;
    }
    if (str[i] == str[i + 1]) {
      return 1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<contains_two_letters_in_row>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x28(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x28(%rbp),%rax
jae    11a0 <contains_two_letters_in_row+0x90>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
cmp    -0x28(%rbp),%rax
jbe    115d <contains_two_letters_in_row+0x4d>
movl   $0x0,-0x4(%rbp)
jmp    11a7 <contains_two_letters_in_row+0x97>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%rdx
movsbl 0x1(%rcx,%rdx,1),%ecx
cmp    %ecx,%eax
jne    118a <contains_two_letters_in_row+0x7a>
movl   $0x1,-0x4(%rbp)
jmp    11a7 <contains_two_letters_in_row+0x97>
jmp    118f <contains_two_letters_in_row+0x7f>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1131 <contains_two_letters_in_row+0x21>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<contains_two_letters_in_row>:
push   %rbx
mov    %rdi,%rbx
call   1030 <strlen@plt>
mov    %rax,%rsi
xor    %eax,%eax
xor    %edx,%edx
cmp    %rdx,%rsi
je     113b <contains_two_letters_in_row+0x2b>
movzbl (%rbx,%rdx,1),%ecx
lea    0x1(%rdx),%rdi
cmp    0x1(%rbx,%rdx,1),%cl
mov    %rdi,%rdx
jne    1120 <contains_two_letters_in_row+0x10>
mov    $0x1,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @contains_two_letters_in_row(i8* nocapture %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
br label %3
3: ; preds = %6, %1
%4 = phi i64 [ 0, %1 ], [ %7, %6 ]
%5 = icmp eq i64 %4, %2
br i1 %5, label %13, label %6
6: ; preds = %3
%7 = add i64 %4, 1
%8 = getelementptr inbounds i8, i8* %0, i64 %4
%9 = load i8, i8* %8
%10 = getelementptr inbounds i8, i8* %0, i64 %7
%11 = load i8, i8* %10
%12 = icmp eq i8 %9, %11
br i1 %12, label %13, label %3
13: ; preds = %3, %6
%14 = phi i32 [ 1, %6 ], [ 0, %3 ]
ret i32 %14
}