#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 *, ...);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stderr;
int verifica_sello_digital(char *, char *, int);
int main(int argc, char *argv[]) {
  int res = 0;
  int verbose = 0;
  int i = 0;
  if (argc < 3) {
    fprintf(stderr, "Uso: %s STYLESHEET CFDI [ CFDIs ]\n", argv[0]);
    return 1;
  }
  for (i = 2; i < argc; i++) {
    res = verifica_sello_digital(argv[i], argv[1], verbose);
    if (res) {
      if (argc == 3) {
        fprintf(stderr, "El sello digital del CFDI no coincide.\n");
      } else {
        fprintf(stderr, "%s: El sello digital del CFDI no coincide.\n",
                argv[i]);
      }
    } else {
      if (argc == 3) {
        printf("Ok.\n");
      } else {
        printf("%s: Ok.\n", argv[i]);
      }
    }
  }
  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    118f <main+0x5f>
mov    0x2e74(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe84(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    126f <main+0x13f>
movl   $0x2,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1268 <main+0x138>
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   $0x0,-0x14(%rbp)
je     1219 <main+0xe9>
cmpl   $0x3,-0x8(%rbp)
jne    11f1 <main+0xc1>
mov    0x2e04(%rip),%rax
mov    (%rax),%edi
lea    0xe42(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
jmp    1214 <main+0xe4>
mov    0x2de8(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xe16(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
jmp    1255 <main+0x125>
cmpl   $0x3,-0x8(%rbp)
jne    1236 <main+0x106>
lea    0xe29(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1250 <main+0x120>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xe06(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1255 <main+0x125>
jmp    125a <main+0x12a>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1196 <main+0x66>
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,%rbx
cmp    $0x3,%edi
jge    1177 <main+0x37>
mov    0x2e86(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
lea    0xe9a(%rip),%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    $0x1,%eax
jmp    1219 <main+0xd9>
mov    %edi,%ebp
mov    %edi,%r14d
mov    $0x2,%r15d
mov    0x2e57(%rip),%r12
lea    0xe93(%rip),%r13
jmp    11b7 <main+0x77>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    (%rbx,%r15,8),%rdx
mov    %r13,%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
add    $0x1,%r15
cmp    %r15,%r14
je     1217 <main+0xd7>
mov    (%rbx,%r15,8),%rdi
mov    0x8(%rbx),%rsi
xor    %edx,%edx
call   1040 <verifica_sello_digital@plt>
test   %eax,%eax
je     11f0 <main+0xb0>
mov    (%r12),%edi
cmp    $0x3,%ebp
jne    11a0 <main+0x60>
lea    0xe4d(%rip),%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
jmp    11ae <main+0x6e>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
cmp    $0x3,%ebp
jne    1203 <main+0xc3>
lea    0xe5c(%rip),%rdi
call   1030 <puts@plt>
jmp    11ae <main+0x6e>
mov    (%rbx,%r15,8),%rsi
lea    0xe41(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    11ae <main+0x6e>
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 = [35 x i8] c"Uso: %s STYLESHEET CFDI [ CFDIs ]\0A\00"
@.str.1 = [40 x i8] c"El sello digital del CFDI no coincide.\0A\00"
@.str.2 = [44 x i8] c"%s: El sello digital del CFDI no coincide.\0A\00"
@.str.3 = [5 x i8] c"Ok.\0A\00"
@.str.4 = [9 x i8] c"%s: Ok.\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 (i32, i8*, ...) @fprintf(i32 %12, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8* %15)
store i32 1, i32* %3
br label %68
17: ; preds = %2
store i32 2, i32* %8
br label %18
18: ; preds = %64, %17
%19 = load i32, i32* %8
%20 = load i32, i32* %4
%21 = icmp slt i32 %19, %20
br i1 %21, label %22, label %67
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* %6
%34 = icmp ne i32 %33, 0
br i1 %34, label %35, label %50
35: ; preds = %22
%36 = load i32, i32* %4
%37 = icmp eq i32 %36, 3
br i1 %37, label %38, label %41
38: ; preds = %35
%39 = load i32, i32* @stderr
%40 = call i32 (i32, i8*, ...) @fprintf(i32 %39, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0))
br label %49
41: ; preds = %35
%42 = load i32, i32* @stderr
%43 = load i8**, i8*** %5
%44 = load i32, i32* %8
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds i8*, i8** %43, i64 %45
%47 = load i8*, i8** %46
%48 = call i32 (i32, i8*, ...) @fprintf(i32 %42, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.2, i64 0, i64 0), i8* %47)
br label %49
49: ; preds = %41, %38
br label %63
50: ; preds = %22
%51 = load i32, i32* %4
%52 = icmp eq i32 %51, 3
br i1 %52, label %53, label %55
53: ; preds = %50
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
br label %62
55: ; preds = %50
%56 = load i8**, i8*** %5
%57 = load i32, i32* %8
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds i8*, i8** %56, i64 %58
%60 = load i8*, i8** %59
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i8* %60)
br label %62
62: ; preds = %55, %53
br label %63
63: ; preds = %62, %49
br label %64
64: ; preds = %63
%65 = load i32, i32* %8
%66 = add nsw i32 %65, 1
store i32 %66, i32* %8
br label %18
67: ; preds = %18
store i32 0, i32* %3
br label %68
68: ; preds = %67, %11
%69 = load i32, i32* %3
ret i32 %69
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [35 x i8] c"Uso: %s STYLESHEET CFDI [ CFDIs ]\0A\00"
@.str.1 = [40 x i8] c"El sello digital del CFDI no coincide.\0A\00"
@.str.2 = [44 x i8] c"%s: El sello digital del CFDI no coincide.\0A\00"
@.str.4 = [9 x i8] c"%s: Ok.\0A\00"
@str = [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 (i32, i8*, ...) @fprintf(i32 %9, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8* %10)
br label %35
12: ; preds = %4, %32
%13 = phi i64 [ 2, %4 ], [ %33, %32 ]
%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)
%18 = icmp eq i32 %17, 0
br i1 %18, label %26, label %19
19: ; preds = %12
%20 = load i32, i32* @stderr
br i1 %6, label %21, label %23
21: ; preds = %19
%22 = tail call i32 (i32, i8*, ...) @fprintf(i32 %20, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0))
br label %32
23: ; preds = %19
%24 = load i8*, i8** %14
%25 = tail call i32 (i32, i8*, ...) @fprintf(i32 %20, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.2, i64 0, i64 0), i8* %24)
br label %32
26: ; preds = %12
br i1 %6, label %27, label %29
27: ; preds = %26
%28 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str, i64 0, i64 0))
br label %32
29: ; preds = %26
%30 = load i8*, i8** %14
%31 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i8* %30)
br label %32
32: ; preds = %23, %21, %29, %27
%33 = add nuw nsw i64 %13, 1
%34 = icmp eq i64 %33, %7
br i1 %34, label %35, label %12
35: ; preds = %32, %8
%36 = phi i32 [ 1, %8 ], [ 0, %32 ]
ret i32 %36
}