#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 atoi(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ search_match_file(char *, char *, int *, char *, int *);
scalar_t__ strcmp(char *, char *);
int main(int argc, char *argv[]) {
  if (argc >= 4) {
    int max_prints = atoi(argv[3]);
    int current_result = 0;
    printf("Resultado de buscador -- ''%s'' na pasta %s\n", argv[2], argv[1]);
    if (strcmp(argv[1], "/") != 0) {
      search_match_file(argv[1], argv[2], &max_prints, ".", &current_result);
    } else {
      search_match_file("", argv[2], &max_prints, ".", &current_result);
    }
  } else {
    printf("numero de argumentos insuficiente\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x4,-0x8(%rbp)
jl     1204 <main+0xc4>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   1060 <atoi@plt>
mov    %eax,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xe72(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe89(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
je     11dc <main+0x9c>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
lea    -0x14(%rbp),%rdx
lea    0xe61(%rip),%rcx
lea    -0x18(%rbp),%r8
call   1030 <search_match_file@plt>
jmp    11ff <main+0xbf>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
lea    0xe68(%rip),%rdi
lea    -0x14(%rbp),%rdx
lea    0xe39(%rip),%rcx
lea    -0x18(%rbp),%r8
call   1030 <search_match_file@plt>
jmp    1212 <main+0xd2>
lea    0xe26(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
cmp    $0x4,%edi
jl     11a3 <main+0x53>
mov    %rsi,%rbx
mov    0x18(%rsi),%rdi
call   1070 <atoi@plt>
mov    %eax,0xc(%rsp)
movl   $0x0,0x8(%rsp)
mov    0x8(%rbx),%rdx
mov    0x10(%rbx),%rsi
lea    0xe7f(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x8(%rbx),%rdi
lea    0xe9a(%rip),%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
je     11b1 <main+0x61>
mov    0x8(%rbx),%rdi
jmp    11b8 <main+0x68>
lea    0xe87(%rip),%rdi
call   1030 <puts@plt>
jmp    11d2 <main+0x82>
lea    0xe74(%rip),%rdi
mov    0x10(%rbx),%rsi
lea    0xe6c(%rip),%rcx
lea    0xc(%rsp),%rdx
lea    0x8(%rsp),%r8
call   1040 <search_match_file@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [45 x i8] c"Resultado de buscador -- ''%s'' na pasta %s\0A\00"
@.str.1 = [2 x i8] c"/\00"
@.str.2 = [2 x i8] c".\00"
@.str.3 = [1 x i8] zeroinitializer
@.str.4 = [35 x i8] c"numero de argumentos insuficiente\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = icmp sge i32 %8, 4
br i1 %9, label %10, label %41
10: ; preds = %2
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 3
%13 = load i8*, i8** %12
%14 = call i32 @atoi(i8* %13)
store i32 %14, i32* %6
store i32 0, i32* %7
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 2
%17 = load i8*, i8** %16
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 1
%20 = load i8*, i8** %19
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i8* %17, i8* %20)
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 1
%24 = load i8*, i8** %23
%25 = call i64 @strcmp(i8* %24, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%26 = icmp ne i64 %25, 0
br i1 %26, label %27, label %35
27: ; preds = %10
%28 = load i8**, i8*** %5
%29 = getelementptr inbounds i8*, i8** %28, i64 1
%30 = load i8*, i8** %29
%31 = load i8**, i8*** %5
%32 = getelementptr inbounds i8*, i8** %31, i64 2
%33 = load i8*, i8** %32
%34 = call i32 @search_match_file(i8* %30, i8* %33, i32* %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i32* %7)
br label %40
35: ; preds = %10
%36 = load i8**, i8*** %5
%37 = getelementptr inbounds i8*, i8** %36, i64 2
%38 = load i8*, i8** %37
%39 = call i32 @search_match_file(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0), i8* %38, i32* %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i32* %7)
br label %40
40: ; preds = %35, %27
br label %43
41: ; preds = %2
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.4, i64 0, i64 0))
br label %43
43: ; preds = %41, %40
ret i32 0
}

LLVM IR (-O2):
@.str = [45 x i8] c"Resultado de buscador -- ''%s'' na pasta %s\0A\00"
@.str.1 = [2 x i8] c"/\00"
@.str.2 = [2 x i8] c".\00"
@.str.3 = [1 x i8] zeroinitializer
@str = [34 x i8] c"numero de argumentos insuficiente\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca i32
%5 = icmp sgt i32 %0, 3
br i1 %5, label %6, label %26
6: ; preds = %2
%7 = bitcast i32* %3 to i8*
%8 = getelementptr inbounds i8*, i8** %1, i64 3
%9 = load i8*, i8** %8
%10 = tail call i32 @atoi(i8* %9)
store i32 %10, i32* %3
%11 = bitcast i32* %4 to i8*
store i32 0, i32* %4
%12 = getelementptr inbounds i8*, i8** %1, i64 2
%13 = load i8*, i8** %12
%14 = getelementptr inbounds i8*, i8** %1, i64 1
%15 = load i8*, i8** %14
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i8* %13, i8* %15)
%17 = load i8*, i8** %14
%18 = tail call i64 @strcmp(i8* %17, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%19 = icmp eq i64 %18, 0
br i1 %19, label %22, label %20
20: ; preds = %6
%21 = load i8*, i8** %14
br label %22
22: ; preds = %6, %20
%23 = phi i8* [ %21, %20 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0), %6 ]
%24 = load i8*, i8** %12
%25 = call i32 @search_match_file(i8* %23, i8* %24, i32* %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i32* %4)
br label %28
26: ; preds = %2
%27 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str, i64 0, i64 0))
br label %28
28: ; preds = %26, %22
ret i32 0
}