#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 *);
unsigned int strlen(char *);
int _count_repeated(char *lastline, char *line, unsigned int skip) {
  if (strlen(lastline) < skip)
    return strlen(line) < skip;
  if (strlen(line) < skip)
    return 0;
  if (strcmp(&lastline[skip], &line[skip]) == 0)
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<_count_repeated>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
cmp    -0x1c(%rbp),%eax
jae    1161 <_count_repeated+0x41>
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
cmp    -0x1c(%rbp),%eax
setb   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
jmp    11b5 <_count_repeated+0x95>
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
cmp    -0x1c(%rbp),%eax
jae    117f <_count_repeated+0x5f>
movl   $0x0,-0x4(%rbp)
jmp    11b5 <_count_repeated+0x95>
mov    -0x10(%rbp),%rdi
mov    -0x1c(%rbp),%eax
add    %rax,%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%eax
add    %rax,%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    11ae <_count_repeated+0x8e>
movl   $0x1,-0x4(%rbp)
jmp    11b5 <_count_repeated+0x95>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_count_repeated>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %edx,%ebp
mov    %rsi,%r14
mov    %rdi,%r15
call   1030 <strlen@plt>
mov    %eax,%ebx
cmp    %ebp,%eax
setb   %r12b
mov    %r14,%rdi
call   1030 <strlen@plt>
cmp    %ebp,%eax
setb   %cl
and    %r12b,%cl
cmp    %ebp,%ebx
jb     116e <_count_repeated+0x4e>
cmp    %ebp,%eax
jb     116e <_count_repeated+0x4e>
mov    %ebp,%eax
add    %rax,%r15
add    %rax,%r14
mov    %r15,%rdi
mov    %r14,%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
sete   %cl
movzbl %cl,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @_count_repeated(i8* %0, i8* %1, i32 %2) {
%4 = tail call i32 @strlen(i8* %0)
%5 = icmp ult i32 %4, %2
%6 = tail call i32 @strlen(i8* %1)
%7 = icmp ult i32 %6, %2
%8 = select i1 %5, i1 true, i1 %7
%9 = select i1 %5, i1 %7, i1 false
br i1 %8, label %16, label %10
10: ; preds = %3
%11 = zext i32 %2 to i64
%12 = getelementptr inbounds i8, i8* %0, i64 %11
%13 = getelementptr inbounds i8, i8* %1, i64 %11
%14 = tail call i64 @strcmp(i8* %12, i8* %13)
%15 = icmp eq i64 %14, 0
br label %16
16: ; preds = %3, %10
%17 = phi i1 [ %15, %10 ], [ %9, %3 ]
%18 = zext i1 %17 to i32
ret i32 %18
}