#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*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stderr;
int verifica_sello_digital(char *, char *, int);
int main(int argc, char *argv[]) {
  int result = 0;
  int debug = 0;
  int i = 0;
  if (argc < 3) {
    fprintf(stderr,
            "Uso:\n\n\t%s RUTA-DEL-ARCHIVO-DE-LA-CADENAORIGINAL CFDi(s)\n\n",
            argv[0]);
    return 1;
  }
  for (i = 2; i < argc; i++) {
    result = verifica_sello_digital(argv[i], argv[1], debug);
    if (argc > 3)
      printf("%s: ", argv[i]);
    if (result == 0)
      printf("Ok.\n");
    else if (result == 1)
      printf("Sello digital en el documento no válido.\n");
    else
      printf("No fue posible realizar el test.\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)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    118d <main+0x5d>
mov    0x2e74(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe84(%rip),%rsi
call   1050 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    124a <main+0x11a>
movl   $0x2,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1243 <main+0x113>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
mov    -0x18(%rbp),%edx
call   1030 <verifica_sello_digital@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x3,-0x8(%rbp)
jle    11e3 <main+0xb3>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xe5e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
cmpl   $0x0,-0x14(%rbp)
jne    1200 <main+0xd0>
lea    0xe4b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1230 <main+0x100>
cmpl   $0x1,-0x14(%rbp)
jne    121d <main+0xed>
lea    0xe33(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    122b <main+0xfb>
lea    0xe4b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1230 <main+0x100>
jmp    1235 <main+0x105>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1194 <main+0x64>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r13
cmp    $0x3,%edi
jge    1173 <main+0x33>
mov    0x2e86(%rip),%rax
mov    (%rax),%edi
mov    0x0(%r13),%rdx
lea    0xe99(%rip),%rsi
call   1060 <fprintf@plt>
mov    $0x1,%eax
jmp    11e6 <main+0xa6>
mov    %edi,%r15d
mov    %edi,%r12d
mov    $0x2,%ebx
lea    0xf05(%rip),%r14
jmp    11a4 <main+0x64>
nopw   0x0(%rax,%rax,1)
test   %ebp,%ebp
cmove  %r14,%rdi
call   1030 <puts@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
je     11e4 <main+0xa4>
mov    0x0(%r13,%rbx,8),%rdi
mov    0x8(%r13),%rsi
xor    %edx,%edx
call   1040 <verifica_sello_digital@plt>
mov    %eax,%ebp
cmp    $0x3,%r15d
je     11cf <main+0x8f>
mov    0x0(%r13,%rbx,8),%rsi
lea    0xe72(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe8a(%rip),%rdi
cmp    $0x1,%ebp
je     1190 <main+0x50>
lea    0xe5d(%rip),%rdi
jmp    1190 <main+0x50>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [58 x i8] c"Uso:\0A\0A\09%s RUTA-DEL-ARCHIVO-DE-LA-CADENAORIGINAL CFDi(s)\0A\0A\00"
@.str.1 = [5 x i8] c"%s: \00"
@.str.2 = [5 x i8] c"Ok.\0A\00"
@.str.3 = [43 x i8] c"Sello digital en el documento no v\C3\A1lido.\0A\00"
@.str.4 = [34 x i8] c"No fue posible realizar el test.\0A\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
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
store i32 0, i32* %7
store i32 0, i32* %8
%9 = load i32, i32* %4
%10 = icmp slt i32 %9, 3
br i1 %10, label %11, label %17
11: ; preds = %2
%12 = load i32, i32* @stderr
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 0
%15 = load i8*, i8** %14
%16 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str, i64 0, i64 0), i8* %15)
store i32 1, i32* %3
br label %60
17: ; preds = %2
store i32 2, i32* %8
br label %18
18: ; preds = %56, %17
%19 = load i32, i32* %8
%20 = load i32, i32* %4
%21 = icmp slt i32 %19, %20
br i1 %21, label %22, label %59
22: ; preds = %18
%23 = load i8**, i8*** %5
%24 = load i32, i32* %8
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i8*, i8** %23, i64 %25
%27 = load i8*, i8** %26
%28 = load i8**, i8*** %5
%29 = getelementptr inbounds i8*, i8** %28, i64 1
%30 = load i8*, i8** %29
%31 = load i32, i32* %7
%32 = call i32 @verifica_sello_digital(i8* %27, i8* %30, i32 %31)
store i32 %32, i32* %6
%33 = load i32, i32* %4
%34 = icmp sgt i32 %33, 3
br i1 %34, label %35, label %42
35: ; preds = %22
%36 = load i8**, i8*** %5
%37 = load i32, i32* %8
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds i8*, i8** %36, i64 %38
%40 = load i8*, i8** %39
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %40)
br label %42
42: ; preds = %35, %22
%43 = load i32, i32* %6
%44 = icmp eq i32 %43, 0
br i1 %44, label %45, label %47
45: ; preds = %42
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %55
47: ; preds = %42
%48 = load i32, i32* %6
%49 = icmp eq i32 %48, 1
br i1 %49, label %50, label %52
50: ; preds = %47
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.3, i64 0, i64 0))
br label %54
52: ; preds = %47
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0))
br label %54
54: ; preds = %52, %50
br label %55
55: ; preds = %54, %45
br label %56
56: ; preds = %55
%57 = load i32, i32* %8
%58 = add nsw i32 %57, 1
store i32 %58, i32* %8
br label %18
59: ; preds = %18
store i32 0, i32* %3
br label %60
60: ; preds = %59, %11
%61 = load i32, i32* %3
ret i32 %61
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [58 x i8] c"Uso:\0A\0A\09%s RUTA-DEL-ARCHIVO-DE-LA-CADENAORIGINAL CFDi(s)\0A\0A\00"
@.str.1 = [5 x i8] c"%s: \00"
@str = [33 x i8] c"No fue posible realizar el test.\00"
@str.5 = [42 x i8] c"Sello digital en el documento no v\C3\A1lido.\00"
@str.6 = [4 x i8] c"Ok.\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 3
br i1 %3, label %8, label %4
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = icmp eq i32 %0, 3
%7 = zext i32 %0 to i64
br label %12
8: ; preds = %2
%9 = load i32, i32* @stderr
%10 = load i8*, i8** %1
%11 = tail call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str, i64 0, i64 0), i8* %10)
br label %29
12: ; preds = %4, %21
%13 = phi i64 [ 2, %4 ], [ %27, %21 ]
%14 = getelementptr inbounds i8*, i8** %1, i64 %13
%15 = load i8*, i8** %14
%16 = load i8*, i8** %5
%17 = tail call i32 @verifica_sello_digital(i8* %15, i8* %16, i32 0)
br i1 %6, label %21, label %18
18: ; preds = %12
%19 = load i8*, i8** %14
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %19)
br label %21
21: ; preds = %18, %12
%22 = icmp eq i32 %17, 1
%23 = select i1 %22, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @str.5, i64 0, i64 0), i8* getelementptr inbounds ([33 x i8], [33 x i8]* @str, i64 0, i64 0)
%24 = icmp eq i32 %17, 0
%25 = select i1 %24, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @str.6, i64 0, i64 0), i8* %23
%26 = tail call i32 @puts(i8* dereferenceable(1) %25)
%27 = add nuw nsw i64 %13, 1
%28 = icmp eq i64 %27, %7
br i1 %28, label %29, label %12
29: ; preds = %21, %8
%30 = phi i32 [ 1, %8 ], [ 0, %21 ]
ret i32 %30
}