#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
scalar_t__ checkTamTipo(unsigned char *);
int checkTipoTrama(unsigned char *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
scalar_t__ feof(int /*<<< orphan*/ *);
scalar_t__ fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
unsigned int getEthernetType(unsigned char *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ sscanf(unsigned char *, char *, unsigned char *);
int main(void) {
  unsigned char trama[500], z, hex[3];
  unsigned int eth, flag = 0, sync = 0, pos = 0, j;
  FILE *arch = fopen("tramas", "r"), *salida = fopen("analisisTipo", "w");
  if (arch == NULL || salida == NULL) {
    perror("Error [Archivo]");
    return -1;
  }
  hex[2] = '\0';
  while (feof(arch) == 0) {
    z = (char)fgetc(arch);
    if (z != ' ') {
      if (z == '\n') {
        if (flag == 1) {
          trama[pos] = '\0';
          fprintf(salida, "MAC destino:\t");
          for (j = 0; j < 6; j++) {
            fprintf(salida, "%02X", trama[j]);
            if (j < 5)
              fprintf(salida, ":");
          }
          fprintf(salida, "\n");
          fprintf(salida, "MAC origen:\t");
          for (j = 6; j < 12; j++) {
            fprintf(salida, "%02X", trama[j]);
            if (j < 11)
              fprintf(salida, ":");
          }
          fprintf(salida, "\n");
          if (checkTamTipo(trama)) {
            fprintf(salida, "Trama:\t\tIEEE 802.3\n");
            fprintf(salida, "Tamanio:\t%d bytes\n", trama[13]);
            fprintf(salida, "Tipo:\t\t[%c]\n", checkTipoTrama(trama));
          } else {
            eth = getEthernetType(trama);
            fprintf(salida, "Trama:\t\tEthernet\n");
            fprintf(salida, "Ethertype:\t0x%04X = %d ", eth, eth);
            if (eth == 2048)
              fprintf(salida, "(DOD IP)\n");
            else if (eth == 2054)
              fprintf(salida, "(ARP)\n");
          }
          fprintf(salida, "\n");
          pos = 0;
        } else
          flag = 1;
      } else {
        if (sync == 0) {
          hex[sync] = z;
          sync = 1;
        } else {
          hex[sync] = z;
          sscanf(hex, "%2x", &trama[pos]);
          sync = 0;
          pos++;
        }
        flag = 0;
      }
    }
  }
  fprintf(salida, "ww wwnio ww - 2CM9 | ww.com\n");
  fclose(salida);
  fclose(arch);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x230,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x20c(%rbp)
movl   $0x0,-0x210(%rbp)
movl   $0x0,-0x214(%rbp)
lea    0xe29(%rip),%rdi
lea    0xe29(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x220(%rbp)
lea    0xe18(%rip),%rdi
lea    0xe1e(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x228(%rbp)
cmpq   $0x0,-0x220(%rbp)
je     1220 <main+0x80>
cmpq   $0x0,-0x228(%rbp)
jne    1238 <main+0x98>
lea    0xdf1(%rip),%rdi
call   10b0 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    15f7 <main+0x457>
movb   $0x0,-0x202(%rbp)
mov    -0x220(%rbp),%rdi
call   1070 <feof@plt>
cmp    $0x0,%rax
jne    15c3 <main+0x423>
mov    -0x220(%rbp),%rdi
call   1050 <fgetc@plt>
mov    %al,-0x201(%rbp)
movzbl -0x201(%rbp),%eax
cmp    $0x20,%eax
je     15be <main+0x41e>
movzbl -0x201(%rbp),%eax
cmp    $0xa,%eax
jne    1531 <main+0x391>
cmpl   $0x1,-0x20c(%rbp)
jne    1522 <main+0x382>
mov    -0x214(%rbp),%eax
movb   $0x0,-0x200(%rbp,%rax,1)
mov    -0x228(%rbp),%rdi
lea    0xd78(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0x0,-0x218(%rbp)
cmpl   $0x6,-0x218(%rbp)
jae    132c <main+0x18c>
mov    -0x228(%rbp),%rdi
mov    -0x218(%rbp),%eax
movzbl -0x200(%rbp,%rax,1),%edx
ff
lea    0xd4c(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
cmpl   $0x5,-0x218(%rbp)
jae    1313 <main+0x173>
mov    -0x228(%rbp),%rdi
lea    0xd2f(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
jmp    1318 <main+0x178>
mov    -0x218(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x218(%rbp)
jmp    12c1 <main+0x121>
mov    -0x228(%rbp),%rdi
lea    0xd76(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x228(%rbp),%rdi
lea    0xcee(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0x6,-0x218(%rbp)
cmpl   $0xc,-0x218(%rbp)
jae    13cb <main+0x22b>
mov    -0x228(%rbp),%rdi
mov    -0x218(%rbp),%eax
movzbl -0x200(%rbp,%rax,1),%edx
ff
lea    0xcad(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
cmpl   $0xb,-0x218(%rbp)
jae    13b2 <main+0x212>
mov    -0x228(%rbp),%rdi
lea    0xc90(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
jmp    13b7 <main+0x217>
mov    -0x218(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x218(%rbp)
jmp    1360 <main+0x1c0>
mov    -0x228(%rbp),%rdi
lea    0xcd7(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
lea    -0x200(%rbp),%rdi
call   1030 <checkTamTipo@plt>
cmp    $0x0,%rax
je     145d <main+0x2bd>
mov    -0x228(%rbp),%rdi
lea    0xc46(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x228(%rbp),%rdi
movzbl -0x1f3(%rbp),%edx
lea    0xc3e(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x228(%rbp),%rax
mov    %rax,-0x230(%rbp)
lea    -0x200(%rbp),%rdi
call   10c0 <checkTipoTrama@plt>
mov    -0x230(%rbp),%rdi
mov    %eax,%edx
lea    0xc20(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
jmp    14fe <main+0x35e>
lea    -0x200(%rbp),%rdi
call   1090 <getEthernetType@plt>
mov    %eax,-0x208(%rbp)
mov    -0x228(%rbp),%rdi
lea    0xc01(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x228(%rbp),%rdi
mov    -0x208(%rbp),%edx
mov    -0x208(%rbp),%ecx
lea    0xbf2(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
cmpl   $0x800,-0x208(%rbp)
jne    14cf <main+0x32f>
mov    -0x228(%rbp),%rdi
lea    0xbe5(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
jmp    14f9 <main+0x359>
cmpl   $0x806,-0x208(%rbp)
jne    14f4 <main+0x354>
mov    -0x228(%rbp),%rdi
lea    0xbc5(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
jmp    14f9 <main+0x359>
jmp    14fe <main+0x35e>
mov    -0x228(%rbp),%rdi
lea    0xba4(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0x0,-0x214(%rbp)
jmp    152c <main+0x38c>
movl   $0x1,-0x20c(%rbp)
jmp    15b9 <main+0x419>
cmpl   $0x0,-0x210(%rbp)
jne    1560 <main+0x3c0>
mov    -0x201(%rbp),%cl
mov    -0x210(%rbp),%eax
mov    %cl,-0x204(%rbp,%rax,1)
movl   $0x1,-0x210(%rbp)
jmp    15af <main+0x40f>
mov    -0x201(%rbp),%cl
mov    -0x210(%rbp),%eax
mov    %cl,-0x204(%rbp,%rax,1)
lea    -0x204(%rbp),%rdi
mov    -0x214(%rbp),%eax
lea    -0x200(%rbp),%rdx
add    %rax,%rdx
lea    0xb28(%rip),%rsi
call   1080 <sscanf@plt>
movl   $0x0,-0x210(%rbp)
mov    -0x214(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x214(%rbp)
movl   $0x0,-0x20c(%rbp)
jmp    15be <main+0x41e>
jmp    123f <main+0x9f>
mov    -0x228(%rbp),%rdi
lea    0xaec(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x228(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x220(%rbp),%rdi
call   1040 <fclose@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x230,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x208,%rsp
lea    0xe28(%rip),%rdi
lea    0xe28(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,%r14
lea    0xe1b(%rip),%rdi
lea    0xe21(%rip),%rsi
call   10b0 <fopen@plt>
test   %r14,%r14
je     15ad <main+0x3ed>
mov    %rax,%rbx
test   %rax,%rax
je     15ad <main+0x3ed>
movb   $0x0,0xb(%rsp)
mov    %r14,%rdi
call   1080 <feof@plt>
test   %rax,%rax
je     125e <main+0x9e>
lea    0xe93(%rip),%rdi
mov    $0x1c,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   10d0 <fwrite@plt>
mov    %rbx,%rdi
call   1040 <fclose@plt>
mov    %r14,%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
add    $0x208,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xdd1(%rip),%r12
xor    %ebp,%ebp
xor    %r15d,%r15d
movl   $0x0,0xc(%rsp)
jmp    1293 <main+0xd3>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %ebp,%r13d
mov    %r14,%rdi
call   1080 <feof@plt>
mov    %r13d,%ebp
test   %rax,%rax
jne    1221 <main+0x61>
mov    %r14,%rdi
call   1050 <fgetc@plt>
cmp    $0x20,%al
je     1280 <main+0xc0>
cmp    $0xa,%al
jne    14d0 <main+0x310>
mov    $0x1,%r13d
cmp    $0x1,%ebp
jne    1283 <main+0xc3>
mov    %r15d,%eax
movb   $0x0,0x10(%rsp,%rax,1)
mov    $0xd,%esi
mov    $0x1,%edx
lea    0xd5d(%rip),%rdi
mov    %rbx,%rcx
call   10d0 <fwrite@plt>
movzbl 0x10(%rsp),%edx
mov    %rbx,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    $0x3a,%edi
mov    %rbx,%rsi
call   1060 <fputc@plt>
movzbl 0x11(%rsp),%edx
mov    %rbx,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    $0x3a,%edi
mov    %rbx,%rsi
call   1060 <fputc@plt>
movzbl 0x12(%rsp),%edx
mov    %rbx,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    $0x3a,%edi
mov    %rbx,%rsi
call   1060 <fputc@plt>
movzbl 0x13(%rsp),%edx
mov    %rbx,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    $0x3a,%edi
mov    %rbx,%rsi
call   1060 <fputc@plt>
movzbl 0x14(%rsp),%edx
mov    %rbx,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    $0x3a,%edi
mov    %rbx,%rsi
call   1060 <fputc@plt>
movzbl 0x15(%rsp),%edx
mov    %rbx,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    $0xa,%edi
mov    %rbx,%rsi
call   1060 <fputc@plt>
mov    $0xc,%esi
mov    $0x1,%edx
lea    0xc9d(%rip),%rdi
mov    %rbx,%rcx
call   10d0 <fwrite@plt>
movzbl 0x16(%rsp),%edx
mov    %rbx,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    $0x3a,%edi
mov    %rbx,%rsi
call   1060 <fputc@plt>
movzbl 0x17(%rsp),%edx
mov    %rbx,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    $0x3a,%edi
mov    %rbx,%rsi
call   1060 <fputc@plt>
movzbl 0x18(%rsp),%edx
mov    %rbx,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    $0x3a,%edi
mov    %rbx,%rsi
call   1060 <fputc@plt>
movzbl 0x19(%rsp),%edx
mov    %rbx,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    $0x3a,%edi
mov    %rbx,%rsi
call   1060 <fputc@plt>
movzbl 0x1a(%rsp),%edx
mov    %rbx,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    $0x3a,%edi
mov    %rbx,%rsi
call   1060 <fputc@plt>
movzbl 0x1b(%rsp),%edx
mov    %rbx,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    $0xa,%edi
mov    %rbx,%rsi
call   1060 <fputc@plt>
lea    0x10(%rsp),%rbp
mov    %rbp,%rdi
call   1030 <checkTamTipo@plt>
test   %rax,%rax
je     151f <main+0x35f>
mov    $0x13,%esi
mov    $0x1,%edx
lea    0xbc1(%rip),%rdi
mov    %rbx,%rcx
call   10d0 <fwrite@plt>
movzbl 0x1d(%rsp),%edx
mov    %rbx,%rdi
lea    0xbbe(%rip),%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    %rbp,%rdi
call   10e0 <checkTipoTrama@plt>
mov    %rbx,%rdi
lea    0xbb8(%rip),%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1070 <fprintf@plt>
jmp    1598 <main+0x3d8>
cs nopw 0x0(%rax,%rax,1)
nop
cmpl   $0x0,0xc(%rsp)
jne    14eb <main+0x32b>
mov    %al,0x9(%rsp)
xor    %r13d,%r13d
movl   $0x1,0xc(%rsp)
jmp    1283 <main+0xc3>
mov    %al,0xa(%rsp)
mov    %r15d,%eax
lea    (%rsp,%rax,1),%rdx
add    $0x10,%rdx
lea    0x9(%rsp),%rdi
lea    0xbb1(%rip),%rsi
call   1090 <sscanf@plt>
add    $0x1,%r15d
movl   $0x0,0xc(%rsp)
xor    %r13d,%r13d
jmp    1283 <main+0xc3>
mov    %rbp,%rdi
call   10a0 <getEthernetType@plt>
mov    %eax,%r15d
mov    $0x11,%esi
mov    $0x1,%edx
lea    0xb41(%rip),%rdi
mov    %rbx,%rcx
call   10d0 <fwrite@plt>
mov    %rbx,%rdi
lea    0xb41(%rip),%rsi
mov    %r15d,%edx
mov    %r15d,%ecx
xor    %eax,%eax
call   1070 <fprintf@plt>
cmp    $0x806,%r15d
je     157f <main+0x3bf>
cmp    $0x800,%r15d
jne    1598 <main+0x3d8>
mov    $0x9,%esi
mov    $0x1,%edx
lea    0xb29(%rip),%rdi
jmp    1590 <main+0x3d0>
mov    $0x6,%esi
mov    $0x1,%edx
lea    0xb20(%rip),%rdi
mov    %rbx,%rcx
call   10d0 <fwrite@plt>
mov    $0xa,%edi
mov    %rbx,%rsi
call   1060 <fputc@plt>
xor    %r15d,%r15d
jmp    1283 <main+0xc3>
lea    0xa64(%rip),%rdi
call   10c0 <perror@plt>
mov    $0xffffffff,%eax
jmp    124c <main+0x8c>

LLVM IR (-O0):
@.str = [7 x i8] c"tramas\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [13 x i8] c"analisisTipo\00"
@.str.3 = [2 x i8] c"w\00"
@.str.4 = [16 x i8] c"Error [Archivo]\00"
@.str.5 = [14 x i8] c"MAC destino:\09\00"
@.str.6 = [5 x i8] c"%02X\00"
@.str.7 = [2 x i8] c":\00"
@.str.8 = [2 x i8] c"\0A\00"
@.str.9 = [13 x i8] c"MAC origen:\09\00"
@.str.10 = [20 x i8] c"Trama:\09\09IEEE 802.3\0A\00"
@.str.11 = [19 x i8] c"Tamanio:\09%d bytes\0A\00"
@.str.12 = [13 x i8] c"Tipo:\09\09[%c]\0A\00"
@.str.13 = [18 x i8] c"Trama:\09\09Ethernet\0A\00"
@.str.14 = [24 x i8] c"Ethertype:\090x%04X = %d \00"
@.str.15 = [10 x i8] c"(DOD IP)\0A\00"
@.str.16 = [7 x i8] c"(ARP)\0A\00"
@.str.17 = [4 x i8] c"%2x\00"
@.str.18 = [29 x i8] c"ww wwnio ww - 2CM9 | ww.com\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [500 x i8]
%3 = alloca i8
%4 = alloca [3 x i8]
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32*
%11 = alloca i32*
store i32 0, i32* %1
store i32 0, i32* %6
store i32 0, i32* %7
store i32 0, i32* %8
%12 = call i32* @fopen(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %12, i32** %10
%13 = call i32* @fopen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %13, i32** %11
%14 = load i32*, i32** %10
%15 = icmp eq i32* %14, null
br i1 %15, label %19, label %16
16: ; preds = %0
%17 = load i32*, i32** %11
%18 = icmp eq i32* %17, null
br i1 %18, label %19, label %21
19: ; preds = %16, %0
%20 = call i32 @perror(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0))
store i32 -1, i32* %1
br label %167
21: ; preds = %16
%22 = getelementptr inbounds [3 x i8], [3 x i8]* %4, i64 0, i64 2
store i8 0, i8* %22
br label %23
23: ; preds = %159, %21
%24 = load i32*, i32** %10
%25 = call i64 @feof(i32* %24)
%26 = icmp eq i64 %25, 0
br i1 %26, label %27, label %160
27: ; preds = %23
%28 = load i32*, i32** %10
%29 = call i64 @fgetc(i32* %28)
%30 = trunc i64 %29 to i8
store i8 %30, i8* %3
%31 = load i8, i8* %3
%32 = zext i8 %31 to i32
%33 = icmp ne i32 %32, 32
br i1 %33, label %34, label %159
34: ; preds = %27
%35 = load i8, i8* %3
%36 = zext i8 %35 to i32
%37 = icmp eq i32 %36, 10
br i1 %37, label %38, label %137
38: ; preds = %34
%39 = load i32, i32* %6
%40 = icmp eq i32 %39, 1
br i1 %40, label %41, label %135
41: ; preds = %38
%42 = load i32, i32* %8
%43 = zext i32 %42 to i64
%44 = getelementptr inbounds [500 x i8], [500 x i8]* %2, i64 0, i64 %43
store i8 0, i8* %44
%45 = load i32*, i32** %11
%46 = call i32 (i32*, i8*, ...) @fprintf(i32* %45, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0))
store i32 0, i32* %9
br label %47
47: ; preds = %64, %41
%48 = load i32, i32* %9
%49 = icmp ult i32 %48, 6
br i1 %49, label %50, label %67
50: ; preds = %47
%51 = load i32*, i32** %11
%52 = load i32, i32* %9
%53 = zext i32 %52 to i64
%54 = getelementptr inbounds [500 x i8], [500 x i8]* %2, i64 0, i64 %53
%55 = load i8, i8* %54
%56 = zext i8 %55 to i32
%57 = call i32 (i32*, i8*, ...) @fprintf(i32* %51, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 %56)
%58 = load i32, i32* %9
%59 = icmp ult i32 %58, 5
br i1 %59, label %60, label %63
60: ; preds = %50
%61 = load i32*, i32** %11
%62 = call i32 (i32*, i8*, ...) @fprintf(i32* %61, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
br label %63
63: ; preds = %60, %50
br label %64
64: ; preds = %63
%65 = load i32, i32* %9
%66 = add i32 %65, 1
store i32 %66, i32* %9
br label %47
67: ; preds = %47
%68 = load i32*, i32** %11
%69 = call i32 (i32*, i8*, ...) @fprintf(i32* %68, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
%70 = load i32*, i32** %11
%71 = call i32 (i32*, i8*, ...) @fprintf(i32* %70, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.9, i64 0, i64 0))
store i32 6, i32* %9
br label %72
72: ; preds = %89, %67
%73 = load i32, i32* %9
%74 = icmp ult i32 %73, 12
br i1 %74, label %75, label %92
75: ; preds = %72
%76 = load i32*, i32** %11
%77 = load i32, i32* %9
%78 = zext i32 %77 to i64
%79 = getelementptr inbounds [500 x i8], [500 x i8]* %2, i64 0, i64 %78
%80 = load i8, i8* %79
%81 = zext i8 %80 to i32
%82 = call i32 (i32*, i8*, ...) @fprintf(i32* %76, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 %81)
%83 = load i32, i32* %9
%84 = icmp ult i32 %83, 11
br i1 %84, label %85, label %88
85: ; preds = %75
%86 = load i32*, i32** %11
%87 = call i32 (i32*, i8*, ...) @fprintf(i32* %86, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
br label %88
88: ; preds = %85, %75
br label %89
89: ; preds = %88
%90 = load i32, i32* %9
%91 = add i32 %90, 1
store i32 %91, i32* %9
br label %72
92: ; preds = %72
%93 = load i32*, i32** %11
%94 = call i32 (i32*, i8*, ...) @fprintf(i32* %93, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
%95 = getelementptr inbounds [500 x i8], [500 x i8]* %2, i64 0, i64 0
%96 = call i64 @checkTamTipo(i8* %95)
%97 = icmp ne i64 %96, 0
br i1 %97, label %98, label %110
98: ; preds = %92
%99 = load i32*, i32** %11
%100 = call i32 (i32*, i8*, ...) @fprintf(i32* %99, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.10, i64 0, i64 0))
%101 = load i32*, i32** %11
%102 = getelementptr inbounds [500 x i8], [500 x i8]* %2, i64 0, i64 13
%103 = load i8, i8* %102
%104 = zext i8 %103 to i32
%105 = call i32 (i32*, i8*, ...) @fprintf(i32* %101, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.11, i64 0, i64 0), i32 %104)
%106 = load i32*, i32** %11
%107 = getelementptr inbounds [500 x i8], [500 x i8]* %2, i64 0, i64 0
%108 = call i32 @checkTipoTrama(i8* %107)
%109 = call i32 (i32*, i8*, ...) @fprintf(i32* %106, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.12, i64 0, i64 0), i32 %108)
br label %132
110: ; preds = %92
%111 = getelementptr inbounds [500 x i8], [500 x i8]* %2, i64 0, i64 0
%112 = call i32 @getEthernetType(i8* %111)
store i32 %112, i32* %5
%113 = load i32*, i32** %11
%114 = call i32 (i32*, i8*, ...) @fprintf(i32* %113, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.13, i64 0, i64 0))
%115 = load i32*, i32** %11
%116 = load i32, i32* %5
%117 = load i32, i32* %5
%118 = call i32 (i32*, i8*, ...) @fprintf(i32* %115, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.14, i64 0, i64 0), i32 %116, i32 %117)
%119 = load i32, i32* %5
%120 = icmp eq i32 %119, 2048
br i1 %120, label %121, label %124
121: ; preds = %110
%122 = load i32*, i32** %11
%123 = call i32 (i32*, i8*, ...) @fprintf(i32* %122, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.15, i64 0, i64 0))
br label %131
124: ; preds = %110
%125 = load i32, i32* %5
%126 = icmp eq i32 %125, 2054
br i1 %126, label %127, label %130
127: ; preds = %124
%128 = load i32*, i32** %11
%129 = call i32 (i32*, i8*, ...) @fprintf(i32* %128, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.16, i64 0, i64 0))
br label %130
130: ; preds = %127, %124
br label %131
131: ; preds = %130, %121
br label %132
132: ; preds = %131, %98
%133 = load i32*, i32** %11
%134 = call i32 (i32*, i8*, ...) @fprintf(i32* %133, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
store i32 0, i32* %8
br label %136
135: ; preds = %38
store i32 1, i32* %6
br label %136
136: ; preds = %135, %132
br label %158
137: ; preds = %34
%138 = load i32, i32* %7
%139 = icmp eq i32 %138, 0
br i1 %139, label %140, label %145
140: ; preds = %137
%141 = load i8, i8* %3
%142 = load i32, i32* %7
%143 = zext i32 %142 to i64
%144 = getelementptr inbounds [3 x i8], [3 x i8]* %4, i64 0, i64 %143
store i8 %141, i8* %144
store i32 1, i32* %7
br label %157
145: ; preds = %137
%146 = load i8, i8* %3
%147 = load i32, i32* %7
%148 = zext i32 %147 to i64
%149 = getelementptr inbounds [3 x i8], [3 x i8]* %4, i64 0, i64 %148
store i8 %146, i8* %149
%150 = getelementptr inbounds [3 x i8], [3 x i8]* %4, i64 0, i64 0
%151 = load i32, i32* %8
%152 = zext i32 %151 to i64
%153 = getelementptr inbounds [500 x i8], [500 x i8]* %2, i64 0, i64 %152
%154 = call i32 @sscanf(i8* %150, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.17, i64 0, i64 0), i8* %153)
store i32 0, i32* %7
%155 = load i32, i32* %8
%156 = add i32 %155, 1
store i32 %156, i32* %8
br label %157
157: ; preds = %145, %140
store i32 0, i32* %6
br label %158
158: ; preds = %157, %136
br label %159
159: ; preds = %158, %27
br label %23
160: ; preds = %23
%161 = load i32*, i32** %11
%162 = call i32 (i32*, i8*, ...) @fprintf(i32* %161, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.18, i64 0, i64 0))
%163 = load i32*, i32** %11
%164 = call i32 @fclose(i32* %163)
%165 = load i32*, i32** %10
%166 = call i32 @fclose(i32* %165)
store i32 0, i32* %1
br label %167
167: ; preds = %160, %19
%168 = load i32, i32* %1
ret i32 %168
}

LLVM IR (-O2):
@.str = [7 x i8] c"tramas\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [13 x i8] c"analisisTipo\00"
@.str.3 = [2 x i8] c"w\00"
@.str.4 = [16 x i8] c"Error [Archivo]\00"
@.str.5 = [14 x i8] c"MAC destino:\09\00"
@.str.6 = [5 x i8] c"%02X\00"
@.str.9 = [13 x i8] c"MAC origen:\09\00"
@.str.10 = [20 x i8] c"Trama:\09\09IEEE 802.3\0A\00"
@.str.11 = [19 x i8] c"Tamanio:\09%d bytes\0A\00"
@.str.12 = [13 x i8] c"Tipo:\09\09[%c]\0A\00"
@.str.13 = [18 x i8] c"Trama:\09\09Ethernet\0A\00"
@.str.14 = [24 x i8] c"Ethertype:\090x%04X = %d \00"
@.str.15 = [10 x i8] c"(DOD IP)\0A\00"
@.str.16 = [7 x i8] c"(ARP)\0A\00"
@.str.17 = [4 x i8] c"%2x\00"
@.str.18 = [29 x i8] c"ww wwnio ww - 2CM9 | ww.com\0A\00"
define i32 @main() {
%1 = alloca [500 x i8]
%2 = alloca [3 x i8]
%3 = getelementptr inbounds [500 x i8], [500 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [3 x i8], [3 x i8]* %2, i64 0, i64 0
%5 = tail call i32* @fopen(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%6 = tail call i32* @fopen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%7 = icmp eq i32* %5, null
%8 = icmp eq i32* %6, null
%9 = or i1 %7, %8
br i1 %9, label %10, label %12
10: ; preds = %0
%11 = tail call i32 @perror(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0))
br label %128
12: ; preds = %0
%13 = getelementptr inbounds [3 x i8], [3 x i8]* %2, i64 0, i64 2
store i8 0, i8* %13
%14 = call i64 @feof(i32* %5)
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %124
16: ; preds = %12
%17 = getelementptr inbounds [500 x i8], [500 x i8]* %1, i64 0, i64 13
%18 = getelementptr inbounds [3 x i8], [3 x i8]* %2, i64 0, i64 1
%19 = getelementptr inbounds [500 x i8], [500 x i8]* %1, i64 0, i64 1
%20 = getelementptr inbounds [500 x i8], [500 x i8]* %1, i64 0, i64 2
%21 = getelementptr inbounds [500 x i8], [500 x i8]* %1, i64 0, i64 3
%22 = getelementptr inbounds [500 x i8], [500 x i8]* %1, i64 0, i64 4
%23 = getelementptr inbounds [500 x i8], [500 x i8]* %1, i64 0, i64 5
%24 = getelementptr inbounds [500 x i8], [500 x i8]* %1, i64 0, i64 6
%25 = getelementptr inbounds [500 x i8], [500 x i8]* %1, i64 0, i64 7
%26 = getelementptr inbounds [500 x i8], [500 x i8]* %1, i64 0, i64 8
%27 = getelementptr inbounds [500 x i8], [500 x i8]* %1, i64 0, i64 9
%28 = getelementptr inbounds [500 x i8], [500 x i8]* %1, i64 0, i64 10
%29 = getelementptr inbounds [500 x i8], [500 x i8]* %1, i64 0, i64 11
br label %30
30: ; preds = %16, %118
%31 = phi i32 [ 0, %16 ], [ %121, %118 ]
%32 = phi i32 [ 0, %16 ], [ %120, %118 ]
%33 = phi i32 [ 0, %16 ], [ %119, %118 ]
%34 = call i64 @fgetc(i32* %5)
%35 = trunc i64 %34 to i8
switch i8 %35, label %110 [
i8 32, label %118
i8 10, label %36
]
36: ; preds = %30
%37 = icmp eq i32 %31, 1
br i1 %37, label %38, label %118
38: ; preds = %36
%39 = zext i32 %32 to i64
%40 = getelementptr inbounds [500 x i8], [500 x i8]* %1, i64 0, i64 %39
store i8 0, i8* %40
%41 = call i64 @fwrite(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), i64 13, i64 1, i32* %6)
%42 = load i8, i8* %3
%43 = zext i8 %42 to i32
%44 = call i32 (i32*, i8*, ...) @fprintf(i32* %6, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 %43)
%45 = call i32 @fputc(i32 58, i32* %6)
%46 = load i8, i8* %19
%47 = zext i8 %46 to i32
%48 = call i32 (i32*, i8*, ...) @fprintf(i32* %6, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 %47)
%49 = call i32 @fputc(i32 58, i32* %6)
%50 = load i8, i8* %20
%51 = zext i8 %50 to i32
%52 = call i32 (i32*, i8*, ...) @fprintf(i32* %6, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 %51)
%53 = call i32 @fputc(i32 58, i32* %6)
%54 = load i8, i8* %21
%55 = zext i8 %54 to i32
%56 = call i32 (i32*, i8*, ...) @fprintf(i32* %6, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 %55)
%57 = call i32 @fputc(i32 58, i32* %6)
%58 = load i8, i8* %22
%59 = zext i8 %58 to i32
%60 = call i32 (i32*, i8*, ...) @fprintf(i32* %6, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 %59)
%61 = call i32 @fputc(i32 58, i32* %6)
%62 = load i8, i8* %23
%63 = zext i8 %62 to i32
%64 = call i32 (i32*, i8*, ...) @fprintf(i32* %6, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 %63)
%65 = call i32 @fputc(i32 10, i32* %6)
%66 = call i64 @fwrite(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.9, i64 0, i64 0), i64 12, i64 1, i32* %6)
%67 = load i8, i8* %24
%68 = zext i8 %67 to i32
%69 = call i32 (i32*, i8*, ...) @fprintf(i32* %6, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 %68)
%70 = call i32 @fputc(i32 58, i32* %6)
%71 = load i8, i8* %25
%72 = zext i8 %71 to i32
%73 = call i32 (i32*, i8*, ...) @fprintf(i32* %6, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 %72)
%74 = call i32 @fputc(i32 58, i32* %6)
%75 = load i8, i8* %26
%76 = zext i8 %75 to i32
%77 = call i32 (i32*, i8*, ...) @fprintf(i32* %6, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 %76)
%78 = call i32 @fputc(i32 58, i32* %6)
%79 = load i8, i8* %27
%80 = zext i8 %79 to i32
%81 = call i32 (i32*, i8*, ...) @fprintf(i32* %6, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 %80)
%82 = call i32 @fputc(i32 58, i32* %6)
%83 = load i8, i8* %28
%84 = zext i8 %83 to i32
%85 = call i32 (i32*, i8*, ...) @fprintf(i32* %6, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 %84)
%86 = call i32 @fputc(i32 58, i32* %6)
%87 = load i8, i8* %29
%88 = zext i8 %87 to i32
%89 = call i32 (i32*, i8*, ...) @fprintf(i32* %6, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 %88)
%90 = call i32 @fputc(i32 10, i32* %6)
%91 = call i64 @checkTamTipo(i8* %3)
%92 = icmp eq i64 %91, 0
br i1 %92, label %100, label %93
93: ; preds = %38
%94 = call i64 @fwrite(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.10, i64 0, i64 0), i64 19, i64 1, i32* %6)
%95 = load i8, i8* %17
%96 = zext i8 %95 to i32
%97 = call i32 (i32*, i8*, ...) @fprintf(i32* %6, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.11, i64 0, i64 0), i32 %96)
%98 = call i32 @checkTipoTrama(i8* %3)
%99 = call i32 (i32*, i8*, ...) @fprintf(i32* %6, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.12, i64 0, i64 0), i32 %98)
br label %108
100: ; preds = %38
%101 = call i32 @getEthernetType(i8* %3)
%102 = call i64 @fwrite(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.13, i64 0, i64 0), i64 17, i64 1, i32* %6)
%103 = call i32 (i32*, i8*, ...) @fprintf(i32* %6, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.14, i64 0, i64 0), i32 %101, i32 %101)
switch i32 %101, label %108 [
i32 2048, label %104
i32 2054, label %106
]
104: ; preds = %100
%105 = call i64 @fwrite(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.15, i64 0, i64 0), i64 9, i64 1, i32* %6)
br label %108
106: ; preds = %100
%107 = call i64 @fwrite(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.16, i64 0, i64 0), i64 6, i64 1, i32* %6)
br label %108
108: ; preds = %100, %104, %106, %93
%109 = call i32 @fputc(i32 10, i32* %6)
br label %118
110: ; preds = %30
%111 = icmp eq i32 %33, 0
br i1 %111, label %112, label %113
112: ; preds = %110
store i8 %35, i8* %4
br label %118
113: ; preds = %110
store i8 %35, i8* %18
%114 = zext i32 %32 to i64
%115 = getelementptr inbounds [500 x i8], [500 x i8]* %1, i64 0, i64 %114
%116 = call i32 @sscanf(i8* %4, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.17, i64 0, i64 0), i8* %115)
%117 = add i32 %32, 1
br label %118
118: ; preds = %112, %113, %36, %30, %108
%119 = phi i32 [ %33, %108 ], [ %33, %30 ], [ %33, %36 ], [ 1, %112 ], [ 0, %113 ]
%120 = phi i32 [ 0, %108 ], [ %32, %30 ], [ %32, %36 ], [ %32, %112 ], [ %117, %113 ]
%121 = phi i32 [ 1, %108 ], [ %31, %30 ], [ 1, %36 ], [ 0, %112 ], [ 0, %113 ]
%122 = call i64 @feof(i32* %5)
%123 = icmp eq i64 %122, 0
br i1 %123, label %30, label %124
124: ; preds = %118, %12
%125 = call i64 @fwrite(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.18, i64 0, i64 0), i64 28, i64 1, i32* %6)
%126 = call i32 @fclose(i32* %6)
%127 = call i32 @fclose(i32* %5)
br label %128
128: ; preds = %124, %10
%129 = phi i32 [ -1, %10 ], [ 0, %124 ]
ret i32 %129
}