#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 busca(char *, int /*<<< orphan*/, int, char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ carrega(char *, int *, char *, int *);
int /*<<< orphan*/ mostra(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  char f[200], p[200];
  int tf = 0, tp = 0;
  if (0)
    printf("Lendo as strings:  \n");
  carrega(f, &tf, p, &tp);
  if (0) {
    printf("tamanhos: f(%d) e p(%d)  \n", tf, tp);
    printf("F:  \n");
    mostra(f, 0, tf);
    printf("P:  \n");
    mostra(p, 0, tp);
  }
  printf("Ocorrencias de p em f: %d .\n", busca(f, 0, tf, p, 0, tp));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1b0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x1a4(%rbp)
movl   $0x0,-0x1a8(%rbp)
lea    -0xd0(%rbp),%rdi
lea    -0x1a0(%rbp),%rdx
lea    -0x1a4(%rbp),%rsi
lea    -0x1a8(%rbp),%rcx
call   1050 <carrega@plt>
lea    -0xd0(%rbp),%rdi
mov    -0x1a4(%rbp),%edx
lea    -0x1a0(%rbp),%rcx
mov    -0x1a8(%rbp),%r9d
xor    %r8d,%r8d
mov    %r8d,%esi
call   1040 <busca@plt>
mov    %eax,%esi
lea    0xe5a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x1b0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x1a8,%rsp
movl   $0x0,0xc(%rsp)
movl   $0x0,0x8(%rsp)
lea    0xe0(%rsp),%rbx
lea    0xc(%rsp),%rsi
lea    0x10(%rsp),%r14
lea    0x8(%rsp),%rcx
mov    %rbx,%rdi
mov    %r14,%rdx
call   1050 <carrega@plt>
mov    0xc(%rsp),%edx
mov    0x8(%rsp),%r9d
mov    %rbx,%rdi
xor    %esi,%esi
mov    %r14,%rcx
xor    %r8d,%r8d
call   1040 <busca@plt>
lea    0xe74(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x1a8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [29 x i8] c"Ocorrencias de p em f: %d .\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [200 x i8]
%3 = alloca [200 x i8]
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %4
store i32 0, i32* %5
%6 = getelementptr inbounds [200 x i8], [200 x i8]* %2, i64 0, i64 0
%7 = getelementptr inbounds [200 x i8], [200 x i8]* %3, i64 0, i64 0
%8 = call i32 @carrega(i8* %6, i32* %4, i8* %7, i32* %5)
%9 = getelementptr inbounds [200 x i8], [200 x i8]* %2, i64 0, i64 0
%10 = load i32, i32* %4
%11 = getelementptr inbounds [200 x i8], [200 x i8]* %3, i64 0, i64 0
%12 = load i32, i32* %5
%13 = call i32 @busca(i8* %9, i32 0, i32 %10, i8* %11, i32 0, i32 %12)
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32 %13)
ret i32 0
}

LLVM IR (-O2):
@.str = [29 x i8] c"Ocorrencias de p em f: %d .\0A\00"
define i32 @main() {
%1 = alloca [200 x i8]
%2 = alloca [200 x i8]
%3 = alloca i32
%4 = alloca i32
%5 = getelementptr inbounds [200 x i8], [200 x i8]* %1, i64 0, i64 0
%6 = getelementptr inbounds [200 x i8], [200 x i8]* %2, i64 0, i64 0
%7 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%8 = bitcast i32* %4 to i8*
store i32 0, i32* %4
%9 = call i32 @carrega(i8* %5, i32* %3, i8* %6, i32* %4)
%10 = load i32, i32* %3
%11 = load i32, i32* %4
%12 = call i32 @busca(i8* %5, i32 0, i32 %10, i8* %6, i32 0, i32 %11)
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32 %12)
ret i32 0
}