#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 */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ feof(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, int *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ rewind(int /*<<< orphan*/ *);
int main() {
  FILE *rx = fopen("rx2.txt", "r");
  FILE *tx = fopen("tx2.txt", "r");
  FILE *header = fopen("header.txt", "r");
  int rdata, tdata, hdata;
  fscanf(rx, "%x", &rdata);
  fscanf(tx, "%x", &tdata);
  fscanf(header, "%x", &hdata);
  int rlen = 0, tlen = 0, hlen = 0;
  printf("rdata:\n");
  while (!feof(rx)) {
    rlen++;
    fscanf(rx, "%x", &rdata);
    printf("%04x : %02x ", rlen, rdata);
    if (rlen % 10 == 0)
      printf("\n");
  }
  printf("\nrx length %d\n", rlen);
  printf("tdata:\n");
  while (!feof(tx)) {
    tlen++;
    fscanf(tx, "%x", &tdata);
    printf("%04x : %02x ", tlen, tdata);
    if (tlen % 10 == 0)
      printf("\n");
  }
  printf("\ntx length %d\n", tlen);
  printf("header:\n");
  while (!feof(header)) {
    hlen++;
    printf("%04x : %02x ", hlen, hdata);
    fscanf(header, "%x", &hdata);
    if (hlen % 10 == 0)
      printf("\n");
  }
  printf("\nheader length %d\n", hlen);
  rewind(tx);
  rewind(rx);
  fscanf(rx, "%x", &rdata);
  fscanf(tx, "%x", &tdata);
  rlen = 0;
  tlen = 0;
  while (!feof(rx) && !feof(tx)) {
    rlen++;
    if (rdata != tdata)
      printf(
          "%04x:rdata = hex:%02x | dec:%03d -- tdata = hex:%02x | dex:%0xd\n",
          rlen, rdata, rdata, tdata, tdata);
    fscanf(rx, "%x", &rdata);
    fscanf(tx, "%x", &tdata);
  }
  fclose(tx);
  fclose(rx);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe8a(%rip),%rdi
lea    0xe8b(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x10(%rbp)
lea    0xe7d(%rip),%rdi
lea    0xe74(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x18(%rbp)
lea    0xe6e(%rip),%rdi
lea    0xe5d(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe5e(%rip),%rsi
lea    -0x24(%rbp),%rdx
call   1060 <fscanf@plt>
mov    -0x18(%rbp),%rdi
lea    0xe4a(%rip),%rsi
lea    -0x28(%rbp),%rdx
call   1060 <fscanf@plt>
mov    -0x20(%rbp),%rdi
lea    0xe36(%rip),%rsi
lea    -0x2c(%rbp),%rdx
call   1060 <fscanf@plt>
movl   $0x0,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
movl   $0x0,-0x38(%rbp)
lea    0xe14(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1070 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1231 <main+0xd1>
jmp    1289 <main+0x129>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xdd8(%rip),%rsi
lea    -0x24(%rbp),%rdx
call   1060 <fscanf@plt>
mov    -0x30(%rbp),%esi
mov    -0x24(%rbp),%edx
lea    0xdcd(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x30(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1284 <main+0x124>
lea    0xda9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1213 <main+0xb3>
mov    -0x30(%rbp),%esi
lea    0xda2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xda3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1070 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    12c6 <main+0x166>
jmp    131e <main+0x1be>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xd43(%rip),%rsi
lea    -0x28(%rbp),%rdx
call   1060 <fscanf@plt>
mov    -0x34(%rbp),%esi
mov    -0x28(%rbp),%edx
lea    0xd38(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x34(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1319 <main+0x1b9>
lea    0xd14(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    12a8 <main+0x148>
mov    -0x34(%rbp),%esi
lea    0xd24(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xd25(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x20(%rbp),%rdi
call   1070 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    135b <main+0x1fb>
jmp    13b3 <main+0x253>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
mov    -0x38(%rbp),%esi
mov    -0x2c(%rbp),%edx
lea    0xcb7(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x20(%rbp),%rdi
lea    0xc9a(%rip),%rsi
lea    -0x2c(%rbp),%rdx
call   1060 <fscanf@plt>
mov    -0x38(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    13ae <main+0x24e>
lea    0xc7f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    133d <main+0x1dd>
mov    -0x38(%rbp),%esi
lea    0xca7(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1050 <rewind@plt>
mov    -0x10(%rbp),%rdi
call   1050 <rewind@plt>
mov    -0x10(%rbp),%rdi
lea    0xc3c(%rip),%rsi
lea    -0x24(%rbp),%rdx
call   1060 <fscanf@plt>
mov    -0x18(%rbp),%rdi
lea    0xc28(%rip),%rsi
lea    -0x28(%rbp),%rdx
call   1060 <fscanf@plt>
movl   $0x0,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x10(%rbp),%rdi
call   1070 <feof@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x39(%rbp)
jne    1439 <main+0x2d9>
mov    -0x18(%rbp),%rdi
call   1070 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
mov    %al,-0x39(%rbp)
mov    -0x39(%rbp),%al
test   $0x1,%al
jne    1449 <main+0x2e9>
jmp    14aa <main+0x34a>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x28(%rbp),%eax
je     147d <main+0x31d>
mov    -0x30(%rbp),%esi
mov    -0x24(%rbp),%edx
mov    -0x24(%rbp),%ecx
mov    -0x28(%rbp),%r8d
mov    -0x28(%rbp),%r9d
lea    0xc01(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rdi
lea    0xb95(%rip),%rsi
lea    -0x24(%rbp),%rdx
call   1060 <fscanf@plt>
mov    -0x18(%rbp),%rdi
lea    0xb81(%rip),%rsi
lea    -0x28(%rbp),%rdx
call   1060 <fscanf@plt>
jmp    140c <main+0x2ac>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
lea    0xe6b(%rip),%rdi
lea    0xe6c(%rip),%r14
mov    %r14,%rsi
call   10a0 <fopen@plt>
mov    %rax,%rbp
lea    0xe5c(%rip),%rdi
mov    %r14,%rsi
call   10a0 <fopen@plt>
mov    %rax,%r15
lea    0xe52(%rip),%rdi
mov    %r14,%rsi
call   10a0 <fopen@plt>
mov    %rax,%rbx
lea    0xe4b(%rip),%r14
lea    0x8(%rsp),%rdx
mov    %rbp,%rdi
mov    %r14,%rsi
call   1080 <fscanf@plt>
lea    0x4(%rsp),%rdx
mov    %r15,0x10(%rsp)
mov    %r15,%rdi
mov    %r14,%rsi
call   1080 <fscanf@plt>
lea    0xc(%rsp),%rdx
mov    %rbx,0x20(%rsp)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1080 <fscanf@plt>
lea    0xe8c(%rip),%rdi
call   1040 <puts@plt>
mov    %rbp,%rdi
call   1090 <feof@plt>
xor    %r12d,%r12d
mov    $0x0,%ebx
test   %eax,%eax
je     1320 <main+0x1a0>
mov    %rbp,0x18(%rsp)
lea    0xdf1(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe5a(%rip),%rdi
call   1040 <puts@plt>
mov    0x10(%rsp),%r15
mov    %r15,%rdi
call   1090 <feof@plt>
test   %eax,%eax
je     139f <main+0x21f>
lea    0xdcf(%rip),%rdi
xor    %r14d,%r14d
mov    %r12d,%esi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe2c(%rip),%rdi
call   1040 <puts@plt>
mov    0x20(%rsp),%r12
mov    %r12,%rdi
call   1090 <feof@plt>
test   %eax,%eax
je     141a <main+0x29a>
lea    0xda9(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x10(%rsp),%r12
mov    %r12,%rdi
call   1070 <rewind@plt>
mov    0x18(%rsp),%rbp
mov    %rbp,%rdi
call   1070 <rewind@plt>
lea    0xd50(%rip),%rbx
lea    0x8(%rsp),%rdx
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1080 <fscanf@plt>
lea    0x4(%rsp),%rdx
mov    %r12,%rdi
mov    %rbx,%rsi
call   1080 <fscanf@plt>
mov    %rbp,%rdi
call   1090 <feof@plt>
test   %eax,%eax
je     149c <main+0x31c>
mov    %r12,%rdi
call   1050 <fclose@plt>
mov    0x18(%rsp),%rdi
call   1050 <fclose@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    $0x1,%r13d
xor    %ebx,%ebx
jmp    1344 <main+0x1c4>
nopw   0x0(%rax,%rax,1)
mov    %rbp,%rdi
call   1090 <feof@plt>
add    $0x1,%r13d
test   %eax,%eax
jne    1230 <main+0xb0>
mov    %ebx,%r15d
mov    %r13d,%eax
mov    $0xcccccccd,%ecx
imul   %rcx,%rax
shr    $0x23,%rax
lea    (%rax,%rax,4),%eax
lea    (%rax,%rax,1),%r14d
add    $0xffffffff,%r14d
lea    0x1(%r15),%ebx
mov    %rbp,%rdi
lea    0xcad(%rip),%rsi
lea    0x8(%rsp),%rdx
call   1080 <fscanf@plt>
mov    0x8(%rsp),%edx
lea    0xc9b(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1060 <printf@plt>
cmp    %r15d,%r14d
jne    1330 <main+0x1b0>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    1330 <main+0x1b0>
mov    $0x1,%ebx
lea    0xc75(%rip),%r13
xor    %r12d,%r12d
jmp    13c3 <main+0x243>
mov    %r15,%rdi
call   1090 <feof@plt>
add    $0x1,%ebx
test   %eax,%eax
jne    1266 <main+0xe6>
mov    %r12d,%ebp
mov    %ebx,%eax
mov    $0xcccccccd,%ecx
imul   %rcx,%rax
shr    $0x23,%rax
lea    (%rax,%rax,4),%eax
lea    (%rax,%rax,1),%r14d
add    $0xffffffff,%r14d
lea    0x1(%rbp),%r12d
mov    %r15,%rdi
lea    0xc2f(%rip),%rsi
lea    0x4(%rsp),%rdx
call   1080 <fscanf@plt>
mov    0x4(%rsp),%edx
mov    %r13,%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1060 <printf@plt>
cmp    %ebp,%r14d
jne    13b0 <main+0x230>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    13b0 <main+0x230>
mov    $0x1,%ebp
lea    0xc(%rsp),%r13
xor    %r14d,%r14d
jmp    1443 <main+0x2c3>
nopl   0x0(%rax)
mov    %r12,%rdi
call   1090 <feof@plt>
add    $0x1,%ebp
test   %eax,%eax
jne    129b <main+0x11b>
mov    %r14d,%ebx
mov    %ebp,%eax
mov    $0xcccccccd,%ecx
imul   %rcx,%rax
shr    $0x23,%rax
lea    (%rax,%rax,4),%eax
lea    (%rax,%rax,1),%r15d
add    $0xffffffff,%r15d
lea    0x1(%rbx),%r14d
mov    0xc(%rsp),%edx
lea    0xbb1(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r12,%rdi
lea    0xb9a(%rip),%rsi
mov    %r13,%rdx
call   1080 <fscanf@plt>
cmp    %ebx,%r15d
jne    1430 <main+0x2b0>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    1430 <main+0x2b0>
mov    $0x1,%ebx
lea    0xb75(%rip),%r14
lea    0x8(%rsp),%r15
lea    0x4(%rsp),%r13
mov    0x18(%rsp),%rbp
jmp    14f4 <main+0x374>
nopl   0x0(%rax)
mov    %rbp,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1080 <fscanf@plt>
mov    0x10(%rsp),%r12
mov    %r12,%rdi
mov    %r14,%rsi
mov    %r13,%rdx
call   1080 <fscanf@plt>
mov    %rbp,%rdi
call   1090 <feof@plt>
add    $0x1,%ebx
test   %eax,%eax
jne    12fd <main+0x17d>
mov    %r12,%rdi
call   1090 <feof@plt>
test   %eax,%eax
jne    12fd <main+0x17d>
mov    0x8(%rsp),%ecx
mov    0x4(%rsp),%r8d
cmp    %r8d,%ecx
je     14c0 <main+0x340>
lea    0xb45(%rip),%rdi
mov    %ebx,%esi
mov    %ecx,%edx
mov    %r8d,%r9d
xor    %eax,%eax
call   1060 <printf@plt>
jmp    14c0 <main+0x340>

LLVM IR (-O0):
@.str = [8 x i8] c"rx2.txt\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [8 x i8] c"tx2.txt\00"
@.str.3 = [11 x i8] c"header.txt\00"
@.str.4 = [3 x i8] c"%x\00"
@.str.5 = [8 x i8] c"rdata:\0A\00"
@.str.6 = [13 x i8] c"%04x : %02x \00"
@.str.7 = [2 x i8] c"\0A\00"
@.str.8 = [15 x i8] c"\0Arx length %d\0A\00"
@.str.9 = [8 x i8] c"tdata:\0A\00"
@.str.10 = [15 x i8] c"\0Atx length %d\0A\00"
@.str.11 = [9 x i8] c"header:\0A\00"
@.str.12 = [19 x i8] c"\0Aheader length %d\0A\00"
@.str.13 = [65 x i8] c"%04x:rdata = hex:%02x | dec:%03d -- tdata = hex:%02x | dex:%0xd\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 0, i32* %1
%11 = call i32* @fopen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %11, i32** %2
%12 = call i32* @fopen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %12, i32** %3
%13 = call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %13, i32** %4
%14 = load i32*, i32** %2
%15 = call i32 @fscanf(i32* %14, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %5)
%16 = load i32*, i32** %3
%17 = call i32 @fscanf(i32* %16, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %6)
%18 = load i32*, i32** %4
%19 = call i32 @fscanf(i32* %18, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %7)
store i32 0, i32* %8
store i32 0, i32* %9
store i32 0, i32* %10
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0))
br label %21
21: ; preds = %39, %0
%22 = load i32*, i32** %2
%23 = call i32 @feof(i32* %22)
%24 = icmp ne i32 %23, 0
%25 = xor i1 %24, true
br i1 %25, label %26, label %40
26: ; preds = %21
%27 = load i32, i32* %8
%28 = add nsw i32 %27, 1
store i32 %28, i32* %8
%29 = load i32*, i32** %2
%30 = call i32 @fscanf(i32* %29, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %5)
%31 = load i32, i32* %8
%32 = load i32, i32* %5
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0), i32 %31, i32 %32)
%34 = load i32, i32* %8
%35 = srem i32 %34, 10
%36 = icmp eq i32 %35, 0
br i1 %36, label %37, label %39
37: ; preds = %26
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
br label %39
39: ; preds = %37, %26
br label %21
40: ; preds = %21
%41 = load i32, i32* %8
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.8, i64 0, i64 0), i32 %41)
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0))
br label %44
44: ; preds = %62, %40
%45 = load i32*, i32** %3
%46 = call i32 @feof(i32* %45)
%47 = icmp ne i32 %46, 0
%48 = xor i1 %47, true
br i1 %48, label %49, label %63
49: ; preds = %44
%50 = load i32, i32* %9
%51 = add nsw i32 %50, 1
store i32 %51, i32* %9
%52 = load i32*, i32** %3
%53 = call i32 @fscanf(i32* %52, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %6)
%54 = load i32, i32* %9
%55 = load i32, i32* %6
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0), i32 %54, i32 %55)
%57 = load i32, i32* %9
%58 = srem i32 %57, 10
%59 = icmp eq i32 %58, 0
br i1 %59, label %60, label %62
60: ; preds = %49
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
br label %62
62: ; preds = %60, %49
br label %44
63: ; preds = %44
%64 = load i32, i32* %9
%65 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.10, i64 0, i64 0), i32 %64)
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.11, i64 0, i64 0))
br label %67
67: ; preds = %85, %63
%68 = load i32*, i32** %4
%69 = call i32 @feof(i32* %68)
%70 = icmp ne i32 %69, 0
%71 = xor i1 %70, true
br i1 %71, label %72, label %86
72: ; preds = %67
%73 = load i32, i32* %10
%74 = add nsw i32 %73, 1
store i32 %74, i32* %10
%75 = load i32, i32* %10
%76 = load i32, i32* %7
%77 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0), i32 %75, i32 %76)
%78 = load i32*, i32** %4
%79 = call i32 @fscanf(i32* %78, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %7)
%80 = load i32, i32* %10
%81 = srem i32 %80, 10
%82 = icmp eq i32 %81, 0
br i1 %82, label %83, label %85
83: ; preds = %72
%84 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
br label %85
85: ; preds = %83, %72
br label %67
86: ; preds = %67
%87 = load i32, i32* %10
%88 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.12, i64 0, i64 0), i32 %87)
%89 = load i32*, i32** %3
%90 = call i32 @rewind(i32* %89)
%91 = load i32*, i32** %2
%92 = call i32 @rewind(i32* %91)
%93 = load i32*, i32** %2
%94 = call i32 @fscanf(i32* %93, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %5)
%95 = load i32*, i32** %3
%96 = call i32 @fscanf(i32* %95, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %6)
store i32 0, i32* %8
store i32 0, i32* %9
br label %97
97: ; preds = %121, %86
%98 = load i32*, i32** %2
%99 = call i32 @feof(i32* %98)
%100 = icmp ne i32 %99, 0
br i1 %100, label %106, label %101
101: ; preds = %97
%102 = load i32*, i32** %3
%103 = call i32 @feof(i32* %102)
%104 = icmp ne i32 %103, 0
%105 = xor i1 %104, true
br label %106
106: ; preds = %101, %97
%107 = phi i1 [ false, %97 ], [ %105, %101 ]
br i1 %107, label %108, label %126
108: ; preds = %106
%109 = load i32, i32* %8
%110 = add nsw i32 %109, 1
store i32 %110, i32* %8
%111 = load i32, i32* %5
%112 = load i32, i32* %6
%113 = icmp ne i32 %111, %112
br i1 %113, label %114, label %121
114: ; preds = %108
%115 = load i32, i32* %8
%116 = load i32, i32* %5
%117 = load i32, i32* %5
%118 = load i32, i32* %6
%119 = load i32, i32* %6
%120 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.13, i64 0, i64 0), i32 %115, i32 %116, i32 %117, i32 %118, i32 %119)
br label %121
121: ; preds = %114, %108
%122 = load i32*, i32** %2
%123 = call i32 @fscanf(i32* %122, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %5)
%124 = load i32*, i32** %3
%125 = call i32 @fscanf(i32* %124, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %6)
br label %97
126: ; preds = %106
%127 = load i32*, i32** %3
%128 = call i32 @fclose(i32* %127)
%129 = load i32*, i32** %2
%130 = call i32 @fclose(i32* %129)
%131 = load i32, i32* %1
ret i32 %131
}

LLVM IR (-O2):
@.str = [8 x i8] c"rx2.txt\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [8 x i8] c"tx2.txt\00"
@.str.3 = [11 x i8] c"header.txt\00"
@.str.4 = [3 x i8] c"%x\00"
@.str.6 = [13 x i8] c"%04x : %02x \00"
@.str.8 = [15 x i8] c"\0Arx length %d\0A\00"
@.str.10 = [15 x i8] c"\0Atx length %d\0A\00"
@.str.12 = [19 x i8] c"\0Aheader length %d\0A\00"
@.str.13 = [65 x i8] c"%04x:rdata = hex:%02x | dec:%03d -- tdata = hex:%02x | dex:%0xd\0A\00"
@str = [7 x i8] c"rdata:\00"
@str.14 = [7 x i8] c"tdata:\00"
@str.15 = [8 x i8] c"header:\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = tail call i32* @fopen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i32* @fopen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, 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 ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%7 = bitcast i32* %1 to i8*
%8 = bitcast i32* %2 to i8*
%9 = bitcast i32* %3 to i8*
%10 = call i32 @fscanf(i32* %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %1)
%11 = call i32 @fscanf(i32* %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %2)
%12 = call i32 @fscanf(i32* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %3)
%13 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
%14 = call i32 @feof(i32* %4)
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %29
16: ; preds = %0, %26
%17 = phi i32 [ %18, %26 ], [ 0, %0 ]
%18 = add nuw nsw i32 %17, 1
%19 = call i32 @fscanf(i32* %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %1)
%20 = load i32, i32* %1
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0), i32 %18, i32 %20)
%22 = urem i32 %18, 10
%23 = icmp eq i32 %22, 0
br i1 %23, label %24, label %26
24: ; preds = %16
%25 = call i32 @putchar(i32 10)
br label %26
26: ; preds = %24, %16
%27 = call i32 @feof(i32* %4)
%28 = icmp eq i32 %27, 0
br i1 %28, label %16, label %29
29: ; preds = %26, %0
%30 = phi i32 [ 0, %0 ], [ %18, %26 ]
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.8, i64 0, i64 0), i32 %30)
%32 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.14, i64 0, i64 0))
%33 = call i32 @feof(i32* %5)
%34 = icmp eq i32 %33, 0
br i1 %34, label %35, label %48
35: ; preds = %29, %45
%36 = phi i32 [ %37, %45 ], [ 0, %29 ]
%37 = add nuw nsw i32 %36, 1
%38 = call i32 @fscanf(i32* %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %2)
%39 = load i32, i32* %2
%40 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0), i32 %37, i32 %39)
%41 = urem i32 %37, 10
%42 = icmp eq i32 %41, 0
br i1 %42, label %43, label %45
43: ; preds = %35
%44 = call i32 @putchar(i32 10)
br label %45
45: ; preds = %43, %35
%46 = call i32 @feof(i32* %5)
%47 = icmp eq i32 %46, 0
br i1 %47, label %35, label %48
48: ; preds = %45, %29
%49 = phi i32 [ 0, %29 ], [ %37, %45 ]
%50 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.10, i64 0, i64 0), i32 %49)
%51 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.15, i64 0, i64 0))
%52 = call i32 @feof(i32* %6)
%53 = icmp eq i32 %52, 0
br i1 %53, label %54, label %67
54: ; preds = %48, %64
%55 = phi i32 [ %56, %64 ], [ 0, %48 ]
%56 = add nuw nsw i32 %55, 1
%57 = load i32, i32* %3
%58 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0), i32 %56, i32 %57)
%59 = call i32 @fscanf(i32* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %3)
%60 = urem i32 %56, 10
%61 = icmp eq i32 %60, 0
br i1 %61, label %62, label %64
62: ; preds = %54
%63 = call i32 @putchar(i32 10)
br label %64
64: ; preds = %62, %54
%65 = call i32 @feof(i32* %6)
%66 = icmp eq i32 %65, 0
br i1 %66, label %54, label %67
67: ; preds = %64, %48
%68 = phi i32 [ 0, %48 ], [ %56, %64 ]
%69 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.12, i64 0, i64 0), i32 %68)
%70 = call i32 @rewind(i32* %5)
%71 = call i32 @rewind(i32* %4)
%72 = call i32 @fscanf(i32* %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %1)
%73 = call i32 @fscanf(i32* %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %2)
%74 = call i32 @feof(i32* %4)
%75 = icmp eq i32 %74, 0
br i1 %75, label %76, label %92
76: ; preds = %67, %87
%77 = phi i32 [ %81, %87 ], [ 0, %67 ]
%78 = call i32 @feof(i32* %5)
%79 = icmp eq i32 %78, 0
br i1 %79, label %80, label %92
80: ; preds = %76
%81 = add nuw nsw i32 %77, 1
%82 = load i32, i32* %1
%83 = load i32, i32* %2
%84 = icmp eq i32 %82, %83
br i1 %84, label %87, label %85
85: ; preds = %80
%86 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([65 x i8], [65 x i8]* @.str.13, i64 0, i64 0), i32 %81, i32 %82, i32 %82, i32 %83, i32 %83)
br label %87
87: ; preds = %85, %80
%88 = call i32 @fscanf(i32* %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %1)
%89 = call i32 @fscanf(i32* %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %2)
%90 = call i32 @feof(i32* %4)
%91 = icmp eq i32 %90, 0
br i1 %91, label %76, label %92
92: ; preds = %76, %87, %67
%93 = call i32 @fclose(i32* %5)
%94 = call i32 @fclose(i32* %4)
ret i32 0
}