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

/* Variables and functions */
int /*<<< orphan*/ SEEK_SET;
char decode_5bit(char);
char decode_6bit(char);
unsigned char encode_5bit(int /*<<< orphan*/);
unsigned char encode_6bit(int /*<<< orphan*/);
scalar_t__ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int fread(char *, int, int, int /*<<< orphan*/ *);
scalar_t__ fseek(int /*<<< orphan*/ *, int, int /*<<< orphan*/);
int fwrite(char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ invalid_tag();
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ stderr;
int strlen(char *);
int /*<<< orphan*/ toupper(char);
int main(int argc, char *argv[]) {
  char service_tag[8] = "       ";
  char encoded_tag[6];
  if (argc < 2 || argc > 3) {
    fprintf(stderr, "CMOS service tag utility for DELL machines v1.0\n");
    fprintf(stderr, "Copyright (c) 2008 Ondrej Zary\n\n");
    fprintf(stderr, "Usage: read tag:  dell_service_tag CMOS_FILE\n");
    fprintf(stderr, "   or write tag:  dell_service_tag CMOS_FILE NEWTAG\n");
    return 1;
  }
  FILE *f = fopen(argv[1], (argc < 3) ? "r" : "r+");
  if (!f) {
    perror("Unable to open CMOS file\n");
    return 1;
  }
  if (fseek(f, 0x59, SEEK_SET)) {
    perror("Unable to seek to offset 0x59\n");
    return 1;
  }
  if (fread(encoded_tag, 1, sizeof(encoded_tag), f) != sizeof(encoded_tag)) {
    perror("Unable to read tag from CMOS file\n");
    return 1;
  }
  if (argc < 3) {
    service_tag[0] = decode_6bit(encoded_tag[0] & 0x7F);
    service_tag[1] = decode_5bit((encoded_tag[1] & 0x3E) >> 1);
    service_tag[2] = decode_5bit(((encoded_tag[2] & 0xF0) >> 4) |
                                 (encoded_tag[1] & 0x01) << 4);
    service_tag[3] = decode_5bit(((encoded_tag[2] & 0x0F) << 1) |
                                 ((encoded_tag[3] & 0x80) >> 7));
    service_tag[4] = decode_5bit((encoded_tag[3] & 0x7C) >> 2);
    service_tag[5] = decode_5bit(((encoded_tag[3] & 0x03) << 3) |
                                 ((encoded_tag[4] & 0xE0) >> 5));
    service_tag[6] = decode_5bit(encoded_tag[4] & 0x1F);
    printf("%s\n", service_tag);
  }
  if (argc > 2) {
    unsigned char c;
    if (strlen(argv[2]) != 7)
      invalid_tag();
    memset(&encoded_tag[1], 0, sizeof(encoded_tag) - 1);
    encoded_tag[0] &= 0x80;
    c = encode_6bit(toupper(argv[2][0]));
    if (c == 0xFF)
      invalid_tag();
    encoded_tag[0] = c | 0x80;
    c = encode_5bit(toupper(argv[2][1]));
    if (c == 0xFF)
      invalid_tag();
    encoded_tag[1] |= c << 1;
    c = encode_5bit(toupper(argv[2][2]));
    if (c == 0xFF)
      invalid_tag();
    encoded_tag[1] |= (c & 0x10) >> 4;
    encoded_tag[2] |= (c & 0x0F) << 4;
    c = encode_5bit(toupper(argv[2][3]));
    if (c == 0xFF)
      invalid_tag();
    encoded_tag[2] |= (c & 0x1E) >> 1;
    encoded_tag[3] |= (c & 0x01) << 7;
    c = encode_5bit(toupper(argv[2][4]));
    if (c == 0xFF)
      invalid_tag();
    encoded_tag[3] |= c << 2;
    c = encode_5bit(toupper(argv[2][5]));
    if (c == 0xFF)
      invalid_tag();
    encoded_tag[3] |= (c & 0x18) >> 3;
    encoded_tag[4] |= (c & 0x07) << 5;
    c = encode_5bit(toupper(argv[2][6]));
    if (c == 0xFF)
      invalid_tag();
    encoded_tag[4] |= c;
    for (unsigned int i = 0; i < sizeof(encoded_tag) - 1; i++)
      encoded_tag[sizeof(encoded_tag) - 1] += encoded_tag[i];
    if (fseek(f, 0x59, SEEK_SET)) {
      perror("Unable to seek to offset 0x59\n");
      return 1;
    }
    if (fwrite(encoded_tag, 1, sizeof(encoded_tag), f) != sizeof(encoded_tag)) {
      perror("Unable to write tag to CMOS file\n");
      return 1;
    }
  }
  if (fclose(f)) {
    perror("Error closing CMOS file\n");
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xde3(%rip),%rax
mov    %rax,-0x18(%rbp)
cmpl   $0x2,-0x8(%rbp)
jl     1235 <main+0x35>
cmpl   $0x3,-0x8(%rbp)
jle    1295 <main+0x95>
mov    0x2da4(%rip),%rax
mov    (%rax),%edi
lea    0xdc3(%rip),%rsi
call   10a0 <fprintf@plt>
mov    0x2d8f(%rip),%rax
mov    (%rax),%edi
lea    0xddf(%rip),%rsi
call   10a0 <fprintf@plt>
mov    0x2d7a(%rip),%rax
mov    (%rax),%edi
lea    0xdeb(%rip),%rsi
call   10a0 <fprintf@plt>
mov    0x2d65(%rip),%rax
mov    (%rax),%edi
lea    0xe04(%rip),%rsi
call   10a0 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    174e <main+0x54e>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x8(%rbp),%ecx
lea    0xe18(%rip),%rsi
lea    0xe0f(%rip),%rax
cmp    $0x3,%ecx
cmovl  %rax,%rsi
call   10f0 <fopen@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    12e1 <main+0xe1>
lea    0xdf2(%rip),%rdi
call   1100 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    174e <main+0x54e>
mov    -0x28(%rbp),%rdi
mov    0x2cec(%rip),%rax
mov    (%rax),%edx
mov    $0x59,%esi
call   10c0 <fseek@plt>
cmp    $0x0,%rax
je     131a <main+0x11a>
lea    0xdd3(%rip),%rdi
call   1100 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    174e <main+0x54e>
lea    -0x1e(%rbp),%rdi
mov    -0x28(%rbp),%rcx
mov    $0x1,%esi
mov    $0x6,%edx
call   1050 <fread@plt>
cltq
cmp    $0x6,%rax
je     1355 <main+0x155>
lea    0xdb7(%rip),%rdi
call   1100 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    174e <main+0x54e>
cmpl   $0x3,-0x8(%rbp)
jge    1428 <main+0x228>
movsbl -0x1e(%rbp),%eax
and    $0x7f,%eax
movsbl %al,%edi
call   10b0 <decode_6bit@plt>
mov    %al,-0x18(%rbp)
movsbl -0x1d(%rbp),%eax
and    $0x3e,%eax
sar    $0x1,%eax
movsbl %al,%edi
call   10d0 <decode_5bit@plt>
mov    %al,-0x17(%rbp)
movsbl -0x1c(%rbp),%eax
and    $0xf0,%eax
sar    $0x4,%eax
movsbl -0x1d(%rbp),%ecx
and    $0x1,%ecx
shl    $0x4,%ecx
or     %ecx,%eax
movsbl %al,%edi
call   10d0 <decode_5bit@plt>
mov    %al,-0x16(%rbp)
movsbl -0x1c(%rbp),%eax
and    $0xf,%eax
shl    $0x1,%eax
movsbl -0x1b(%rbp),%ecx
and    $0x80,%ecx
sar    $0x7,%ecx
or     %ecx,%eax
movsbl %al,%edi
call   10d0 <decode_5bit@plt>
mov    %al,-0x15(%rbp)
movsbl -0x1b(%rbp),%eax
and    $0x7c,%eax
sar    $0x2,%eax
movsbl %al,%edi
call   10d0 <decode_5bit@plt>
mov    %al,-0x14(%rbp)
movsbl -0x1b(%rbp),%eax
and    $0x3,%eax
shl    $0x3,%eax
movsbl -0x1a(%rbp),%ecx
and    $0xe0,%ecx
sar    $0x5,%ecx
or     %ecx,%eax
movsbl %al,%edi
call   10d0 <decode_5bit@plt>
mov    %al,-0x13(%rbp)
movsbl -0x1a(%rbp),%eax
and    $0x1f,%eax
movsbl %al,%edi
call   10d0 <decode_5bit@plt>
mov    %al,-0x12(%rbp)
lea    -0x18(%rbp),%rsi
lea    0xcfb(%rip),%rdi
call   1080 <printf@plt>
cmpl   $0x2,-0x8(%rbp)
jle    171c <main+0x51c>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1070 <strlen@plt>
cmp    $0x7,%eax
je     144f <main+0x24f>
mov    $0x0,%al
call   1030 <invalid_tag@plt>
lea    -0x1e(%rbp),%rdi
add    $0x1,%rdi
xor    %esi,%esi
mov    $0x5,%edx
call   1090 <memset@plt>
movsbl -0x1e(%rbp),%eax
and    $0x80,%eax
mov    %al,-0x1e(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
movsbl (%rax),%edi
call   1040 <toupper@plt>
mov    %eax,%edi
call   10e0 <encode_6bit@plt>
mov    %al,-0x29(%rbp)
movzbl -0x29(%rbp),%eax
cmp    $0xff,%eax
jne    149f <main+0x29f>
mov    $0x0,%al
call   1030 <invalid_tag@plt>
movzbl -0x29(%rbp),%eax
or     $0x80,%eax
mov    %al,-0x1e(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
movsbl 0x1(%rax),%edi
call   1040 <toupper@plt>
mov    %eax,%edi
call   1120 <encode_5bit@plt>
mov    %al,-0x29(%rbp)
movzbl -0x29(%rbp),%eax
cmp    $0xff,%eax
jne    14dc <main+0x2dc>
mov    $0x0,%al
call   1030 <invalid_tag@plt>
movzbl -0x29(%rbp),%ecx
shl    $0x1,%ecx
movsbl -0x1d(%rbp),%eax
or     %ecx,%eax
mov    %al,-0x1d(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
movsbl 0x2(%rax),%edi
call   1040 <toupper@plt>
mov    %eax,%edi
call   1120 <encode_5bit@plt>
mov    %al,-0x29(%rbp)
movzbl -0x29(%rbp),%eax
cmp    $0xff,%eax
jne    151d <main+0x31d>
mov    $0x0,%al
call   1030 <invalid_tag@plt>
movzbl -0x29(%rbp),%ecx
and    $0x10,%ecx
sar    $0x4,%ecx
movsbl -0x1d(%rbp),%eax
or     %ecx,%eax
mov    %al,-0x1d(%rbp)
movzbl -0x29(%rbp),%ecx
and    $0xf,%ecx
shl    $0x4,%ecx
movsbl -0x1c(%rbp),%eax
or     %ecx,%eax
mov    %al,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
movsbl 0x3(%rax),%edi
call   1040 <toupper@plt>
mov    %eax,%edi
call   1120 <encode_5bit@plt>
mov    %al,-0x29(%rbp)
movzbl -0x29(%rbp),%eax
cmp    $0xff,%eax
jne    1574 <main+0x374>
mov    $0x0,%al
call   1030 <invalid_tag@plt>
movzbl -0x29(%rbp),%ecx
and    $0x1e,%ecx
sar    $0x1,%ecx
movsbl -0x1c(%rbp),%eax
or     %ecx,%eax
mov    %al,-0x1c(%rbp)
movzbl -0x29(%rbp),%ecx
and    $0x1,%ecx
shl    $0x7,%ecx
movsbl -0x1b(%rbp),%eax
or     %ecx,%eax
mov    %al,-0x1b(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
movsbl 0x4(%rax),%edi
call   1040 <toupper@plt>
mov    %eax,%edi
call   1120 <encode_5bit@plt>
mov    %al,-0x29(%rbp)
movzbl -0x29(%rbp),%eax
cmp    $0xff,%eax
jne    15cb <main+0x3cb>
mov    $0x0,%al
call   1030 <invalid_tag@plt>
movzbl -0x29(%rbp),%ecx
shl    $0x2,%ecx
movsbl -0x1b(%rbp),%eax
or     %ecx,%eax
mov    %al,-0x1b(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
movsbl 0x5(%rax),%edi
call   1040 <toupper@plt>
mov    %eax,%edi
call   1120 <encode_5bit@plt>
mov    %al,-0x29(%rbp)
movzbl -0x29(%rbp),%eax
cmp    $0xff,%eax
jne    160c <main+0x40c>
mov    $0x0,%al
call   1030 <invalid_tag@plt>
movzbl -0x29(%rbp),%ecx
and    $0x18,%ecx
sar    $0x3,%ecx
movsbl -0x1b(%rbp),%eax
or     %ecx,%eax
mov    %al,-0x1b(%rbp)
movzbl -0x29(%rbp),%ecx
and    $0x7,%ecx
shl    $0x5,%ecx
movsbl -0x1a(%rbp),%eax
or     %ecx,%eax
mov    %al,-0x1a(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
movsbl 0x6(%rax),%edi
call   1040 <toupper@plt>
mov    %eax,%edi
call   1120 <encode_5bit@plt>
mov    %al,-0x29(%rbp)
movzbl -0x29(%rbp),%eax
cmp    $0xff,%eax
jne    1663 <main+0x463>
mov    $0x0,%al
call   1030 <invalid_tag@plt>
movzbl -0x29(%rbp),%ecx
movsbl -0x1a(%rbp),%eax
or     %ecx,%eax
mov    %al,-0x1a(%rbp)
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    $0x5,%rax
jae    16a3 <main+0x4a3>
mov    -0x30(%rbp),%eax
movsbl -0x1e(%rbp,%rax,1),%ecx
movsbl -0x19(%rbp),%eax
add    %ecx,%eax
mov    %al,-0x19(%rbp)
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    1677 <main+0x477>
mov    -0x28(%rbp),%rdi
mov    0x292a(%rip),%rax
mov    (%rax),%edx
mov    $0x59,%esi
call   10c0 <fseek@plt>
cmp    $0x0,%rax
je     16dc <main+0x4dc>
lea    0xa11(%rip),%rdi
call   1100 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    174e <main+0x54e>
lea    -0x1e(%rbp),%rdi
mov    -0x28(%rbp),%rcx
mov    $0x1,%esi
mov    $0x6,%edx
call   1110 <fwrite@plt>
cltq
cmp    $0x6,%rax
je     1717 <main+0x517>
lea    0xa1c(%rip),%rdi
call   1100 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    174e <main+0x54e>
jmp    171c <main+0x51c>
mov    -0x28(%rbp),%rdi
call   1060 <fclose@plt>
cmp    $0x0,%rax
je     1747 <main+0x547>
lea    0xa0e(%rip),%rdi
call   1100 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    174e <main+0x54e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %edi,%ebx
movabs $0x20202020202020,%rax
mov    %rax,0x8(%rsp)
lea    -0x4(%rbx),%eax
cmp    $0xfffffffd,%eax
ja     126e <main+0x6e>
mov    0x2db4(%rip),%rbx
mov    (%rbx),%edi
lea    0xdcb(%rip),%rsi
call   10a0 <fprintf@plt>
mov    (%rbx),%edi
lea    0xdee(%rip),%rsi
call   10a0 <fprintf@plt>
mov    (%rbx),%edi
lea    0xe01(%rip),%rsi
call   10a0 <fprintf@plt>
mov    (%rbx),%edi
lea    0xe21(%rip),%rsi
call   10a0 <fprintf@plt>
mov    $0x1,%ebx
jmp    1565 <main+0x365>
mov    %rsi,%r15
mov    0x8(%rsi),%rdi
cmp    $0x3,%ebx
lea    0xe36(%rip),%rax
lea    0xe31(%rip),%rsi
cmovb  %rax,%rsi
call   10f0 <fopen@plt>
test   %rax,%rax
je     157d <main+0x37d>
mov    %rax,%r14
mov    0x2d36(%rip),%r12
mov    (%r12),%edx
mov    %rax,%rdi
mov    $0x59,%esi
call   10c0 <fseek@plt>
test   %rax,%rax
jne    1574 <main+0x374>
lea    0x2(%rsp),%rdi
mov    $0x1,%esi
mov    $0x6,%edx
mov    %r14,%rcx
call   1050 <fread@plt>
cmp    $0x6,%eax
jne    1586 <main+0x386>
cmp    $0x2,%ebx
ja     13a1 <main+0x1a1>
movzbl 0x2(%rsp),%edi
and    $0x7f,%edi
call   10b0 <decode_6bit@plt>
mov    %al,0x8(%rsp)
movzbl 0x3(%rsp),%ebx
mov    %ebx,%edi
shr    %edi
and    $0x1f,%edi
call   10d0 <decode_5bit@plt>
mov    %al,0x9(%rsp)
mov    0x4(%rsp),%bpl
shl    $0x4,%bl
mov    %ebp,%eax
shr    $0x4,%al
or     %bl,%al
and    $0x1f,%al
movzbl %al,%edi
call   10d0 <decode_5bit@plt>
mov    %al,0xa(%rsp)
movzbl 0x5(%rsp),%r15d
add    %bpl,%bpl
mov    %r15d,%eax
shr    $0x7,%al
or     %bpl,%al
and    $0x1f,%al
movzbl %al,%edi
call   10d0 <decode_5bit@plt>
mov    %al,0xb(%rsp)
mov    %r15d,%edi
shr    $0x2,%edi
and    $0x1f,%edi
call   10d0 <decode_5bit@plt>
mov    %al,0xc(%rsp)
movsbl 0x6(%rsp),%ebx
lea    0x0(,%r15,8),%eax
mov    %ebx,%ecx
shr    $0x5,%cl
or     %al,%cl
and    $0x1f,%cl
movzbl %cl,%edi
call   10d0 <decode_5bit@plt>
mov    %al,0xd(%rsp)
and    $0x1f,%ebx
mov    %ebx,%edi
call   10d0 <decode_5bit@plt>
mov    %al,0xe(%rsp)
lea    0xd84(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1080 <printf@plt>
jmp    1556 <main+0x356>
mov    0x10(%r15),%rdi
call   1070 <strlen@plt>
cmp    $0x7,%eax
je     13b6 <main+0x1b6>
xor    %eax,%eax
call   1030 <invalid_tag@plt>
lea    0x3(%rsp),%rdi
xor    %esi,%esi
mov    $0x5,%edx
call   1090 <memset@plt>
andb   $0x80,0x2(%rsp)
mov    0x10(%r15),%rax
movsbl (%rax),%edi
call   1040 <toupper@plt>
mov    %eax,%edi
call   10e0 <encode_6bit@plt>
mov    %eax,%ebx
cmp    $0xff,%al
jne    13ec <main+0x1ec>
xor    %eax,%eax
call   1030 <invalid_tag@plt>
or     $0x80,%bl
mov    %bl,0x2(%rsp)
mov    0x10(%r15),%rax
movsbl 0x1(%rax),%edi
call   1040 <toupper@plt>
mov    %eax,%edi
call   1120 <encode_5bit@plt>
mov    %eax,%ebx
cmp    $0xff,%al
jne    1414 <main+0x214>
xor    %eax,%eax
call   1030 <invalid_tag@plt>
add    %bl,%bl
or     %bl,0x3(%rsp)
mov    0x10(%r15),%rax
movsbl 0x2(%rax),%edi
call   1040 <toupper@plt>
mov    %eax,%edi
call   1120 <encode_5bit@plt>
mov    %eax,%ebx
cmp    $0xff,%al
jne    143b <main+0x23b>
xor    %eax,%eax
call   1030 <invalid_tag@plt>
mov    %ebx,%eax
shr    $0x4,%al
and    $0x1,%al
or     %al,0x3(%rsp)
shl    $0x4,%bl
or     %bl,0x4(%rsp)
mov    0x10(%r15),%rax
movsbl 0x3(%rax),%edi
call   1040 <toupper@plt>
mov    %eax,%edi
call   1120 <encode_5bit@plt>
mov    %eax,%ebx
cmp    $0xff,%al
jne    146e <main+0x26e>
xor    %eax,%eax
call   1030 <invalid_tag@plt>
mov    %ebx,%eax
shr    %al
and    $0xf,%al
or     %al,0x4(%rsp)
shl    $0x7,%bl
or     %bl,0x5(%rsp)
mov    0x10(%r15),%rax
movsbl 0x4(%rax),%edi
call   1040 <toupper@plt>
mov    %eax,%edi
call   1120 <encode_5bit@plt>
mov    %eax,%ebx
cmp    $0xff,%al
jne    14a0 <main+0x2a0>
xor    %eax,%eax
call   1030 <invalid_tag@plt>
shl    $0x2,%bl
or     %bl,0x5(%rsp)
mov    0x10(%r15),%rax
movsbl 0x5(%rax),%edi
call   1040 <toupper@plt>
mov    %eax,%edi
call   1120 <encode_5bit@plt>
mov    %eax,%ebx
cmp    $0xff,%al
jne    14c8 <main+0x2c8>
xor    %eax,%eax
call   1030 <invalid_tag@plt>
mov    %ebx,%eax
shr    $0x3,%al
and    $0x3,%al
or     %al,0x5(%rsp)
shl    $0x5,%bl
or     %bl,0x6(%rsp)
mov    0x10(%r15),%rax
movsbl 0x6(%rax),%edi
call   1040 <toupper@plt>
mov    %eax,%edi
call   1120 <encode_5bit@plt>
mov    %eax,%ebx
cmp    $0xff,%al
jne    14fb <main+0x2fb>
xor    %eax,%eax
call   1030 <invalid_tag@plt>
mov    0x6(%rsp),%al
or     %bl,%al
mov    %al,0x6(%rsp)
mov    0x7(%rsp),%cl
add    0x2(%rsp),%cl
add    0x3(%rsp),%cl
add    0x4(%rsp),%cl
add    0x5(%rsp),%cl
add    %al,%cl
mov    %cl,0x7(%rsp)
mov    (%r12),%edx
mov    %r14,%rdi
mov    $0x59,%esi
call   10c0 <fseek@plt>
test   %rax,%rax
jne    1574 <main+0x374>
lea    0x2(%rsp),%rdi
mov    $0x1,%ebx
mov    $0x1,%esi
mov    $0x6,%edx
mov    %r14,%rcx
call   1110 <fwrite@plt>
cmp    $0x6,%eax
jne    15a0 <main+0x3a0>
mov    %r14,%rdi
call   1060 <fclose@plt>
xor    %ebx,%ebx
test   %rax,%rax
jne    158f <main+0x38f>
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xb59(%rip),%rdi
jmp    1596 <main+0x396>
lea    0xb36(%rip),%rdi
jmp    1596 <main+0x396>
lea    0xb66(%rip),%rdi
jmp    1596 <main+0x396>
lea    0xba6(%rip),%rdi
call   1100 <perror@plt>
jmp    1264 <main+0x64>
lea    0xb73(%rip),%rdi
call   1100 <perror@plt>
jmp    1565 <main+0x365>

LLVM IR (-O0):
@__const.main.service_tag = [8 x i8] c" \00"
@stderr = global i32 0
@.str = [49 x i8] c"CMOS service tag utility for DELL machines v1.0\0A\00"
@.str.1 = [33 x i8] c"Copyright (c) 2008 Ondrej Zary\0A\0A\00"
@.str.2 = [46 x i8] c"Usage: read tag: dell_service_tag CMOS_FILE\0A\00"
@.str.3 = [53 x i8] c" or write tag: dell_service_tag CMOS_FILE NEWTAG\0A\00"
@.str.4 = [2 x i8] c"r\00"
@.str.5 = [3 x i8] c"r+\00"
@.str.6 = [26 x i8] c"Unable to open CMOS file\0A\00"
@SEEK_SET = global i32 0
@.str.7 = [31 x i8] c"Unable to seek to offset 0x59\0A\00"
@.str.8 = [35 x i8] c"Unable to read tag from CMOS file\0A\00"
@.str.9 = [4 x i8] c"%s\0A\00"
@.str.10 = [34 x i8] c"Unable to write tag to CMOS file\0A\00"
@.str.11 = [25 x i8] c"Error closing CMOS file\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [8 x i8]
%7 = alloca [6 x i8]
%8 = alloca i32*
%9 = alloca i8
%10 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = bitcast [8 x i8]* %6 to i8*
%12 = load i32, i32* %4
%13 = icmp slt i32 %12, 2
br i1 %13, label %17, label %14
14: ; preds = %2
%15 = load i32, i32* %4
%16 = icmp sgt i32 %15, 3
br i1 %16, label %17, label %26
17: ; preds = %14, %2
%18 = load i32, i32* @stderr
%19 = call i32 @fprintf(i32 %18, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0))
%20 = load i32, i32* @stderr
%21 = call i32 @fprintf(i32 %20, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0))
%22 = load i32, i32* @stderr
%23 = call i32 @fprintf(i32 %22, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.2, i64 0, i64 0))
%24 = load i32, i32* @stderr
%25 = call i32 @fprintf(i32 %24, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.3, i64 0, i64 0))
store i32 1, i32* %3
br label %365
26: ; preds = %14
%27 = load i8**, i8*** %5
%28 = getelementptr inbounds i8*, i8** %27, i64 1
%29 = load i8*, i8** %28
%30 = load i32, i32* %4
%31 = icmp slt i32 %30, 3
%32 = zext i1 %31 to i64
%33 = select i1 %31, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0)
%34 = call i32* @fopen(i8* %29, i8* %33)
store i32* %34, i32** %8
%35 = load i32*, i32** %8
%36 = icmp ne i32* %35, null
br i1 %36, label %39, label %37
37: ; preds = %26
%38 = call i32 @perror(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0))
store i32 1, i32* %3
br label %365
39: ; preds = %26
%40 = load i32*, i32** %8
%41 = load i32, i32* @SEEK_SET
%42 = call i64 @fseek(i32* %40, i32 89, i32 %41)
%43 = icmp ne i64 %42, 0
br i1 %43, label %44, label %46
44: ; preds = %39
%45 = call i32 @perror(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.7, i64 0, i64 0))
store i32 1, i32* %3
br label %365
46: ; preds = %39
%47 = getelementptr inbounds [6 x i8], [6 x i8]* %7, i64 0, i64 0
%48 = load i32*, i32** %8
%49 = call i32 @fread(i8* %47, i32 1, i32 6, i32* %48)
%50 = sext i32 %49 to i64
%51 = icmp ne i64 %50, 6
br i1 %51, label %52, label %54
52: ; preds = %46
%53 = call i32 @perror(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.8, i64 0, i64 0))
store i32 1, i32* %3
br label %365
54: ; preds = %46
%55 = load i32, i32* %4
%56 = icmp slt i32 %55, 3
br i1 %56, label %57, label %132
57: ; preds = %54
%58 = getelementptr inbounds [6 x i8], [6 x i8]* %7, i64 0, i64 0
%59 = load i8, i8* %58
%60 = sext i8 %59 to i32
%61 = and i32 %60, 127
%62 = trunc i32 %61 to i8
%63 = call signext i8 @decode_6bit(i8 signext %62)
%64 = getelementptr inbounds [8 x i8], [8 x i8]* %6, i64 0, i64 0
store i8 %63, i8* %64
%65 = getelementptr inbounds [6 x i8], [6 x i8]* %7, i64 0, i64 1
%66 = load i8, i8* %65
%67 = sext i8 %66 to i32
%68 = and i32 %67, 62
%69 = ashr i32 %68, 1
%70 = trunc i32 %69 to i8
%71 = call signext i8 @decode_5bit(i8 signext %70)
%72 = getelementptr inbounds [8 x i8], [8 x i8]* %6, i64 0, i64 1
store i8 %71, i8* %72
%73 = getelementptr inbounds [6 x i8], [6 x i8]* %7, i64 0, i64 2
%74 = load i8, i8* %73
%75 = sext i8 %74 to i32
%76 = and i32 %75, 240
%77 = ashr i32 %76, 4
%78 = getelementptr inbounds [6 x i8], [6 x i8]* %7, i64 0, i64 1
%79 = load i8, i8* %78
%80 = sext i8 %79 to i32
%81 = and i32 %80, 1
%82 = shl i32 %81, 4
%83 = or i32 %77, %82
%84 = trunc i32 %83 to i8
%85 = call signext i8 @decode_5bit(i8 signext %84)
%86 = getelementptr inbounds [8 x i8], [8 x i8]* %6, i64 0, i64 2
store i8 %85, i8* %86
%87 = getelementptr inbounds [6 x i8], [6 x i8]* %7, i64 0, i64 2
%88 = load i8, i8* %87
%89 = sext i8 %88 to i32
%90 = and i32 %89, 15
%91 = shl i32 %90, 1
%92 = getelementptr inbounds [6 x i8], [6 x i8]* %7, i64 0, i64 3
%93 = load i8, i8* %92
%94 = sext i8 %93 to i32
%95 = and i32 %94, 128
%96 = ashr i32 %95, 7
%97 = or i32 %91, %96
%98 = trunc i32 %97 to i8
%99 = call signext i8 @decode_5bit(i8 signext %98)
%100 = getelementptr inbounds [8 x i8], [8 x i8]* %6, i64 0, i64 3
store i8 %99, i8* %100
%101 = getelementptr inbounds [6 x i8], [6 x i8]* %7, i64 0, i64 3
%102 = load i8, i8* %101
%103 = sext i8 %102 to i32
%104 = and i32 %103, 124
%105 = ashr i32 %104, 2
%106 = trunc i32 %105 to i8
%107 = call signext i8 @decode_5bit(i8 signext %106)
%108 = getelementptr inbounds [8 x i8], [8 x i8]* %6, i64 0, i64 4
store i8 %107, i8* %108
%109 = getelementptr inbounds [6 x i8], [6 x i8]* %7, i64 0, i64 3
%110 = load i8, i8* %109
%111 = sext i8 %110 to i32
%112 = and i32 %111, 3
%113 = shl i32 %112, 3
%114 = getelementptr inbounds [6 x i8], [6 x i8]* %7, i64 0, i64 4
%115 = load i8, i8* %114
%116 = sext i8 %115 to i32
%117 = and i32 %116, 224
%118 = ashr i32 %117, 5
%119 = or i32 %113, %118
%120 = trunc i32 %119 to i8
%121 = call signext i8 @decode_5bit(i8 signext %120)
%122 = getelementptr inbounds [8 x i8], [8 x i8]* %6, i64 0, i64 5
store i8 %121, i8* %122
%123 = getelementptr inbounds [6 x i8], [6 x i8]* %7, i64 0, i64 4
%124 = load i8, i8* %123
%125 = sext i8 %124 to i32
%126 = and i32 %125, 31
%127 = trunc i32 %126 to i8
%128 = call signext i8 @decode_5bit(i8 signext %127)
%129 = getelementptr inbounds [8 x i8], [8 x i8]* %6, i64 0, i64 6
store i8 %128, i8* %129
%130 = getelementptr inbounds [8 x i8], [8 x i8]* %6, i64 0, i64 0
%131 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i8* %130)
br label %132
132: ; preds = %57, %54
%133 = load i32, i32* %4
%134 = icmp sgt i32 %133, 2
br i1 %134, label %135, label %358
135: ; preds = %132
%136 = load i8**, i8*** %5
%137 = getelementptr inbounds i8*, i8** %136, i64 2
%138 = load i8*, i8** %137
%139 = call i32 @strlen(i8* %138)
%140 = icmp ne i32 %139, 7
br i1 %140, label %141, label %143
141: ; preds = %135
%142 = call i32 (...) @invalid_tag()
br label %143
143: ; preds = %141, %135
%144 = getelementptr inbounds [6 x i8], [6 x i8]* %7, i64 0, i64 1
%145 = call i32 @memset(i8* %144, i32 0, i32 5)
%146 = getelementptr inbounds [6 x i8], [6 x i8]* %7, i64 0, i64 0
%147 = load i8, i8* %146
%148 = sext i8 %147 to i32
%149 = and i32 %148, 128
%150 = trunc i32 %149 to i8
store i8 %150, i8* %146
%151 = load i8**, i8*** %5
%152 = getelementptr inbounds i8*, i8** %151, i64 2
%153 = load i8*, i8** %152
%154 = getelementptr inbounds i8, i8* %153, i64 0
%155 = load i8, i8* %154
%156 = call i32 @toupper(i8 signext %155)
%157 = call zeroext i8 @encode_6bit(i32 %156)
store i8 %157, i8* %9
%158 = load i8, i8* %9
%159 = zext i8 %158 to i32
%160 = icmp eq i32 %159, 255
br i1 %160, label %161, label %163
161: ; preds = %143
%162 = call i32 (...) @invalid_tag()
br label %163
163: ; preds = %161, %143
%164 = load i8, i8* %9
%165 = zext i8 %164 to i32
%166 = or i32 %165, 128
%167 = trunc i32 %166 to i8
%168 = getelementptr inbounds [6 x i8], [6 x i8]* %7, i64 0, i64 0
store i8 %167, i8* %168
%169 = load i8**, i8*** %5
%170 = getelementptr inbounds i8*, i8** %169, i64 2
%171 = load i8*, i8** %170
%172 = getelementptr inbounds i8, i8* %171, i64 1
%173 = load i8, i8* %172
%174 = call i32 @toupper(i8 signext %173)
%175 = call zeroext i8 @encode_5bit(i32 %174)
store i8 %175, i8* %9
%176 = load i8, i8* %9
%177 = zext i8 %176 to i32
%178 = icmp eq i32 %177, 255
br i1 %178, label %179, label %181
179: ; preds = %163
%180 = call i32 (...) @invalid_tag()
br label %181
181: ; preds = %179, %163
%182 = load i8, i8* %9
%183 = zext i8 %182 to i32
%184 = shl i32 %183, 1
%185 = getelementptr inbounds [6 x i8], [6 x i8]* %7, i64 0, i64 1
%186 = load i8, i8* %185
%187 = sext i8 %186 to i32
%188 = or i32 %187, %184
%189 = trunc i32 %188 to i8
store i8 %189, i8* %185
%190 = load i8**, i8*** %5
%191 = getelementptr inbounds i8*, i8** %190, i64 2
%192 = load i8*, i8** %191
%193 = getelementptr inbounds i8, i8* %192, i64 2
%194 = load i8, i8* %193
%195 = call i32 @toupper(i8 signext %194)
%196 = call zeroext i8 @encode_5bit(i32 %195)
store i8 %196, i8* %9
%197 = load i8, i8* %9
%198 = zext i8 %197 to i32
%199 = icmp eq i32 %198, 255
br i1 %199, label %200, label %202
200: ; preds = %181
%201 = call i32 (...) @invalid_tag()
br label %202
202: ; preds = %200, %181
%203 = load i8, i8* %9
%204 = zext i8 %203 to i32
%205 = and i32 %204, 16
%206 = ashr i32 %205, 4
%207 = getelementptr inbounds [6 x i8], [6 x i8]* %7, i64 0, i64 1
%208 = load i8, i8* %207
%209 = sext i8 %208 to i32
%210 = or i32 %209, %206
%211 = trunc i32 %210 to i8
store i8 %211, i8* %207
%212 = load i8, i8* %9
%213 = zext i8 %212 to i32
%214 = and i32 %213, 15
%215 = shl i32 %214, 4
%216 = getelementptr inbounds [6 x i8], [6 x i8]* %7, i64 0, i64 2
%217 = load i8, i8* %216
%218 = sext i8 %217 to i32
%219 = or i32 %218, %215
%220 = trunc i32 %219 to i8
store i8 %220, i8* %216
%221 = load i8**, i8*** %5
%222 = getelementptr inbounds i8*, i8** %221, i64 2
%223 = load i8*, i8** %222
%224 = getelementptr inbounds i8, i8* %223, i64 3
%225 = load i8, i8* %224
%226 = call i32 @toupper(i8 signext %225)
%227 = call zeroext i8 @encode_5bit(i32 %226)
store i8 %227, i8* %9
%228 = load i8, i8* %9
%229 = zext i8 %228 to i32
%230 = icmp eq i32 %229, 255
br i1 %230, label %231, label %233
231: ; preds = %202
%232 = call i32 (...) @invalid_tag()
br label %233
233: ; preds = %231, %202
%234 = load i8, i8* %9
%235 = zext i8 %234 to i32
%236 = and i32 %235, 30
%237 = ashr i32 %236, 1
%238 = getelementptr inbounds [6 x i8], [6 x i8]* %7, i64 0, i64 2
%239 = load i8, i8* %238
%240 = sext i8 %239 to i32
%241 = or i32 %240, %237
%242 = trunc i32 %241 to i8
store i8 %242, i8* %238
%243 = load i8, i8* %9
%244 = zext i8 %243 to i32
%245 = and i32 %244, 1
%246 = shl i32 %245, 7
%247 = getelementptr inbounds [6 x i8], [6 x i8]* %7, i64 0, i64 3
%248 = load i8, i8* %247
%249 = sext i8 %248 to i32
%250 = or i32 %249, %246
%251 = trunc i32 %250 to i8
store i8 %251, i8* %247
%252 = load i8**, i8*** %5
%253 = getelementptr inbounds i8*, i8** %252, i64 2
%254 = load i8*, i8** %253
%255 = getelementptr inbounds i8, i8* %254, i64 4
%256 = load i8, i8* %255
%257 = call i32 @toupper(i8 signext %256)
%258 = call zeroext i8 @encode_5bit(i32 %257)
store i8 %258, i8* %9
%259 = load i8, i8* %9
%260 = zext i8 %259 to i32
%261 = icmp eq i32 %260, 255
br i1 %261, label %262, label %264
262: ; preds = %233
%263 = call i32 (...) @invalid_tag()
br label %264
264: ; preds = %262, %233
%265 = load i8, i8* %9
%266 = zext i8 %265 to i32
%267 = shl i32 %266, 2
%268 = getelementptr inbounds [6 x i8], [6 x i8]* %7, i64 0, i64 3
%269 = load i8, i8* %268
%270 = sext i8 %269 to i32
%271 = or i32 %270, %267
%272 = trunc i32 %271 to i8
store i8 %272, i8* %268
%273 = load i8**, i8*** %5
%274 = getelementptr inbounds i8*, i8** %273, i64 2
%275 = load i8*, i8** %274
%276 = getelementptr inbounds i8, i8* %275, i64 5
%277 = load i8, i8* %276
%278 = call i32 @toupper(i8 signext %277)
%279 = call zeroext i8 @encode_5bit(i32 %278)
store i8 %279, i8* %9
%280 = load i8, i8* %9
%281 = zext i8 %280 to i32
%282 = icmp eq i32 %281, 255
br i1 %282, label %283, label %285
283: ; preds = %264
%284 = call i32 (...) @invalid_tag()
br label %285
285: ; preds = %283, %264
%286 = load i8, i8* %9
%287 = zext i8 %286 to i32
%288 = and i32 %287, 24
%289 = ashr i32 %288, 3
%290 = getelementptr inbounds [6 x i8], [6 x i8]* %7, i64 0, i64 3
%291 = load i8, i8* %290
%292 = sext i8 %291 to i32
%293 = or i32 %292, %289
%294 = trunc i32 %293 to i8
store i8 %294, i8* %290
%295 = load i8, i8* %9
%296 = zext i8 %295 to i32
%297 = and i32 %296, 7
%298 = shl i32 %297, 5
%299 = getelementptr inbounds [6 x i8], [6 x i8]* %7, i64 0, i64 4
%300 = load i8, i8* %299
%301 = sext i8 %300 to i32
%302 = or i32 %301, %298
%303 = trunc i32 %302 to i8
store i8 %303, i8* %299
%304 = load i8**, i8*** %5
%305 = getelementptr inbounds i8*, i8** %304, i64 2
%306 = load i8*, i8** %305
%307 = getelementptr inbounds i8, i8* %306, i64 6
%308 = load i8, i8* %307
%309 = call i32 @toupper(i8 signext %308)
%310 = call zeroext i8 @encode_5bit(i32 %309)
store i8 %310, i8* %9
%311 = load i8, i8* %9
%312 = zext i8 %311 to i32
%313 = icmp eq i32 %312, 255
br i1 %313, label %314, label %316
314: ; preds = %285
%315 = call i32 (...) @invalid_tag()
br label %316
316: ; preds = %314, %285
%317 = load i8, i8* %9
%318 = zext i8 %317 to i32
%319 = getelementptr inbounds [6 x i8], [6 x i8]* %7, i64 0, i64 4
%320 = load i8, i8* %319
%321 = sext i8 %320 to i32
%322 = or i32 %321, %318
%323 = trunc i32 %322 to i8
store i8 %323, i8* %319
store i32 0, i32* %10
br label %324
324: ; preds = %339, %316
%325 = load i32, i32* %10
%326 = zext i32 %325 to i64
%327 = icmp ult i64 %326, 5
br i1 %327, label %328, label %342
328: ; preds = %324
%329 = load i32, i32* %10
%330 = zext i32 %329 to i64
%331 = getelementptr inbounds [6 x i8], [6 x i8]* %7, i64 0, i64 %330
%332 = load i8, i8* %331
%333 = sext i8 %332 to i32
%334 = getelementptr inbounds [6 x i8], [6 x i8]* %7, i64 0, i64 5
%335 = load i8, i8* %334
%336 = sext i8 %335 to i32
%337 = add nsw i32 %336, %333
%338 = trunc i32 %337 to i8
store i8 %338, i8* %334
br label %339
339: ; preds = %328
%340 = load i32, i32* %10
%341 = add i32 %340, 1
store i32 %341, i32* %10
br label %324
342: ; preds = %324
%343 = load i32*, i32** %8
%344 = load i32, i32* @SEEK_SET
%345 = call i64 @fseek(i32* %343, i32 89, i32 %344)
%346 = icmp ne i64 %345, 0
br i1 %346, label %347, label %349
347: ; preds = %342
%348 = call i32 @perror(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.7, i64 0, i64 0))
store i32 1, i32* %3
br label %365
349: ; preds = %342
%350 = getelementptr inbounds [6 x i8], [6 x i8]* %7, i64 0, i64 0
%351 = load i32*, i32** %8
%352 = call i32 @fwrite(i8* %350, i32 1, i32 6, i32* %351)
%353 = sext i32 %352 to i64
%354 = icmp ne i64 %353, 6
br i1 %354, label %355, label %357
355: ; preds = %349
%356 = call i32 @perror(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.10, i64 0, i64 0))
store i32 1, i32* %3
br label %365
357: ; preds = %349
br label %358
358: ; preds = %357, %132
%359 = load i32*, i32** %8
%360 = call i64 @fclose(i32* %359)
%361 = icmp ne i64 %360, 0
br i1 %361, label %362, label %364
362: ; preds = %358
%363 = call i32 @perror(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.11, i64 0, i64 0))
store i32 1, i32* %3
br label %365
364: ; preds = %358
store i32 0, i32* %3
br label %365
365: ; preds = %364, %362, %355, %347, %52, %44, %37, %17
%366 = load i32, i32* %3
ret i32 %366
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [49 x i8] c"CMOS service tag utility for DELL machines v1.0\0A\00"
@.str.1 = [33 x i8] c"Copyright (c) 2008 Ondrej Zary\0A\0A\00"
@.str.2 = [46 x i8] c"Usage: read tag: dell_service_tag CMOS_FILE\0A\00"
@.str.3 = [53 x i8] c" or write tag: dell_service_tag CMOS_FILE NEWTAG\0A\00"
@.str.4 = [2 x i8] c"r\00"
@.str.5 = [3 x i8] c"r+\00"
@.str.6 = [26 x i8] c"Unable to open CMOS file\0A\00"
@SEEK_SET = global i32 0
@.str.7 = [31 x i8] c"Unable to seek to offset 0x59\0A\00"
@.str.8 = [35 x i8] c"Unable to read tag from CMOS file\0A\00"
@.str.9 = [4 x i8] c"%s\0A\00"
@.str.10 = [34 x i8] c"Unable to write tag to CMOS file\0A\00"
@.str.11 = [25 x i8] c"Error closing CMOS file\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i64
%4 = bitcast i64* %3 to [8 x i8]*
%5 = alloca [6 x i8]
%6 = bitcast i64* %3 to i8*
store i64 9042521604759584, i64* %3
%7 = getelementptr inbounds [6 x i8], [6 x i8]* %5, i64 0, i64 0
%8 = add i32 %0, -4
%9 = icmp ult i32 %8, -2
br i1 %9, label %10, label %19
10: ; preds = %2
%11 = load i32, i32* @stderr
%12 = tail call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0))
%13 = load i32, i32* @stderr
%14 = tail call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0))
%15 = load i32, i32* @stderr
%16 = tail call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.2, i64 0, i64 0))
%17 = load i32, i32* @stderr
%18 = tail call i32 @fprintf(i32 %17, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.3, i64 0, i64 0))
br label %215
19: ; preds = %2
%20 = getelementptr inbounds i8*, i8** %1, i64 1
%21 = load i8*, i8** %20
%22 = icmp ult i32 %0, 3
%23 = select i1 %22, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0)
%24 = tail call i32* @fopen(i8* %21, i8* %23)
%25 = icmp eq i32* %24, null
br i1 %25, label %26, label %28
26: ; preds = %19
%27 = tail call i32 @perror(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0))
br label %215
28: ; preds = %19
%29 = load i32, i32* @SEEK_SET
%30 = tail call i64 @fseek(i32* %24, i32 89, i32 %29)
%31 = icmp eq i64 %30, 0
br i1 %31, label %34, label %32
32: ; preds = %28
%33 = tail call i32 @perror(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.7, i64 0, i64 0))
br label %215
34: ; preds = %28
%35 = call i32 @fread(i8* %7, i32 1, i32 6, i32* %24)
%36 = icmp eq i32 %35, 6
br i1 %36, label %39, label %37
37: ; preds = %34
%38 = tail call i32 @perror(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.8, i64 0, i64 0))
br label %215
39: ; preds = %34
br i1 %22, label %40, label %82
40: ; preds = %39
%41 = load i8, i8* %7
%42 = and i8 %41, 127
%43 = tail call signext i8 @decode_6bit(i8 signext %42)
store i8 %43, i8* %6
%44 = getelementptr inbounds [6 x i8], [6 x i8]* %5, i64 0, i64 1
%45 = load i8, i8* %44
%46 = lshr i8 %45, 1
%47 = and i8 %46, 31
%48 = tail call signext i8 @decode_5bit(i8 signext %47)
%49 = getelementptr inbounds [8 x i8], [8 x i8]* %4, i64 0, i64 1
store i8 %48, i8* %49
%50 = getelementptr inbounds [6 x i8], [6 x i8]* %5, i64 0, i64 2
%51 = load i8, i8* %50
%52 = lshr i8 %51, 4
%53 = shl i8 %45, 4
%54 = and i8 %53, 16
%55 = or i8 %54, %52
%56 = tail call signext i8 @decode_5bit(i8 signext %55)
%57 = getelementptr inbounds [8 x i8], [8 x i8]* %4, i64 0, i64 2
store i8 %56, i8* %57
%58 = shl i8 %51, 1
%59 = and i8 %58, 30
%60 = getelementptr inbounds [6 x i8], [6 x i8]* %5, i64 0, i64 3
%61 = load i8, i8* %60
%62 = lshr i8 %61, 7
%63 = or i8 %59, %62
%64 = tail call signext i8 @decode_5bit(i8 signext %63)
%65 = getelementptr inbounds [8 x i8], [8 x i8]* %4, i64 0, i64 3
store i8 %64, i8* %65
%66 = lshr i8 %61, 2
%67 = and i8 %66, 31
%68 = tail call signext i8 @decode_5bit(i8 signext %67)
%69 = getelementptr inbounds [8 x i8], [8 x i8]* %4, i64 0, i64 4
store i8 %68, i8* %69
%70 = shl i8 %61, 3
%71 = and i8 %70, 24
%72 = getelementptr inbounds [6 x i8], [6 x i8]* %5, i64 0, i64 4
%73 = load i8, i8* %72
%74 = lshr i8 %73, 5
%75 = or i8 %71, %74
%76 = tail call signext i8 @decode_5bit(i8 signext %75)
%77 = getelementptr inbounds [8 x i8], [8 x i8]* %4, i64 0, i64 5
store i8 %76, i8* %77
%78 = and i8 %73, 31
%79 = tail call signext i8 @decode_5bit(i8 signext %78)
%80 = getelementptr inbounds [8 x i8], [8 x i8]* %4, i64 0, i64 6
store i8 %79, i8* %80
%81 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i8* %6)
br label %210
82: ; preds = %39
%83 = getelementptr inbounds i8*, i8** %1, i64 2
%84 = load i8*, i8** %83
%85 = tail call i32 @strlen(i8* %84)
%86 = icmp eq i32 %85, 7
br i1 %86, label %89, label %87
87: ; preds = %82
%88 = tail call i32 (...) @invalid_tag()
br label %89
89: ; preds = %87, %82
%90 = getelementptr inbounds [6 x i8], [6 x i8]* %5, i64 0, i64 1
%91 = call i32 @memset(i8* %90, i32 0, i32 5)
%92 = load i8, i8* %7
%93 = and i8 %92, -128
store i8 %93, i8* %7
%94 = load i8*, i8** %83
%95 = load i8, i8* %94
%96 = call i32 @toupper(i8 signext %95)
%97 = call zeroext i8 @encode_6bit(i32 %96)
%98 = icmp eq i8 %97, -1
br i1 %98, label %99, label %101
99: ; preds = %89
%100 = call i32 (...) @invalid_tag()
br label %101
101: ; preds = %99, %89
%102 = or i8 %97, -128
store i8 %102, i8* %7
%103 = load i8*, i8** %83
%104 = getelementptr inbounds i8, i8* %103, i64 1
%105 = load i8, i8* %104
%106 = call i32 @toupper(i8 signext %105)
%107 = call zeroext i8 @encode_5bit(i32 %106)
%108 = icmp eq i8 %107, -1
br i1 %108, label %109, label %111
109: ; preds = %101
%110 = call i32 (...) @invalid_tag()
br label %111
111: ; preds = %109, %101
%112 = shl i8 %107, 1
%113 = load i8, i8* %90
%114 = or i8 %113, %112
store i8 %114, i8* %90
%115 = load i8*, i8** %83
%116 = getelementptr inbounds i8, i8* %115, i64 2
%117 = load i8, i8* %116
%118 = call i32 @toupper(i8 signext %117)
%119 = call zeroext i8 @encode_5bit(i32 %118)
%120 = icmp eq i8 %119, -1
br i1 %120, label %121, label %123
121: ; preds = %111
%122 = call i32 (...) @invalid_tag()
br label %123
123: ; preds = %121, %111
%124 = lshr i8 %119, 4
%125 = and i8 %124, 1
%126 = load i8, i8* %90
%127 = or i8 %126, %125
store i8 %127, i8* %90
%128 = shl i8 %119, 4
%129 = getelementptr inbounds [6 x i8], [6 x i8]* %5, i64 0, i64 2
%130 = load i8, i8* %129
%131 = or i8 %130, %128
store i8 %131, i8* %129
%132 = load i8*, i8** %83
%133 = getelementptr inbounds i8, i8* %132, i64 3
%134 = load i8, i8* %133
%135 = call i32 @toupper(i8 signext %134)
%136 = call zeroext i8 @encode_5bit(i32 %135)
%137 = icmp eq i8 %136, -1
br i1 %137, label %138, label %140
138: ; preds = %123
%139 = call i32 (...) @invalid_tag()
br label %140
140: ; preds = %138, %123
%141 = lshr i8 %136, 1
%142 = and i8 %141, 15
%143 = load i8, i8* %129
%144 = or i8 %143, %142
store i8 %144, i8* %129
%145 = shl i8 %136, 7
%146 = getelementptr inbounds [6 x i8], [6 x i8]* %5, i64 0, i64 3
%147 = load i8, i8* %146
%148 = or i8 %147, %145
store i8 %148, i8* %146
%149 = load i8*, i8** %83
%150 = getelementptr inbounds i8, i8* %149, i64 4
%151 = load i8, i8* %150
%152 = call i32 @toupper(i8 signext %151)
%153 = call zeroext i8 @encode_5bit(i32 %152)
%154 = icmp eq i8 %153, -1
br i1 %154, label %155, label %157
155: ; preds = %140
%156 = call i32 (...) @invalid_tag()
br label %157
157: ; preds = %155, %140
%158 = shl i8 %153, 2
%159 = load i8, i8* %146
%160 = or i8 %159, %158
store i8 %160, i8* %146
%161 = load i8*, i8** %83
%162 = getelementptr inbounds i8, i8* %161, i64 5
%163 = load i8, i8* %162
%164 = call i32 @toupper(i8 signext %163)
%165 = call zeroext i8 @encode_5bit(i32 %164)
%166 = icmp eq i8 %165, -1
br i1 %166, label %167, label %169
167: ; preds = %157
%168 = call i32 (...) @invalid_tag()
br label %169
169: ; preds = %167, %157
%170 = lshr i8 %165, 3
%171 = and i8 %170, 3
%172 = load i8, i8* %146
%173 = or i8 %172, %171
store i8 %173, i8* %146
%174 = shl i8 %165, 5
%175 = getelementptr inbounds [6 x i8], [6 x i8]* %5, i64 0, i64 4
%176 = load i8, i8* %175
%177 = or i8 %176, %174
store i8 %177, i8* %175
%178 = load i8*, i8** %83
%179 = getelementptr inbounds i8, i8* %178, i64 6
%180 = load i8, i8* %179
%181 = call i32 @toupper(i8 signext %180)
%182 = call zeroext i8 @encode_5bit(i32 %181)
%183 = icmp eq i8 %182, -1
br i1 %183, label %184, label %186
184: ; preds = %169
%185 = call i32 (...) @invalid_tag()
br label %186
186: ; preds = %184, %169
%187 = load i8, i8* %175
%188 = or i8 %187, %182
store i8 %188, i8* %175
%189 = getelementptr inbounds [6 x i8], [6 x i8]* %5, i64 0, i64 5
%190 = load i8, i8* %7
%191 = load i8, i8* %189
%192 = add i8 %191, %190
%193 = load i8, i8* %90
%194 = add i8 %192, %193
%195 = load i8, i8* %129
%196 = add i8 %194, %195
%197 = load i8, i8* %146
%198 = add i8 %196, %197
%199 = add i8 %198, %188
store i8 %199, i8* %189
%200 = load i32, i32* @SEEK_SET
%201 = call i64 @fseek(i32* %24, i32 89, i32 %200)
%202 = icmp eq i64 %201, 0
br i1 %202, label %205, label %203
203: ; preds = %186
%204 = call i32 @perror(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.7, i64 0, i64 0))
br label %215
205: ; preds = %186
%206 = call i32 @fwrite(i8* %7, i32 1, i32 6, i32* %24)
%207 = icmp eq i32 %206, 6
br i1 %207, label %210, label %208
208: ; preds = %205
%209 = call i32 @perror(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.10, i64 0, i64 0))
br label %215
210: ; preds = %205, %40
%211 = call i64 @fclose(i32* %24)
%212 = icmp eq i64 %211, 0
br i1 %212, label %215, label %213
213: ; preds = %210
%214 = call i32 @perror(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.11, i64 0, i64 0))
br label %215
215: ; preds = %203, %208, %26, %32, %37, %213, %210, %10
%216 = phi i32 [ 1, %10 ], [ 1, %32 ], [ 1, %37 ], [ 1, %213 ], [ 1, %26 ], [ 0, %210 ], [ 1, %208 ], [ 1, %203 ]
ret i32 %216
}