#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 /*<<< orphan*/ EncontraChave(char *, char *, char *, int);
scalar_t__ calloc(int, int);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ printf(char *, char *);
int main() {
  int Tamanho = 743;
  char Texto[] =
      "123456789010657033040110313383707633929590617421771177415747524052866757"
      "517513145040126253363203651046610512919091784809483313289539395071312930"
      "792402837778035504342669536569333318628628360538726299182465357723900843"
      "545930767029344507915188798683805199979447570514012026636067407680215436"
      "127709012409828257793175969121078672855449854373686527107970553484871481"
      "495875902432741517939445984755669430178262056039562902999101292985897267"
      "002927215655133208710315769308092859434461910420070269451457069633854195"
      "212776015712085033794912004803049104890783595715963076225011345403771008"
      "784758102029101880594433985514474014112711920119859356730994720447050749"
      "712055592038950858183473472528991954545415110619490490564682595677113739"
      "61417054550528811252031";
  char Padrao[] =
      "106570330401103133837076339295906174217711774157475240528667575175131450"
      "401262533632036510466105129190917848094833132895393950713129307924028377"
      "780355043426695365693333186286283605387262991824653577239008435459307670"
      "293445079151887986838051999794475705140120266360674076802154361277090124"
      "098282577931759691210786728554498543736865271079705534848714814958759024"
      "327415179394459847556694301782620560395629029991012929858972670029272156"
      "551332087103157693080928594344619104200702694514570696338541952127760157"
      "120850337949120048030491048907835957159630762250113454037710087847581020"
      "291018805944339855144740141127119201198593567309947204470507497120555920"
      "389508581834734725289919545454151106194904905646825956771137396141705455"
      "05288112520310000071232";
  char *Chave = (char *)calloc(2000, sizeof(char));
  EncontraChave(Texto, Padrao, Chave, Tamanho);
  printf("%s\n", Chave);
  free(Chave);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x5f0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x2e7,-0x8(%rbp)
lea    -0x2f0(%rbp),%rdi
lea    0xe89(%rip),%rsi
mov    $0x2e8,%edx
call   1070 <memcpy@plt>
lea    -0x5e0(%rbp),%rdi
lea    0x1161(%rip),%rsi
mov    $0x2e8,%edx
call   1070 <memcpy@plt>
mov    $0x7d0,%edi
mov    $0x1,%esi
call   1060 <calloc@plt>
mov    %rax,-0x5e8(%rbp)
lea    -0x2f0(%rbp),%rdi
lea    -0x5e0(%rbp),%rsi
mov    -0x5e8(%rbp),%rdx
mov    -0x8(%rbp),%ecx
call   1050 <EncontraChave@plt>
mov    -0x5e8(%rbp),%rsi
lea    0x13fe(%rip),%rdi
call   1040 <printf@plt>
mov    -0x5e8(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x5f0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x5e0,%rsp
lea    0xe9d(%rip),%rsi
lea    0x2f0(%rsp),%r14
mov    $0x2e8,%edx
mov    %r14,%rdi
call   1070 <memcpy@plt>
lea    0x1171(%rip),%rsi
mov    %rsp,%r15
mov    $0x2e8,%edx
mov    %r15,%rdi
call   1070 <memcpy@plt>
mov    $0x7d0,%edi
mov    $0x1,%esi
call   1060 <calloc@plt>
mov    %rax,%rbx
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rax,%rdx
mov    $0x2e7,%ecx
call   1050 <EncontraChave@plt>
lea    0x141d(%rip),%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x5e0,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.main.Texto = [744 x i8] c"12345678901065703304011031338370763392959061742177117741574752405286675751751314504012625336320365104661051291909178480948331328953939507131293079240283777803550434266953656933331862862836053872629918246535772390084354593076702934450791518879868380519997944757051401202663606740768021543612770901240982825779317596912107867285544985437368652710797055348487148149587590243274151793944598475566943017826205603956290299910129298589726700292721565513320871031576930809285943446191042007026945145706963385419521277601571208503379491200480304910489078359571596307622501134540377100878475810202910188059443398551447401411271192011985935673099472044705074971205559203895085818347347252899195454541511061949049056468259567711373961417054550528811252031\00"
@__const.main.Padrao = [744 x i8] c"10657033040110313383707633929590617421771177415747524052866757517513145040126253363203651046610512919091784809483313289539395071312930792402837778035504342669536569333318628628360538726299182465357723900843545930767029344507915188798683805199979447570514012026636067407680215436127709012409828257793175969121078672855449854373686527107970553484871481495875902432741517939445984755669430178262056039562902999101292985897267002927215655133208710315769308092859434461910420070269451457069633854195212776015712085033794912004803049104890783595715963076225011345403771008784758102029101880594433985514474014112711920119859356730994720447050749712055592038950858183473472528991954545415110619490490564682595677113739614170545505288112520310000071232\00"
@.str = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [744 x i8]
%4 = alloca [744 x i8]
%5 = alloca i8*
store i32 0, i32* %1
store i32 743, i32* %2
%6 = bitcast [744 x i8]* %3 to i8*
%7 = bitcast [744 x i8]* %4 to i8*
%8 = call i64 @calloc(i32 2000, i32 1)
%9 = inttoptr i64 %8 to i8*
store i8* %9, i8** %5
%10 = getelementptr inbounds [744 x i8], [744 x i8]* %3, i64 0, i64 0
%11 = getelementptr inbounds [744 x i8], [744 x i8]* %4, i64 0, i64 0
%12 = load i8*, i8** %5
%13 = load i32, i32* %2
%14 = call i32 @EncontraChave(i8* %10, i8* %11, i8* %12, i32 %13)
%15 = load i8*, i8** %5
%16 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %15)
%17 = load i8*, i8** %5
%18 = call i32 @free(i8* %17)
ret i32 0
}

LLVM IR (-O2):
@__const.main.Texto = [744 x i8] c"12345678901065703304011031338370763392959061742177117741574752405286675751751314504012625336320365104661051291909178480948331328953939507131293079240283777803550434266953656933331862862836053872629918246535772390084354593076702934450791518879868380519997944757051401202663606740768021543612770901240982825779317596912107867285544985437368652710797055348487148149587590243274151793944598475566943017826205603956290299910129298589726700292721565513320871031576930809285943446191042007026945145706963385419521277601571208503379491200480304910489078359571596307622501134540377100878475810202910188059443398551447401411271192011985935673099472044705074971205559203895085818347347252899195454541511061949049056468259567711373961417054550528811252031\00"
@__const.main.Padrao = [744 x i8] c"10657033040110313383707633929590617421771177415747524052866757517513145040126253363203651046610512919091784809483313289539395071312930792402837778035504342669536569333318628628360538726299182465357723900843545930767029344507915188798683805199979447570514012026636067407680215436127709012409828257793175969121078672855449854373686527107970553484871481495875902432741517939445984755669430178262056039562902999101292985897267002927215655133208710315769308092859434461910420070269451457069633854195212776015712085033794912004803049104890783595715963076225011345403771008784758102029101880594433985514474014112711920119859356730994720447050749712055592038950858183473472528991954545415110619490490564682595677113739614170545505288112520310000071232\00"
@.str = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca [744 x i8]
%2 = alloca [744 x i8]
%3 = getelementptr inbounds [744 x i8], [744 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [744 x i8], [744 x i8]* %2, i64 0, i64 0
%5 = tail call i64 @calloc(i32 2000, i32 1)
%6 = inttoptr i64 %5 to i8*
%7 = call i32 @EncontraChave(i8* %3, i8* %4, i8* %6, i32 743)
%8 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %6)
%9 = call i32 @free(i8* %6)
ret i32 0
}