#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 count_pairs_wrapper(char *, int);
int /*<<< orphan*/ test_run(int, int, int);
int main(int argc, char const *argv[]) {
  {
    int pairs = count_pairs_wrapper("", 0);
    test_run(1, 0, pairs);
  }
  {
    int pairs = count_pairs_wrapper("abc", 3);
    test_run(2, 0, pairs);
  }
  {
    int pairs = count_pairs_wrapper("aba", 3);
    test_run(3, 1, pairs);
  }
  {
    int pairs = count_pairs_wrapper("ababa", 5);
    test_run(4, 3, pairs);
  }
  {
    int pairs = count_pairs_wrapper("abababababxxxyyy", 16);
    test_run(5, 10, pairs);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xecc(%rip),%rdi
xor    %esi,%esi
call   1040 <count_pairs_wrapper@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edx
mov    $0x1,%edi
xor    %esi,%esi
call   1030 <test_run@plt>
lea    0xea3(%rip),%rdi
mov    $0x3,%esi
call   1040 <count_pairs_wrapper@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%edx
mov    $0x2,%edi
xor    %esi,%esi
call   1030 <test_run@plt>
lea    0xe86(%rip),%rdi
mov    $0x3,%esi
call   1040 <count_pairs_wrapper@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%edx
mov    $0x3,%edi
mov    $0x1,%esi
call   1030 <test_run@plt>
lea    0xe5e(%rip),%rdi
mov    $0x5,%esi
call   1040 <count_pairs_wrapper@plt>
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%edx
mov    $0x4,%edi
mov    $0x3,%esi
call   1030 <test_run@plt>
lea    0xe3e(%rip),%rdi
mov    $0x10,%esi
call   1040 <count_pairs_wrapper@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%edx
mov    $0x5,%edi
mov    $0xa,%esi
call   1030 <test_run@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee1(%rip),%rdi
xor    %esi,%esi
call   1040 <count_pairs_wrapper@plt>
mov    $0x1,%edi
xor    %esi,%esi
mov    %eax,%edx
call   1030 <test_run@plt>
lea    0xebc(%rip),%rdi
mov    $0x3,%esi
call   1040 <count_pairs_wrapper@plt>
mov    $0x2,%edi
xor    %esi,%esi
mov    %eax,%edx
call   1030 <test_run@plt>
lea    0xea3(%rip),%rdi
mov    $0x3,%esi
call   1040 <count_pairs_wrapper@plt>
mov    $0x3,%edi
mov    $0x1,%esi
mov    %eax,%edx
call   1030 <test_run@plt>
lea    0xe7f(%rip),%rdi
mov    $0x5,%esi
call   1040 <count_pairs_wrapper@plt>
mov    $0x4,%edi
mov    $0x3,%esi
mov    %eax,%edx
call   1030 <test_run@plt>
lea    0xe63(%rip),%rdi
mov    $0x10,%esi
call   1040 <count_pairs_wrapper@plt>
mov    $0x5,%edi
mov    $0xa,%esi
mov    %eax,%edx
call   1030 <test_run@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
@.str.1 = [4 x i8] c"abc\00"
@.str.2 = [4 x i8] c"aba\00"
@.str.3 = [6 x i8] c"ababa\00"
@.str.4 = [17 x i8] c"abababababxxxyyy\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = call i32 @count_pairs_wrapper(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i32 0)
store i32 %11, i32* %6
%12 = load i32, i32* %6
%13 = call i32 @test_run(i32 1, i32 0, i32 %12)
%14 = call i32 @count_pairs_wrapper(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 3)
store i32 %14, i32* %7
%15 = load i32, i32* %7
%16 = call i32 @test_run(i32 2, i32 0, i32 %15)
%17 = call i32 @count_pairs_wrapper(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 3)
store i32 %17, i32* %8
%18 = load i32, i32* %8
%19 = call i32 @test_run(i32 3, i32 1, i32 %18)
%20 = call i32 @count_pairs_wrapper(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32 5)
store i32 %20, i32* %9
%21 = load i32, i32* %9
%22 = call i32 @test_run(i32 4, i32 3, i32 %21)
%23 = call i32 @count_pairs_wrapper(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0), i32 16)
store i32 %23, i32* %10
%24 = load i32, i32* %10
%25 = call i32 @test_run(i32 5, i32 10, i32 %24)
ret i32 0
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
@.str.1 = [4 x i8] c"abc\00"
@.str.2 = [4 x i8] c"aba\00"
@.str.3 = [6 x i8] c"ababa\00"
@.str.4 = [17 x i8] c"abababababxxxyyy\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @count_pairs_wrapper(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i32 0)
%4 = tail call i32 @test_run(i32 1, i32 0, i32 %3)
%5 = tail call i32 @count_pairs_wrapper(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 3)
%6 = tail call i32 @test_run(i32 2, i32 0, i32 %5)
%7 = tail call i32 @count_pairs_wrapper(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 3)
%8 = tail call i32 @test_run(i32 3, i32 1, i32 %7)
%9 = tail call i32 @count_pairs_wrapper(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32 5)
%10 = tail call i32 @test_run(i32 4, i32 3, i32 %9)
%11 = tail call i32 @count_pairs_wrapper(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0), i32 16)
%12 = tail call i32 @test_run(i32 5, i32 10, i32 %11)
ret i32 0
}