#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 cantrepeticiones(char *, char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ puts(char *);
int main() {
  char cad1[] = "ananana";
  char cad2[] = "ana";
  char cad3[] = "an";
  printf("\n");
  char cad4[] = "mariamariamariamariana";
  char cad5[] = "maria jose";
  char cad6[] = "maria";
  puts(cad1);
  puts(cad2);
  puts(cad3);
  puts(cad4);
  puts(cad5);
  puts(cad6);
  printf("\n La cadena 2 se repite %d veces en la cadena 1",
         cantrepeticiones(cad1, cad2));
  printf("\n La cadena 3 se repite %d veces en la cadena 1",
         cantrepeticiones(cad1, cad3));
  printf("\n La cadena 5 se repite %d veces en la cadena 4",
         cantrepeticiones(cad4, cad5));
  printf("\n La cadena 6 se repite %d veces en la cadena 4",
         cantrepeticiones(cad4, cad6));
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeba(%rip),%rax
mov    %rax,-0xc(%rbp)
mov    0xeb4(%rip),%eax
mov    %eax,-0x10(%rbp)
mov    0xeae(%rip),%ax
mov    %ax,-0x13(%rbp)
mov    0xea6(%rip),%al
mov    %al,-0x11(%rbp)
lea    0xe9d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    0xf64(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xf61(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xf5f(%rip),%eax
mov    %eax,-0x20(%rbp)
mov    0xf59(%rip),%ax
mov    %ax,-0x1c(%rbp)
mov    0xf51(%rip),%al
mov    %al,-0x1a(%rbp)
mov    0xe5e(%rip),%rax
mov    %rax,-0x3b(%rbp)
mov    0xe5b(%rip),%ax
mov    %ax,-0x33(%rbp)
mov    0xe53(%rip),%al
mov    %al,-0x31(%rbp)
mov    0xe4b(%rip),%eax
mov    %eax,-0x41(%rbp)
mov    0xe45(%rip),%ax
mov    %ax,-0x3d(%rbp)
lea    -0xc(%rbp),%rdi
call   1030 <puts@plt>
lea    -0x10(%rbp),%rdi
call   1030 <puts@plt>
lea    -0x13(%rbp),%rdi
call   1030 <puts@plt>
lea    -0x30(%rbp),%rdi
call   1030 <puts@plt>
lea    -0x3b(%rbp),%rdi
call   1030 <puts@plt>
lea    -0x41(%rbp),%rdi
call   1030 <puts@plt>
lea    -0xc(%rbp),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <cantrepeticiones@plt>
mov    %eax,%esi
lea    0xdf7(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0xc(%rbp),%rdi
lea    -0x13(%rbp),%rsi
call   1040 <cantrepeticiones@plt>
mov    %eax,%esi
lea    0xe0a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x30(%rbp),%rdi
lea    -0x3b(%rbp),%rsi
call   1040 <cantrepeticiones@plt>
mov    %eax,%esi
lea    0xe1d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x30(%rbp),%rdi
lea    -0x41(%rbp),%rsi
call   1040 <cantrepeticiones@plt>
mov    %eax,%esi
lea    0xe30(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xd7f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
movabs $0x616e616e616e61,%rax
mov    %rax,0x28(%rsp)
movl   $0x616e61,0x14(%rsp)
movb   $0x0,0xa(%rsp)
movw   $0x6e61,0x8(%rsp)
mov    $0xa,%edi
call   1030 <putchar@plt>
movaps 0xf5e(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movabs $0x616e616972616d,%rax
mov    %rax,0x3f(%rsp)
movabs $0x6f6a20616972616d,%rax
20 6a 6f
mov    %rax,0x18(%rsp)
movl   $0x65736f,0x1f(%rsp)
movw   $0x61,0x10(%rsp)
movl   $0x6972616d,0xc(%rsp)
69
lea    0x28(%rsp),%rbx
mov    %rbx,%rdi
call   1040 <puts@plt>
lea    0x14(%rsp),%rbp
mov    %rbp,%rdi
call   1040 <puts@plt>
lea    0x8(%rsp),%r13
mov    %r13,%rdi
call   1040 <puts@plt>
lea    0x30(%rsp),%r15
mov    %r15,%rdi
call   1040 <puts@plt>
lea    0x18(%rsp),%r12
mov    %r12,%rdi
call   1040 <puts@plt>
lea    0xc(%rsp),%r14
mov    %r14,%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1050 <cantrepeticiones@plt>
lea    0xdf8(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %rbx,%rdi
mov    %r13,%rsi
call   1050 <cantrepeticiones@plt>
lea    0xe0d(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1050 <cantrepeticiones@plt>
lea    0xe22(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r15,%rdi
mov    %r14,%rsi
call   1050 <cantrepeticiones@plt>
lea    0xe37(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.main.cad1 = [8 x i8] c"ananana\00"
@__const.main.cad2 = [4 x i8] c"ana\00"
@__const.main.cad3 = [3 x i8] c"an\00"
@.str = [2 x i8] c"\0A\00"
@__const.main.cad4 = [23 x i8] c"mariamariamariamariana\00"
@__const.main.cad5 = [11 x i8] c"maria jose\00"
@__const.main.cad6 = [6 x i8] c"maria\00"
@.str.1 = [48 x i8] c"\0A La cadena 2 se repite %d veces en la cadena 1\00"
@.str.2 = [48 x i8] c"\0A La cadena 3 se repite %d veces en la cadena 1\00"
@.str.3 = [48 x i8] c"\0A La cadena 5 se repite %d veces en la cadena 4\00"
@.str.4 = [48 x i8] c"\0A La cadena 6 se repite %d veces en la cadena 4\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [8 x i8]
%3 = alloca [4 x i8]
%4 = alloca [3 x i8]
%5 = alloca [23 x i8]
%6 = alloca [11 x i8]
%7 = alloca [6 x i8]
store i32 0, i32* %1
%8 = bitcast [8 x i8]* %2 to i8*
%9 = bitcast [4 x i8]* %3 to i8*
%10 = bitcast [3 x i8]* %4 to i8*
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%12 = bitcast [23 x i8]* %5 to i8*
%13 = bitcast [11 x i8]* %6 to i8*
%14 = bitcast [6 x i8]* %7 to i8*
%15 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 0
%16 = call i32 @puts(i8* %15)
%17 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 0
%18 = call i32 @puts(i8* %17)
%19 = getelementptr inbounds [3 x i8], [3 x i8]* %4, i64 0, i64 0
%20 = call i32 @puts(i8* %19)
%21 = getelementptr inbounds [23 x i8], [23 x i8]* %5, i64 0, i64 0
%22 = call i32 @puts(i8* %21)
%23 = getelementptr inbounds [11 x i8], [11 x i8]* %6, i64 0, i64 0
%24 = call i32 @puts(i8* %23)
%25 = getelementptr inbounds [6 x i8], [6 x i8]* %7, i64 0, i64 0
%26 = call i32 @puts(i8* %25)
%27 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 0
%28 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 0
%29 = call i32 @cantrepeticiones(i8* %27, i8* %28)
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.1, i64 0, i64 0), i32 %29)
%31 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 0
%32 = getelementptr inbounds [3 x i8], [3 x i8]* %4, i64 0, i64 0
%33 = call i32 @cantrepeticiones(i8* %31, i8* %32)
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.2, i64 0, i64 0), i32 %33)
%35 = getelementptr inbounds [23 x i8], [23 x i8]* %5, i64 0, i64 0
%36 = getelementptr inbounds [11 x i8], [11 x i8]* %6, i64 0, i64 0
%37 = call i32 @cantrepeticiones(i8* %35, i8* %36)
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.3, i64 0, i64 0), i32 %37)
%39 = getelementptr inbounds [23 x i8], [23 x i8]* %5, i64 0, i64 0
%40 = getelementptr inbounds [6 x i8], [6 x i8]* %7, i64 0, i64 0
%41 = call i32 @cantrepeticiones(i8* %39, i8* %40)
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.4, i64 0, i64 0), i32 %41)
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@__const.main.cad3 = [3 x i8] c"an\00"
@__const.main.cad4 = [23 x i8] c"mariamariamariamariana\00"
@__const.main.cad5 = [11 x i8] c"maria jose\00"
@__const.main.cad6 = [6 x i8] c"maria\00"
@.str.1 = [48 x i8] c"\0A La cadena 2 se repite %d veces en la cadena 1\00"
@.str.2 = [48 x i8] c"\0A La cadena 3 se repite %d veces en la cadena 1\00"
@.str.3 = [48 x i8] c"\0A La cadena 5 se repite %d veces en la cadena 4\00"
@.str.4 = [48 x i8] c"\0A La cadena 6 se repite %d veces en la cadena 4\00"
define i32 @main() {
%1 = alloca i64
%2 = alloca i32
%3 = alloca [3 x i8]
%4 = alloca [23 x i8]
%5 = alloca [11 x i8]
%6 = alloca [6 x i8]
%7 = bitcast i64* %1 to i8*
store i64 27424437483695713, i64* %1
%8 = bitcast i32* %2 to i8*
store i32 6385249, i32* %2
%9 = getelementptr inbounds [3 x i8], [3 x i8]* %3, i64 0, i64 0
%10 = tail call i32 @putchar(i32 10)
%11 = getelementptr inbounds [23 x i8], [23 x i8]* %4, i64 0, i64 0
%12 = getelementptr inbounds [11 x i8], [11 x i8]* %5, i64 0, i64 0
%13 = getelementptr inbounds [6 x i8], [6 x i8]* %6, i64 0, i64 0
%14 = call i32 @puts(i8* %7)
%15 = call i32 @puts(i8* %8)
%16 = call i32 @puts(i8* %9)
%17 = call i32 @puts(i8* %11)
%18 = call i32 @puts(i8* %12)
%19 = call i32 @puts(i8* %13)
%20 = call i32 @cantrepeticiones(i8* %7, i8* %8)
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @.str.1, i64 0, i64 0), i32 %20)
%22 = call i32 @cantrepeticiones(i8* %7, i8* %9)
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @.str.2, i64 0, i64 0), i32 %22)
%24 = call i32 @cantrepeticiones(i8* %11, i8* %12)
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @.str.3, i64 0, i64 0), i32 %24)
%26 = call i32 @cantrepeticiones(i8* %11, i8* %13)
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @.str.4, i64 0, i64 0), i32 %26)
%28 = call i32 @putchar(i32 10)
ret i32 0
}