#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 *);
char 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 getNr(unsigned int, char *);
int getNs(unsigned int, char *);
int /*<<< orphan*/ getwwdenRespuestaTramaU(unsigned char, unsigned char,
                                           char *);
int /*<<< orphan*/ getwwdenTramaS(unsigned char, char *);
int /*<<< orphan*/ memset(char *, char, int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ sscanf(unsigned char *, char *, unsigned char *);
int /*<<< orphan*/ strlen(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("analisisTramas", "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) {
          unsigned char pfBit = trama[15] & 1;
          unsigned int tamanio = (trama[12] << 8) | trama[13];
          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)) {
            char tipoTrama = checkTipoTrama(trama), ordenwwRespuesta[6];
            fprintf(salida, "Trama:\t\tIEEE 802.3\n");
            fprintf(salida, "Tamanio:\t%d bytes\n", tamanio);
            if (tipoTrama == 'U') {
              getwwdenRespuestaTramaU(pfBit, trama[16], ordenwwRespuesta);
              fprintf(salida, "Tipo:\t\t%c - %s\n", tipoTrama,
                      ordenwwRespuesta);
              memset(ordenwwRespuesta, '\0', strlen(ordenwwRespuesta));
            } else if (tipoTrama == 'S') {
              fprintf(salida, "N(r): \t\t%u\n",
                      getNr(tamanio, ordenwwRespuesta));
              getwwdenTramaS(trama[16], ordenwwRespuesta);
              fprintf(salida, "Tipo:\t\t%c - %s\n", tipoTrama,
                      ordenwwRespuesta);
              memset(ordenwwRespuesta, '\0', strlen(ordenwwRespuesta));
            } else {
              fprintf(salida, "N(r): \t\t%u\n",
                      getNr(tamanio, ordenwwRespuesta));
              fprintf(salida, "N(s): \t\t%u\n",
                      getNs(tamanio, ordenwwRespuesta));
              fprintf(salida, "Tipo:\t\t%c\n", tipoTrama);
            }
          } 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");
          }
          if (pfBit == 0)
            fprintf(salida, "P/F:\t\t[P]\n");
          else if (pfBit == 1)
            fprintf(salida, "P/F:\t\t[F]\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    $0x260,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x20c(%rbp)
movl   $0x0,-0x210(%rbp)
movl   $0x0,-0x214(%rbp)
lea    0xdc9(%rip),%rdi
lea    0xdc9(%rip),%rsi
call   10f0 <fopen@plt>
mov    %rax,-0x220(%rbp)
lea    0xdb8(%rip),%rdi
lea    0xdc0(%rip),%rsi
call   10f0 <fopen@plt>
mov    %rax,-0x228(%rbp)
cmpq   $0x0,-0x220(%rbp)
je     1280 <main+0x80>
cmpq   $0x0,-0x228(%rbp)
jne    1298 <main+0x98>
lea    0xd93(%rip),%rdi
call   1100 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1863 <main+0x663>
movb   $0x0,-0x202(%rbp)
mov    -0x220(%rbp),%rdi
call   10a0 <feof@plt>
cmp    $0x0,%rax
jne    182f <main+0x62f>
mov    -0x220(%rbp),%rdi
call   1070 <fgetc@plt>
mov    %al,-0x201(%rbp)
movzbl -0x201(%rbp),%eax
cmp    $0x20,%eax
je     182a <main+0x62a>
movzbl -0x201(%rbp),%eax
cmp    $0xa,%eax
jne    179d <main+0x59d>
cmpl   $0x1,-0x20c(%rbp)
jne    178e <main+0x58e>
movzbl -0x1f1(%rbp),%eax
and    $0x1,%eax
mov    %al,-0x229(%rbp)
movzbl -0x1f4(%rbp),%eax
shl    $0x8,%eax
movzbl -0x1f3(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0x230(%rbp)
mov    -0x228(%rbp),%rdi
lea    0xcff(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
movl   $0x0,-0x218(%rbp)
cmpl   $0x6,-0x218(%rbp)
jae    13a7 <main+0x1a7>
mov    -0x228(%rbp),%rdi
mov    -0x218(%rbp),%eax
movzbl -0x200(%rbp,%rax,1),%edx
ff
lea    0xcd3(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
cmpl   $0x5,-0x218(%rbp)
jae    138e <main+0x18e>
mov    -0x228(%rbp),%rdi
lea    0xcb6(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
jmp    1393 <main+0x193>
mov    -0x218(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x218(%rbp)
jmp    133c <main+0x13c>
mov    -0x228(%rbp),%rdi
lea    0xd23(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x228(%rbp),%rdi
lea    0xc75(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
movl   $0x6,-0x218(%rbp)
cmpl   $0xc,-0x218(%rbp)
jae    1446 <main+0x246>
mov    -0x228(%rbp),%rdi
mov    -0x218(%rbp),%eax
movzbl -0x200(%rbp,%rax,1),%edx
ff
lea    0xc34(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
cmpl   $0xb,-0x218(%rbp)
jae    142d <main+0x22d>
mov    -0x228(%rbp),%rdi
lea    0xc17(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
jmp    1432 <main+0x232>
mov    -0x218(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x218(%rbp)
jmp    13db <main+0x1db>
mov    -0x228(%rbp),%rdi
lea    0xc84(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
lea    -0x200(%rbp),%rdi
call   1030 <checkTamTipo@plt>
cmp    $0x0,%rax
je     1675 <main+0x475>
lea    -0x200(%rbp),%rdi
call   1120 <checkTipoTrama@plt>
mov    %al,-0x231(%rbp)
mov    -0x228(%rbp),%rdi
lea    0xbbb(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x228(%rbp),%rdi
mov    -0x230(%rbp),%edx
lea    0xbb4(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
movsbl -0x231(%rbp),%eax
cmp    $0x55,%eax
jne    1533 <main+0x333>
mov    -0x229(%rbp),%cl
mov    -0x1f0(%rbp),%al
lea    -0x237(%rbp),%rdx
movzbl %cl,%edi
movzbl %al,%esi
call   10d0 <getwwdenRespuestaTramaU@plt>
mov    -0x228(%rbp),%rdi
movsbl -0x231(%rbp),%edx
lea    -0x237(%rbp),%rcx
lea    0xb76(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
lea    -0x237(%rbp),%rax
mov    %rax,-0x240(%rbp)
lea    -0x237(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x240(%rbp),%rdi
mov    %eax,%edx
xor    %esi,%esi
call   1060 <memset@plt>
jmp    1670 <main+0x470>
movsbl -0x231(%rbp),%eax
cmp    $0x53,%eax
jne    15e1 <main+0x3e1>
mov    -0x228(%rbp),%rax
mov    %rax,-0x250(%rbp)
mov    -0x230(%rbp),%edi
lea    -0x237(%rbp),%rsi
call   1110 <getNr@plt>
mov    -0x250(%rbp),%rdi
mov    %eax,%edx
lea    0xb10(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x1f0(%rbp),%al
lea    -0x237(%rbp),%rsi
movzbl %al,%edi
call   10b0 <getwwdenTramaS@plt>
mov    -0x228(%rbp),%rdi
movsbl -0x231(%rbp),%edx
lea    -0x237(%rbp),%rcx
lea    0xac8(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
lea    -0x237(%rbp),%rax
mov    %rax,-0x248(%rbp)
lea    -0x237(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x248(%rbp),%rdi
mov    %eax,%edx
xor    %esi,%esi
call   1060 <memset@plt>
jmp    166b <main+0x46b>
mov    -0x228(%rbp),%rax
mov    %rax,-0x260(%rbp)
mov    -0x230(%rbp),%edi
lea    -0x237(%rbp),%rsi
call   1110 <getNr@plt>
mov    -0x260(%rbp),%rdi
mov    %eax,%edx
lea    0xa72(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x228(%rbp),%rax
mov    %rax,-0x258(%rbp)
mov    -0x230(%rbp),%edi
lea    -0x237(%rbp),%rsi
call   1080 <getNs@plt>
mov    -0x258(%rbp),%rdi
mov    %eax,%edx
lea    0xa47(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x228(%rbp),%rdi
movsbl -0x231(%rbp),%edx
lea    0xa37(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
jmp    1670 <main+0x470>
jmp    1716 <main+0x516>
lea    -0x200(%rbp),%rdi
call   10e0 <getEthernetType@plt>
mov    %eax,-0x208(%rbp)
mov    -0x228(%rbp),%rdi
lea    0xa11(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x228(%rbp),%rdi
mov    -0x208(%rbp),%edx
mov    -0x208(%rbp),%ecx
lea    0xa02(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
cmpl   $0x800,-0x208(%rbp)
jne    16e7 <main+0x4e7>
mov    -0x228(%rbp),%rdi
lea    0x9f5(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
jmp    1711 <main+0x511>
cmpl   $0x806,-0x208(%rbp)
jne    170c <main+0x50c>
mov    -0x228(%rbp),%rdi
lea    0x9d5(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
jmp    1711 <main+0x511>
jmp    1716 <main+0x516>
movzbl -0x229(%rbp),%eax
cmp    $0x0,%eax
jne    1740 <main+0x540>
mov    -0x228(%rbp),%rdi
lea    0x9ad(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
jmp    176a <main+0x56a>
movzbl -0x229(%rbp),%eax
cmp    $0x1,%eax
jne    1765 <main+0x565>
mov    -0x228(%rbp),%rdi
lea    0x98e(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
jmp    176a <main+0x56a>
mov    -0x228(%rbp),%rdi
lea    0x960(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
movl   $0x0,-0x214(%rbp)
jmp    1798 <main+0x598>
movl   $0x1,-0x20c(%rbp)
jmp    1825 <main+0x625>
cmpl   $0x0,-0x210(%rbp)
jne    17cc <main+0x5cc>
mov    -0x201(%rbp),%cl
mov    -0x210(%rbp),%eax
mov    %cl,-0x204(%rbp,%rax,1)
movl   $0x1,-0x210(%rbp)
jmp    181b <main+0x61b>
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    0x8fa(%rip),%rsi
call   10c0 <sscanf@plt>
movl   $0x0,-0x210(%rbp)
mov    -0x214(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x214(%rbp)
movl   $0x0,-0x20c(%rbp)
jmp    182a <main+0x62a>
jmp    129f <main+0x9f>
mov    -0x228(%rbp),%rdi
lea    0x8be(%rip),%rsi
mov    $0x0,%al
call   1090 <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    $0x260,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x218,%rsp
lea    0xdc8(%rip),%rdi
lea    0xdc8(%rip),%rsi
call   1100 <fopen@plt>
mov    %rax,%r14
lea    0xdbb(%rip),%rdi
lea    0xdc3(%rip),%rsi
call   1100 <fopen@plt>
test   %r14,%r14
je     176d <main+0x54d>
mov    %rax,%rbx
test   %rax,%rax
je     176d <main+0x54d>
movb   $0x0,0xf(%rsp)
mov    %r14,%rdi
call   10b0 <feof@plt>
test   %rax,%rax
je     12be <main+0x9e>
lea    0xe71(%rip),%rdi
mov    $0x1c,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1120 <fwrite@plt>
mov    %rbx,%rdi
call   1040 <fclose@plt>
mov    %r14,%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
add    $0x218,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xd73(%rip),%r12
xor    %ebp,%ebp
movl   $0x0,0x10(%rsp)
xor    %r13d,%r13d
jmp    12f3 <main+0xd3>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %ebp,%r15d
mov    %r14,%rdi
call   10b0 <feof@plt>
mov    %r15d,%ebp
test   %rax,%rax
jne    1281 <main+0x61>
mov    %r14,%rdi
call   1070 <fgetc@plt>
cmp    $0x20,%al
je     12e0 <main+0xc0>
cmp    $0xa,%al
jne    1590 <main+0x370>
mov    $0x1,%r15d
cmp    $0x1,%ebp
jne    12e3 <main+0xc3>
movzbl 0x2f(%rsp),%ebp
movzwl 0x2c(%rsp),%r13d
mov    $0xd,%esi
mov    $0x1,%edx
lea    0xcfc(%rip),%rdi
mov    %rbx,%rcx
call   1120 <fwrite@plt>
movzbl 0x20(%rsp),%edx
mov    %rbx,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   10a0 <fprintf@plt>
mov    $0x3a,%edi
mov    %rbx,%rsi
call   1090 <fputc@plt>
movzbl 0x21(%rsp),%edx
mov    %rbx,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   10a0 <fprintf@plt>
mov    $0x3a,%edi
mov    %rbx,%rsi
call   1090 <fputc@plt>
movzbl 0x22(%rsp),%edx
mov    %rbx,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   10a0 <fprintf@plt>
mov    $0x3a,%edi
mov    %rbx,%rsi
call   1090 <fputc@plt>
movzbl 0x23(%rsp),%edx
mov    %rbx,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   10a0 <fprintf@plt>
mov    $0x3a,%edi
mov    %rbx,%rsi
call   1090 <fputc@plt>
movzbl 0x24(%rsp),%edx
mov    %rbx,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   10a0 <fprintf@plt>
mov    $0x3a,%edi
mov    %rbx,%rsi
call   1090 <fputc@plt>
movzbl 0x25(%rsp),%edx
mov    %rbx,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   10a0 <fprintf@plt>
mov    $0xa,%edi
mov    %rbx,%rsi
call   1090 <fputc@plt>
mov    $0xc,%esi
mov    $0x1,%edx
lea    0xc3c(%rip),%rdi
mov    %rbx,%rcx
call   1120 <fwrite@plt>
movzbl 0x26(%rsp),%edx
mov    %rbx,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   10a0 <fprintf@plt>
mov    $0x3a,%edi
mov    %rbx,%rsi
call   1090 <fputc@plt>
movzbl 0x27(%rsp),%edx
mov    %rbx,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   10a0 <fprintf@plt>
mov    $0x3a,%edi
mov    %rbx,%rsi
call   1090 <fputc@plt>
movzbl 0x28(%rsp),%edx
mov    %rbx,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   10a0 <fprintf@plt>
mov    $0x3a,%edi
mov    %rbx,%rsi
call   1090 <fputc@plt>
movzbl 0x29(%rsp),%edx
mov    %rbx,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   10a0 <fprintf@plt>
mov    $0x3a,%edi
mov    %rbx,%rsi
call   1090 <fputc@plt>
movzbl 0x2a(%rsp),%edx
mov    %rbx,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   10a0 <fprintf@plt>
mov    $0x3a,%edi
mov    %rbx,%rsi
call   1090 <fputc@plt>
movzbl 0x2b(%rsp),%edx
mov    %rbx,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   10a0 <fprintf@plt>
and    $0x1,%bpl
mov    %bpl,0xc(%rsp)
mov    $0xa,%edi
mov    %rbx,%rsi
call   1090 <fputc@plt>
lea    0x20(%rsp),%rbp
mov    %rbp,%rdi
call   1030 <checkTamTipo@plt>
test   %rax,%rax
je     15df <main+0x3bf>
shl    $0x10,%r13d
bswap  %r13d
mov    %rbp,%rdi
call   1140 <checkTipoTrama@plt>
mov    %eax,%ebp
mov    $0x13,%esi
mov    $0x1,%edx
lea    0xb46(%rip),%rdi
mov    %rbx,%rcx
call   1120 <fwrite@plt>
mov    %rbx,%rdi
lea    0xb48(%rip),%rsi
mov    %r13d,%edx
xor    %eax,%eax
call   10a0 <fprintf@plt>
cmp    $0x53,%bpl
je     1653 <main+0x433>
cmp    $0x55,%bpl
jne    16b2 <main+0x492>
movzbl 0x30(%rsp),%esi
movzbl 0xc(%rsp),%r13d
movzbl %r13b,%edi
lea    0x1a(%rsp),%rbp
mov    %rbp,%rdx
call   10e0 <getwwdenRespuestaTramaU@plt>
mov    %rbx,%rdi
lea    0xb17(%rip),%rsi
mov    $0x55,%edx
mov    %rbp,%rcx
xor    %eax,%eax
call   10a0 <fprintf@plt>
mov    %rbp,%rdi
call   1050 <strlen@plt>
mov    %rbp,%rdi
xor    %esi,%esi
mov    %eax,%edx
call   1060 <memset@plt>
jmp    1731 <main+0x511>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
cmpl   $0x0,0x10(%rsp)
jne    15ab <main+0x38b>
mov    %al,0xd(%rsp)
xor    %r15d,%r15d
movl   $0x1,0x10(%rsp)
jmp    12e3 <main+0xc3>
mov    %al,0xe(%rsp)
mov    %r13d,%eax
lea    (%rsp,%rax,1),%rdx
add    $0x20,%rdx
lea    0xd(%rsp),%rdi
lea    0xb2f(%rip),%rsi
call   10d0 <sscanf@plt>
add    $0x1,%r13d
movl   $0x0,0x10(%rsp)
xor    %r15d,%r15d
jmp    12e3 <main+0xc3>
mov    %rbp,%rdi
call   10f0 <getEthernetType@plt>
mov    %eax,%ebp
mov    $0x11,%esi
mov    $0x1,%edx
lea    0xaaa(%rip),%rdi
mov    %rbx,%rcx
call   1120 <fwrite@plt>
mov    %rbx,%rdi
lea    0xaaa(%rip),%rsi
mov    %ebp,%edx
mov    %ebp,%ecx
xor    %eax,%eax
call   10a0 <fprintf@plt>
cmp    $0x806,%ebp
je     1712 <main+0x4f2>
cmp    $0x800,%ebp
movzbl 0xc(%rsp),%r13d
jne    1731 <main+0x511>
mov    $0x9,%esi
mov    $0x1,%edx
lea    0xa88(%rip),%rdi
mov    %rbx,%rcx
call   1120 <fwrite@plt>
jmp    1731 <main+0x511>
mov    %r13d,%edi
lea    0x1a(%rsp),%rbp
mov    %rbp,%rsi
call   1130 <getNr@plt>
mov    %rbx,%rdi
lea    0xa14(%rip),%rsi
mov    %eax,%edx
xor    %eax,%eax
call   10a0 <fprintf@plt>
movzbl 0x30(%rsp),%edi
mov    %rbp,%rsi
call   10c0 <getwwdenTramaS@plt>
mov    %rbx,%rdi
lea    0x9e4(%rip),%rsi
mov    $0x53,%edx
mov    %rbp,%rcx
xor    %eax,%eax
call   10a0 <fprintf@plt>
mov    %rbp,%rdi
call   1050 <strlen@plt>
mov    %rbp,%rdi
xor    %esi,%esi
mov    %eax,%edx
call   1060 <memset@plt>
jmp    172b <main+0x50b>
movsbl %bpl,%eax
mov    %eax,0x14(%rsp)
mov    %r13d,%edi
lea    0x1a(%rsp),%rbp
mov    %rbp,%rsi
call   1130 <getNr@plt>
mov    %rbx,%rdi
lea    0x9ad(%rip),%rsi
mov    %eax,%edx
xor    %eax,%eax
call   10a0 <fprintf@plt>
mov    %r13d,%edi
mov    %rbp,%rsi
call   1080 <getNs@plt>
mov    %rbx,%rdi
lea    0x99b(%rip),%rsi
mov    %eax,%edx
xor    %eax,%eax
call   10a0 <fprintf@plt>
mov    %rbx,%rdi
lea    0x994(%rip),%rsi
mov    0x14(%rsp),%edx
xor    %eax,%eax
call   10a0 <fprintf@plt>
jmp    172b <main+0x50b>
mov    $0x6,%esi
mov    $0x1,%edx
lea    0x9b5(%rip),%rdi
mov    %rbx,%rcx
call   1120 <fwrite@plt>
movzbl 0xc(%rsp),%r13d
test   %r13b,%r13b
lea    0x9af(%rip),%rdi
lea    0x99d(%rip),%rax
cmove  %rax,%rdi
mov    $0xa,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1120 <fwrite@plt>
mov    $0xa,%edi
mov    %rbx,%rsi
call   1090 <fputc@plt>
xor    %r13d,%r13d
jmp    12e3 <main+0xc3>
lea    0x8a6(%rip),%rdi
call   1110 <perror@plt>
mov    $0xffffffff,%eax
jmp    12ac <main+0x8c>

LLVM IR (-O0):
@.str = [7 x i8] c"tramas\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [15 x i8] c"analisisTramas\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 = [16 x i8] c"Tipo:\09\09%c - %s\0A\00"
@.str.13 = [12 x i8] c"N(r): \09\09%u\0A\00"
@.str.14 = [12 x i8] c"N(s): \09\09%u\0A\00"
@.str.15 = [11 x i8] c"Tipo:\09\09%c\0A\00"
@.str.16 = [18 x i8] c"Trama:\09\09Ethernet\0A\00"
@.str.17 = [24 x i8] c"Ethertype:\090x%04X = %d \00"
@.str.18 = [10 x i8] c"(DOD IP)\0A\00"
@.str.19 = [7 x i8] c"(ARP)\0A\00"
@.str.20 = [11 x i8] c"P/F:\09\09[P]\0A\00"
@.str.21 = [11 x i8] c"P/F:\09\09[F]\0A\00"
@.str.22 = [4 x i8] c"%2x\00"
@.str.23 = [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*
%12 = alloca i8
%13 = alloca i32
%14 = alloca i8
%15 = alloca [6 x i8]
store i32 0, i32* %1
store i32 0, i32* %6
store i32 0, i32* %7
store i32 0, i32* %8
%16 = 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* %16, i32** %10
%17 = call i32* @fopen(i8* getelementptr inbounds ([15 x i8], [15 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* %17, i32** %11
%18 = load i32*, i32** %10
%19 = icmp eq i32* %18, null
br i1 %19, label %23, label %20
20: ; preds = %0
%21 = load i32*, i32** %11
%22 = icmp eq i32* %21, null
br i1 %22, label %23, label %25
23: ; preds = %20, %0
%24 = 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 %250
25: ; preds = %20
%26 = getelementptr inbounds [3 x i8], [3 x i8]* %4, i64 0, i64 2
store i8 0, i8* %26
br label %27
27: ; preds = %242, %25
%28 = load i32*, i32** %10
%29 = call i64 @feof(i32* %28)
%30 = icmp eq i64 %29, 0
br i1 %30, label %31, label %243
31: ; preds = %27
%32 = load i32*, i32** %10
%33 = call i64 @fgetc(i32* %32)
%34 = trunc i64 %33 to i8
store i8 %34, i8* %3
%35 = load i8, i8* %3
%36 = zext i8 %35 to i32
%37 = icmp ne i32 %36, 32
br i1 %37, label %38, label %242
38: ; preds = %31
%39 = load i8, i8* %3
%40 = zext i8 %39 to i32
%41 = icmp eq i32 %40, 10
br i1 %41, label %42, label %220
42: ; preds = %38
%43 = load i32, i32* %6
%44 = icmp eq i32 %43, 1
br i1 %44, label %45, label %218
45: ; preds = %42
%46 = getelementptr inbounds [500 x i8], [500 x i8]* %2, i64 0, i64 15
%47 = load i8, i8* %46
%48 = zext i8 %47 to i32
%49 = and i32 %48, 1
%50 = trunc i32 %49 to i8
store i8 %50, i8* %12
%51 = getelementptr inbounds [500 x i8], [500 x i8]* %2, i64 0, i64 12
%52 = load i8, i8* %51
%53 = zext i8 %52 to i32
%54 = shl i32 %53, 8
%55 = getelementptr inbounds [500 x i8], [500 x i8]* %2, i64 0, i64 13
%56 = load i8, i8* %55
%57 = zext i8 %56 to i32
%58 = or i32 %54, %57
store i32 %58, i32* %13
%59 = load i32*, i32** %11
%60 = call i32 (i32*, i8*, ...) @fprintf(i32* %59, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0))
store i32 0, i32* %9
br label %61
61: ; preds = %78, %45
%62 = load i32, i32* %9
%63 = icmp ult i32 %62, 6
br i1 %63, label %64, label %81
64: ; preds = %61
%65 = load i32*, i32** %11
%66 = load i32, i32* %9
%67 = zext i32 %66 to i64
%68 = getelementptr inbounds [500 x i8], [500 x i8]* %2, i64 0, i64 %67
%69 = load i8, i8* %68
%70 = zext i8 %69 to i32
%71 = call i32 (i32*, i8*, ...) @fprintf(i32* %65, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 %70)
%72 = load i32, i32* %9
%73 = icmp ult i32 %72, 5
br i1 %73, label %74, label %77
74: ; preds = %64
%75 = load i32*, i32** %11
%76 = call i32 (i32*, i8*, ...) @fprintf(i32* %75, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
br label %77
77: ; preds = %74, %64
br label %78
78: ; preds = %77
%79 = load i32, i32* %9
%80 = add i32 %79, 1
store i32 %80, i32* %9
br label %61
81: ; preds = %61
%82 = load i32*, i32** %11
%83 = call i32 (i32*, i8*, ...) @fprintf(i32* %82, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
%84 = load i32*, i32** %11
%85 = call i32 (i32*, i8*, ...) @fprintf(i32* %84, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.9, i64 0, i64 0))
store i32 6, i32* %9
br label %86
86: ; preds = %103, %81
%87 = load i32, i32* %9
%88 = icmp ult i32 %87, 12
br i1 %88, label %89, label %106
89: ; preds = %86
%90 = load i32*, i32** %11
%91 = load i32, i32* %9
%92 = zext i32 %91 to i64
%93 = getelementptr inbounds [500 x i8], [500 x i8]* %2, i64 0, i64 %92
%94 = load i8, i8* %93
%95 = zext i8 %94 to i32
%96 = call i32 (i32*, i8*, ...) @fprintf(i32* %90, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 %95)
%97 = load i32, i32* %9
%98 = icmp ult i32 %97, 11
br i1 %98, label %99, label %102
99: ; preds = %89
%100 = load i32*, i32** %11
%101 = call i32 (i32*, i8*, ...) @fprintf(i32* %100, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
br label %102
102: ; preds = %99, %89
br label %103
103: ; preds = %102
%104 = load i32, i32* %9
%105 = add i32 %104, 1
store i32 %105, i32* %9
br label %86
106: ; preds = %86
%107 = load i32*, i32** %11
%108 = call i32 (i32*, i8*, ...) @fprintf(i32* %107, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
%109 = getelementptr inbounds [500 x i8], [500 x i8]* %2, i64 0, i64 0
%110 = call i64 @checkTamTipo(i8* %109)
%111 = icmp ne i64 %110, 0
br i1 %111, label %112, label %178
112: ; preds = %106
%113 = getelementptr inbounds [500 x i8], [500 x i8]* %2, i64 0, i64 0
%114 = call signext i8 @checkTipoTrama(i8* %113)
store i8 %114, i8* %14
%115 = load i32*, i32** %11
%116 = call i32 (i32*, i8*, ...) @fprintf(i32* %115, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.10, i64 0, i64 0))
%117 = load i32*, i32** %11
%118 = load i32, i32* %13
%119 = call i32 (i32*, i8*, ...) @fprintf(i32* %117, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.11, i64 0, i64 0), i32 %118)
%120 = load i8, i8* %14
%121 = sext i8 %120 to i32
%122 = icmp eq i32 %121, 85
br i1 %122, label %123, label %138
123: ; preds = %112
%124 = load i8, i8* %12
%125 = getelementptr inbounds [500 x i8], [500 x i8]* %2, i64 0, i64 16
%126 = load i8, i8* %125
%127 = getelementptr inbounds [6 x i8], [6 x i8]* %15, i64 0, i64 0
%128 = call i32 @getwwdenRespuestaTramaU(i8 zeroext %124, i8 zeroext %126, i8* %127)
%129 = load i32*, i32** %11
%130 = load i8, i8* %14
%131 = sext i8 %130 to i32
%132 = getelementptr inbounds [6 x i8], [6 x i8]* %15, i64 0, i64 0
%133 = call i32 (i32*, i8*, ...) @fprintf(i32* %129, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.12, i64 0, i64 0), i32 %131, i8* %132)
%134 = getelementptr inbounds [6 x i8], [6 x i8]* %15, i64 0, i64 0
%135 = getelementptr inbounds [6 x i8], [6 x i8]* %15, i64 0, i64 0
%136 = call i32 @strlen(i8* %135)
%137 = call i32 @memset(i8* %134, i8 signext 0, i32 %136)
br label %177
138: ; preds = %112
%139 = load i8, i8* %14
%140 = sext i8 %139 to i32
%141 = icmp eq i32 %140, 83
br i1 %141, label %142, label %161
142: ; preds = %138
%143 = load i32*, i32** %11
%144 = load i32, i32* %13
%145 = getelementptr inbounds [6 x i8], [6 x i8]* %15, i64 0, i64 0
%146 = call i32 @getNr(i32 %144, i8* %145)
%147 = call i32 (i32*, i8*, ...) @fprintf(i32* %143, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.13, i64 0, i64 0), i32 %146)
%148 = getelementptr inbounds [500 x i8], [500 x i8]* %2, i64 0, i64 16
%149 = load i8, i8* %148
%150 = getelementptr inbounds [6 x i8], [6 x i8]* %15, i64 0, i64 0
%151 = call i32 @getwwdenTramaS(i8 zeroext %149, i8* %150)
%152 = load i32*, i32** %11
%153 = load i8, i8* %14
%154 = sext i8 %153 to i32
%155 = getelementptr inbounds [6 x i8], [6 x i8]* %15, i64 0, i64 0
%156 = call i32 (i32*, i8*, ...) @fprintf(i32* %152, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.12, i64 0, i64 0), i32 %154, i8* %155)
%157 = getelementptr inbounds [6 x i8], [6 x i8]* %15, i64 0, i64 0
%158 = getelementptr inbounds [6 x i8], [6 x i8]* %15, i64 0, i64 0
%159 = call i32 @strlen(i8* %158)
%160 = call i32 @memset(i8* %157, i8 signext 0, i32 %159)
br label %176
161: ; preds = %138
%162 = load i32*, i32** %11
%163 = load i32, i32* %13
%164 = getelementptr inbounds [6 x i8], [6 x i8]* %15, i64 0, i64 0
%165 = call i32 @getNr(i32 %163, i8* %164)
%166 = call i32 (i32*, i8*, ...) @fprintf(i32* %162, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.13, i64 0, i64 0), i32 %165)
%167 = load i32*, i32** %11
%168 = load i32, i32* %13
%169 = getelementptr inbounds [6 x i8], [6 x i8]* %15, i64 0, i64 0
%170 = call i32 @getNs(i32 %168, i8* %169)
%171 = call i32 (i32*, i8*, ...) @fprintf(i32* %167, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.14, i64 0, i64 0), i32 %170)
%172 = load i32*, i32** %11
%173 = load i8, i8* %14
%174 = sext i8 %173 to i32
%175 = call i32 (i32*, i8*, ...) @fprintf(i32* %172, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.15, i64 0, i64 0), i32 %174)
br label %176
176: ; preds = %161, %142
br label %177
177: ; preds = %176, %123
br label %200
178: ; preds = %106
%179 = getelementptr inbounds [500 x i8], [500 x i8]* %2, i64 0, i64 0
%180 = call i32 @getEthernetType(i8* %179)
store i32 %180, i32* %5
%181 = load i32*, i32** %11
%182 = call i32 (i32*, i8*, ...) @fprintf(i32* %181, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.16, i64 0, i64 0))
%183 = load i32*, i32** %11
%184 = load i32, i32* %5
%185 = load i32, i32* %5
%186 = call i32 (i32*, i8*, ...) @fprintf(i32* %183, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.17, i64 0, i64 0), i32 %184, i32 %185)
%187 = load i32, i32* %5
%188 = icmp eq i32 %187, 2048
br i1 %188, label %189, label %192
189: ; preds = %178
%190 = load i32*, i32** %11
%191 = call i32 (i32*, i8*, ...) @fprintf(i32* %190, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.18, i64 0, i64 0))
br label %199
192: ; preds = %178
%193 = load i32, i32* %5
%194 = icmp eq i32 %193, 2054
br i1 %194, label %195, label %198
195: ; preds = %192
%196 = load i32*, i32** %11
%197 = call i32 (i32*, i8*, ...) @fprintf(i32* %196, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.19, i64 0, i64 0))
br label %198
198: ; preds = %195, %192
br label %199
199: ; preds = %198, %189
br label %200
200: ; preds = %199, %177
%201 = load i8, i8* %12
%202 = zext i8 %201 to i32
%203 = icmp eq i32 %202, 0
br i1 %203, label %204, label %207
204: ; preds = %200
%205 = load i32*, i32** %11
%206 = call i32 (i32*, i8*, ...) @fprintf(i32* %205, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.20, i64 0, i64 0))
br label %215
207: ; preds = %200
%208 = load i8, i8* %12
%209 = zext i8 %208 to i32
%210 = icmp eq i32 %209, 1
br i1 %210, label %211, label %214
211: ; preds = %207
%212 = load i32*, i32** %11
%213 = call i32 (i32*, i8*, ...) @fprintf(i32* %212, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.21, i64 0, i64 0))
br label %214
214: ; preds = %211, %207
br label %215
215: ; preds = %214, %204
%216 = load i32*, i32** %11
%217 = call i32 (i32*, i8*, ...) @fprintf(i32* %216, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
store i32 0, i32* %8
br label %219
218: ; preds = %42
store i32 1, i32* %6
br label %219
219: ; preds = %218, %215
br label %241
220: ; preds = %38
%221 = load i32, i32* %7
%222 = icmp eq i32 %221, 0
br i1 %222, label %223, label %228
223: ; preds = %220
%224 = load i8, i8* %3
%225 = load i32, i32* %7
%226 = zext i32 %225 to i64
%227 = getelementptr inbounds [3 x i8], [3 x i8]* %4, i64 0, i64 %226
store i8 %224, i8* %227
store i32 1, i32* %7
br label %240
228: ; preds = %220
%229 = load i8, i8* %3
%230 = load i32, i32* %7
%231 = zext i32 %230 to i64
%232 = getelementptr inbounds [3 x i8], [3 x i8]* %4, i64 0, i64 %231
store i8 %229, i8* %232
%233 = getelementptr inbounds [3 x i8], [3 x i8]* %4, i64 0, i64 0
%234 = load i32, i32* %8
%235 = zext i32 %234 to i64
%236 = getelementptr inbounds [500 x i8], [500 x i8]* %2, i64 0, i64 %235
%237 = call i32 @sscanf(i8* %233, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.22, i64 0, i64 0), i8* %236)
store i32 0, i32* %7
%238 = load i32, i32* %8
%239 = add i32 %238, 1
store i32 %239, i32* %8
br label %240
240: ; preds = %228, %223
store i32 0, i32* %6
br label %241
241: ; preds = %240, %219
br label %242
242: ; preds = %241, %31
br label %27
243: ; preds = %27
%244 = load i32*, i32** %11
%245 = call i32 (i32*, i8*, ...) @fprintf(i32* %244, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.23, i64 0, i64 0))
%246 = load i32*, i32** %11
%247 = call i32 @fclose(i32* %246)
%248 = load i32*, i32** %10
%249 = call i32 @fclose(i32* %248)
store i32 0, i32* %1
br label %250
250: ; preds = %243, %23
%251 = load i32, i32* %1
ret i32 %251
}

LLVM IR (-O2):
@.str = [7 x i8] c"tramas\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [15 x i8] c"analisisTramas\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 = [16 x i8] c"Tipo:\09\09%c - %s\0A\00"
@.str.13 = [12 x i8] c"N(r): \09\09%u\0A\00"
@.str.14 = [12 x i8] c"N(s): \09\09%u\0A\00"
@.str.15 = [11 x i8] c"Tipo:\09\09%c\0A\00"
@.str.16 = [18 x i8] c"Trama:\09\09Ethernet\0A\00"
@.str.17 = [24 x i8] c"Ethertype:\090x%04X = %d \00"
@.str.18 = [10 x i8] c"(DOD IP)\0A\00"
@.str.19 = [7 x i8] c"(ARP)\0A\00"
@.str.20 = [11 x i8] c"P/F:\09\09[P]\0A\00"
@.str.21 = [11 x i8] c"P/F:\09\09[F]\0A\00"
@.str.22 = [4 x i8] c"%2x\00"
@.str.23 = [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 = alloca [6 x i8]
%4 = getelementptr inbounds [500 x i8], [500 x i8]* %1, i64 0, i64 0
%5 = getelementptr inbounds [3 x i8], [3 x i8]* %2, i64 0, i64 0
%6 = 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))
%7 = tail call i32* @fopen(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%8 = icmp eq i32* %6, null
%9 = icmp eq i32* %7, null
%10 = or i1 %8, %9
br i1 %10, label %11, label %13
11: ; preds = %0
%12 = tail call i32 @perror(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0))
br label %161
13: ; preds = %0
%14 = getelementptr inbounds [3 x i8], [3 x i8]* %2, i64 0, i64 2
store i8 0, i8* %14
%15 = call i64 @feof(i32* %6)
%16 = icmp eq i64 %15, 0
br i1 %16, label %17, label %157
17: ; preds = %13
%18 = getelementptr inbounds [500 x i8], [500 x i8]* %1, i64 0, i64 15
%19 = getelementptr inbounds [500 x i8], [500 x i8]* %1, i64 0, i64 12
%20 = getelementptr inbounds [500 x i8], [500 x i8]* %1, i64 0, i64 13
%21 = getelementptr inbounds [6 x i8], [6 x i8]* %3, i64 0, i64 0
%22 = getelementptr inbounds [500 x i8], [500 x i8]* %1, i64 0, i64 16
%23 = getelementptr inbounds [3 x i8], [3 x i8]* %2, i64 0, i64 1
%24 = getelementptr inbounds [500 x i8], [500 x i8]* %1, i64 0, i64 1
%25 = getelementptr inbounds [500 x i8], [500 x i8]* %1, i64 0, i64 2
%26 = getelementptr inbounds [500 x i8], [500 x i8]* %1, i64 0, i64 3
%27 = getelementptr inbounds [500 x i8], [500 x i8]* %1, i64 0, i64 4
%28 = getelementptr inbounds [500 x i8], [500 x i8]* %1, i64 0, i64 5
%29 = getelementptr inbounds [500 x i8], [500 x i8]* %1, i64 0, i64 6
%30 = getelementptr inbounds [500 x i8], [500 x i8]* %1, i64 0, i64 7
%31 = getelementptr inbounds [500 x i8], [500 x i8]* %1, i64 0, i64 8
%32 = getelementptr inbounds [500 x i8], [500 x i8]* %1, i64 0, i64 9
%33 = getelementptr inbounds [500 x i8], [500 x i8]* %1, i64 0, i64 10
%34 = getelementptr inbounds [500 x i8], [500 x i8]* %1, i64 0, i64 11
br label %35
35: ; preds = %17, %151
%36 = phi i32 [ 0, %17 ], [ %154, %151 ]
%37 = phi i32 [ 0, %17 ], [ %153, %151 ]
%38 = phi i32 [ 0, %17 ], [ %152, %151 ]
%39 = call i64 @fgetc(i32* %6)
%40 = trunc i64 %39 to i8
switch i8 %40, label %143 [
i8 32, label %151
i8 10, label %41
]
41: ; preds = %35
%42 = icmp eq i32 %36, 1
br i1 %42, label %43, label %151
43: ; preds = %41
%44 = load i8, i8* %18
%45 = load i8, i8* %19
%46 = zext i8 %45 to i32
%47 = load i8, i8* %20
%48 = zext i8 %47 to i32
%49 = call i64 @fwrite(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), i64 13, i64 1, i32* %7)
%50 = load i8, i8* %4
%51 = zext i8 %50 to i32
%52 = call i32 (i32*, i8*, ...) @fprintf(i32* %7, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 %51)
%53 = call i32 @fputc(i32 58, i32* %7)
%54 = load i8, i8* %24
%55 = zext i8 %54 to i32
%56 = call i32 (i32*, i8*, ...) @fprintf(i32* %7, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 %55)
%57 = call i32 @fputc(i32 58, i32* %7)
%58 = load i8, i8* %25
%59 = zext i8 %58 to i32
%60 = call i32 (i32*, i8*, ...) @fprintf(i32* %7, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 %59)
%61 = call i32 @fputc(i32 58, i32* %7)
%62 = load i8, i8* %26
%63 = zext i8 %62 to i32
%64 = call i32 (i32*, i8*, ...) @fprintf(i32* %7, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 %63)
%65 = call i32 @fputc(i32 58, i32* %7)
%66 = load i8, i8* %27
%67 = zext i8 %66 to i32
%68 = call i32 (i32*, i8*, ...) @fprintf(i32* %7, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 %67)
%69 = call i32 @fputc(i32 58, i32* %7)
%70 = load i8, i8* %28
%71 = zext i8 %70 to i32
%72 = call i32 (i32*, i8*, ...) @fprintf(i32* %7, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 %71)
%73 = shl nuw nsw i32 %46, 8
%74 = call i32 @fputc(i32 10, i32* %7)
%75 = call i64 @fwrite(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.9, i64 0, i64 0), i64 12, i64 1, i32* %7)
%76 = load i8, i8* %29
%77 = zext i8 %76 to i32
%78 = call i32 (i32*, i8*, ...) @fprintf(i32* %7, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 %77)
%79 = call i32 @fputc(i32 58, i32* %7)
%80 = load i8, i8* %30
%81 = zext i8 %80 to i32
%82 = call i32 (i32*, i8*, ...) @fprintf(i32* %7, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 %81)
%83 = call i32 @fputc(i32 58, i32* %7)
%84 = load i8, i8* %31
%85 = zext i8 %84 to i32
%86 = call i32 (i32*, i8*, ...) @fprintf(i32* %7, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 %85)
%87 = call i32 @fputc(i32 58, i32* %7)
%88 = load i8, i8* %32
%89 = zext i8 %88 to i32
%90 = call i32 (i32*, i8*, ...) @fprintf(i32* %7, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 %89)
%91 = call i32 @fputc(i32 58, i32* %7)
%92 = load i8, i8* %33
%93 = zext i8 %92 to i32
%94 = call i32 (i32*, i8*, ...) @fprintf(i32* %7, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 %93)
%95 = call i32 @fputc(i32 58, i32* %7)
%96 = load i8, i8* %34
%97 = zext i8 %96 to i32
%98 = call i32 (i32*, i8*, ...) @fprintf(i32* %7, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 %97)
%99 = and i8 %44, 1
%100 = or i32 %73, %48
%101 = call i32 @fputc(i32 10, i32* %7)
%102 = call i64 @checkTamTipo(i8* %4)
%103 = icmp eq i64 %102, 0
br i1 %103, label %130, label %104
104: ; preds = %43
%105 = call signext i8 @checkTipoTrama(i8* %4)
%106 = call i64 @fwrite(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.10, i64 0, i64 0), i64 19, i64 1, i32* %7)
%107 = call i32 (i32*, i8*, ...) @fprintf(i32* %7, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.11, i64 0, i64 0), i32 %100)
switch i8 %105, label %122 [
i8 85, label %108
i8 83, label %114
]
108: ; preds = %104
%109 = load i8, i8* %22
%110 = call i32 @getwwdenRespuestaTramaU(i8 zeroext %99, i8 zeroext %109, i8* %21)
%111 = call i32 (i32*, i8*, ...) @fprintf(i32* %7, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.12, i64 0, i64 0), i32 85, i8* %21)
%112 = call i32 @strlen(i8* %21)
%113 = call i32 @memset(i8* %21, i8 signext 0, i32 %112)
br label %129
114: ; preds = %104
%115 = call i32 @getNr(i32 %100, i8* %21)
%116 = call i32 (i32*, i8*, ...) @fprintf(i32* %7, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.13, i64 0, i64 0), i32 %115)
%117 = load i8, i8* %22
%118 = call i32 @getwwdenTramaS(i8 zeroext %117, i8* %21)
%119 = call i32 (i32*, i8*, ...) @fprintf(i32* %7, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.12, i64 0, i64 0), i32 83, i8* %21)
%120 = call i32 @strlen(i8* %21)
%121 = call i32 @memset(i8* %21, i8 signext 0, i32 %120)
br label %129
122: ; preds = %104
%123 = sext i8 %105 to i32
%124 = call i32 @getNr(i32 %100, i8* %21)
%125 = call i32 (i32*, i8*, ...) @fprintf(i32* %7, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.13, i64 0, i64 0), i32 %124)
%126 = call i32 @getNs(i32 %100, i8* %21)
%127 = call i32 (i32*, i8*, ...) @fprintf(i32* %7, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.14, i64 0, i64 0), i32 %126)
%128 = call i32 (i32*, i8*, ...) @fprintf(i32* %7, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.15, i64 0, i64 0), i32 %123)
br label %129
129: ; preds = %114, %122, %108
br label %138
130: ; preds = %43
%131 = call i32 @getEthernetType(i8* %4)
%132 = call i64 @fwrite(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.16, i64 0, i64 0), i64 17, i64 1, i32* %7)
%133 = call i32 (i32*, i8*, ...) @fprintf(i32* %7, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.17, i64 0, i64 0), i32 %131, i32 %131)
switch i32 %131, label %138 [
i32 2048, label %134
i32 2054, label %136
]
134: ; preds = %130
%135 = call i64 @fwrite(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.18, i64 0, i64 0), i64 9, i64 1, i32* %7)
br label %138
136: ; preds = %130
%137 = call i64 @fwrite(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.19, i64 0, i64 0), i64 6, i64 1, i32* %7)
br label %138
138: ; preds = %130, %134, %136, %129
%139 = icmp eq i8 %99, 0
%140 = select i1 %139, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.20, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.21, i64 0, i64 0)
%141 = call i64 @fwrite(i8* %140, i64 10, i64 1, i32* %7)
%142 = call i32 @fputc(i32 10, i32* %7)
br label %151
143: ; preds = %35
%144 = icmp eq i32 %37, 0
br i1 %144, label %145, label %146
145: ; preds = %143
store i8 %40, i8* %5
br label %151
146: ; preds = %143
store i8 %40, i8* %23
%147 = zext i32 %38 to i64
%148 = getelementptr inbounds [500 x i8], [500 x i8]* %1, i64 0, i64 %147
%149 = call i32 @sscanf(i8* %5, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.22, i64 0, i64 0), i8* %148)
%150 = add i32 %38, 1
br label %151
151: ; preds = %145, %146, %41, %35, %138
%152 = phi i32 [ 0, %138 ], [ %38, %35 ], [ %38, %41 ], [ %38, %145 ], [ %150, %146 ]
%153 = phi i32 [ %37, %138 ], [ %37, %35 ], [ %37, %41 ], [ 1, %145 ], [ 0, %146 ]
%154 = phi i32 [ 1, %138 ], [ %36, %35 ], [ 1, %41 ], [ 0, %145 ], [ 0, %146 ]
%155 = call i64 @feof(i32* %6)
%156 = icmp eq i64 %155, 0
br i1 %156, label %35, label %157
157: ; preds = %151, %13
%158 = call i64 @fwrite(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.23, i64 0, i64 0), i64 28, i64 1, i32* %7)
%159 = call i32 @fclose(i32* %7)
%160 = call i32 @fclose(i32* %6)
br label %161
161: ; preds = %157, %11
%162 = phi i32 [ -1, %11 ], [ 0, %157 ]
ret i32 %162
}