#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
unsigned char *MAP_FAILED;
int MAP_FILE;
int MAP_SHARED;
int /*<<< orphan*/ O_RDWR;
int PROT_READ;
int PROT_WRITE;
int atoi(char *);
int errno;
scalar_t__ mmap(int /*<<< orphan*/, int, int, int, int, int);
int /*<<< orphan*/ munmap(unsigned char *, int);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
int phy_read(unsigned char *, int, int);
int phy_read_ext(unsigned char *, int, int);
int phy_read_mmd(unsigned char *, int, int, int);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char *argv[]) {
  int fd;
  unsigned char *mem;
  unsigned int r;
  int phyad = 0;
  unsigned int phy_id1, phy_id2;
  if (argc > 1)
    phyad = atoi(argv[1]);
  fd = open("/dev/mem", O_RDWR);
  if (fd < 0) {
    perror("open");
    return fd;
  }
  mem = (unsigned char *)mmap(0, 0x1000, PROT_READ | PROT_WRITE,
                              MAP_FILE | MAP_SHARED, fd, 0x4A101000);
  if (mem == MAP_FAILED) {
    perror("mmap");
    return errno;
  }
  phy_id1 = phy_read(mem, phyad, 2);
  phy_id2 = phy_read(mem, phyad, 3);
  printf("Register 0x2 =\t 0x%X\n", phy_id1);
  printf("Register 0x3 =\t 0x%X\n", phy_id2);
  if (phy_id1 == 0x22 && phy_id2 == 0x1622) {
    printf("### KSZ9031\n");
    printf("MMD Address 2h, Register 4h =\t 0x%X\n",
           phy_read_mmd(mem, 2, phyad, 4));
    printf("MMD Address 2h, Register 5h =\t 0x%X\n",
           phy_read_mmd(mem, 2, phyad, 5));
    printf("MMD Address 2h, Register 6h =\t 0x%X\n",
           phy_read_mmd(mem, 2, phyad, 6));
    printf("MMD Address 2h, Register 8h =\t 0x%X\n",
           phy_read_mmd(mem, 2, phyad, 8));
  } else if (phy_id1 == 0x22 && phy_id2 == 0x1611) {
    printf("### KSZ9021\n");
    int i;
    for (i = 0; i < 0xe; i++)
      printf("Register 0x%x =\t 0x%X\n", i, phy_read(mem, phyad, i));
    printf("Register 0xf =\t 0x%X\n", phy_read(mem, phyad, 0xF));
    for (i = 0x11; i < 0x14; i++)
      printf("Register 0x%x =\t 0x%X\n", i, phy_read(mem, phyad, i));
    printf("Register 0x15 =\t 0x%X\n", phy_read(mem, phyad, 0x15));
    printf("Register 0x1b =\t 0x%X\n", phy_read(mem, phyad, 0x1B));
    printf("Register 0x1c =\t 0x%X\n", phy_read(mem, phyad, 0x1C));
    printf("Register 0x1f =\t 0x%X\n", phy_read(mem, phyad, 0x1F));
    for (i = 0x100; i < 0x108; i++)
      printf("Register 0x%x =\t 0x%X\n", i, phy_read_ext(mem, phyad, i));
  } else if (phy_id1 == 0x7 && phy_id2 == 0xC0F1) {
    printf("### LAN8710A\n");
    printf("Reg  0 =\t 0x%X\n", phy_read(mem, phyad, 0));
    printf("Reg  1 =\t 0x%X\n", phy_read(mem, phyad, 1));
    printf("Reg  4 =\t 0x%X\n", phy_read(mem, phyad, 4));
    printf("Reg  5 =\t 0x%X\n", phy_read(mem, phyad, 5));
    printf("Reg  6 =\t 0x%X\n", phy_read(mem, phyad, 6));
    printf("Reg 17 =\t 0x%X\n", phy_read(mem, phyad, 17));
    printf("Reg 18 =\t 0x%X\n", phy_read(mem, phyad, 18));
    printf("Reg 26 =\t 0x%X\n", phy_read(mem, phyad, 26));
    printf("Reg 27 =\t 0x%X\n", phy_read(mem, phyad, 27));
    printf("Reg 29 =\t 0x%X\n", phy_read(mem, phyad, 29));
    printf("Reg 30 =\t 0x%X\n", phy_read(mem, phyad, 30));
    printf("Reg 31 =\t 0x%X\n", phy_read(mem, phyad, 31));
  } else if (phy_id1 == 0x22 && phy_id2 == 0x1560) {
    int i;
    printf("### KSZ8091\n");
    for (i = 0x0; i <= 0x8; i++)
      printf("Register 0x%x =\t 0x%X\n", i, phy_read(mem, phyad, i));
    printf("Register 0x10 =\t 0x%X\n", phy_read(mem, phyad, 0x10));
    printf("Register 0x11 =\t 0x%X\n", phy_read(mem, phyad, 0x11));
    for (i = 0x15; i <= 0x18; i++)
      printf("Register 0x%x =\t 0x%X\n", i, phy_read(mem, phyad, i));
    printf("Register 0x1b =\t 0x%X\n", phy_read(mem, phyad, 0x1b));
    for (i = 0x1d; i <= 0x1f; i++)
      printf("Register 0x%x =\t 0x%X\n", i, phy_read(mem, phyad, i));
  }
  munmap(mem, 0x1000);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x28(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    11c7 <main+0x37>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   10b0 <atoi@plt>
mov    %eax,-0x28(%rbp)
mov    0x2e0a(%rip),%rax
mov    (%rax),%esi
lea    0xe29(%rip),%rdi
call   1090 <open@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    1200 <main+0x70>
lea    0xe19(%rip),%rdi
call   10a0 <perror@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    185b <main+0x6cb>
mov    0x2df1(%rip),%rax
mov    (%rax),%edx
mov    0x2da8(%rip),%rax
or     (%rax),%edx
mov    0x2db7(%rip),%rax
mov    (%rax),%ecx
mov    0x2dc6(%rip),%rax
or     (%rax),%ecx
mov    -0x14(%rbp),%r8d
xor    %edi,%edi
mov    $0x1000,%esi
mov    $0x4a101000,%r9d
call   1030 <mmap@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    0x2d67(%rip),%rcx
cmp    (%rcx),%rax
jne    126f <main+0xdf>
lea    0xdb5(%rip),%rdi
call   10a0 <perror@plt>
mov    0x2d5b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    185b <main+0x6cb>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%esi
mov    $0x2,%edx
call   1060 <phy_read@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%esi
mov    $0x3,%edx
call   1060 <phy_read@plt>
mov    %eax,-0x30(%rbp)
mov    -0x2c(%rbp),%esi
lea    0xd72(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x30(%rbp),%esi
lea    0xd77(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
cmpl   $0x22,-0x2c(%rbp)
jne    137b <main+0x1eb>
cmpl   $0x1622,-0x30(%rbp)
jne    137b <main+0x1eb>
lea    0xd68(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%edx
mov    $0x2,%esi
mov    $0x4,%ecx
call   1080 <phy_read_mmd@plt>
mov    %eax,%esi
lea    0xd4f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%edx
mov    $0x2,%esi
mov    $0x5,%ecx
call   1080 <phy_read_mmd@plt>
mov    %eax,%esi
lea    0xd4e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%edx
mov    $0x2,%esi
mov    $0x6,%ecx
call   1080 <phy_read_mmd@plt>
mov    %eax,%esi
lea    0xd4d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%edx
mov    $0x2,%esi
mov    $0x8,%ecx
call   1080 <phy_read_mmd@plt>
mov    %eax,%esi
lea    0xd4c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1846 <main+0x6b6>
cmpl   $0x22,-0x2c(%rbp)
jne    1522 <main+0x392>
cmpl   $0x1611,-0x30(%rbp)
jne    1522 <main+0x392>
lea    0xd47(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x34(%rbp)
cmpl   $0xe,-0x34(%rbp)
jge    13e7 <main+0x257>
mov    -0x34(%rbp),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%esi
mov    -0x34(%rbp),%edx
call   1060 <phy_read@plt>
mov    -0x3c(%rbp),%esi
mov    %eax,%edx
lea    0xd1b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    13a7 <main+0x217>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%esi
mov    $0xf,%edx
call   1060 <phy_read@plt>
mov    %eax,%esi
lea    0xd03(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x11,-0x34(%rbp)
cmpl   $0x14,-0x34(%rbp)
jge    144f <main+0x2bf>
mov    -0x34(%rbp),%eax
mov    %eax,-0x40(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%esi
mov    -0x34(%rbp),%edx
call   1060 <phy_read@plt>
mov    -0x40(%rbp),%esi
mov    %eax,%edx
lea    0xcb3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    140f <main+0x27f>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%esi
mov    $0x15,%edx
call   1060 <phy_read@plt>
mov    %eax,%esi
lea    0xcb1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%esi
mov    $0x1b,%edx
call   1060 <phy_read@plt>
mov    %eax,%esi
lea    0xca7(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%esi
mov    $0x1c,%edx
call   1060 <phy_read@plt>
mov    %eax,%esi
lea    0xc9d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%esi
mov    $0x1f,%edx
call   1060 <phy_read@plt>
mov    %eax,%esi
lea    0xc93(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x100,-0x34(%rbp)
cmpl   $0x108,-0x34(%rbp)
jge    151d <main+0x38d>
mov    -0x34(%rbp),%eax
mov    %eax,-0x44(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%esi
mov    -0x34(%rbp),%edx
call   1050 <phy_read_ext@plt>
mov    -0x44(%rbp),%esi
mov    %eax,%edx
lea    0xbe5(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    14da <main+0x34a>
jmp    1841 <main+0x6b1>
cmpl   $0x7,-0x2c(%rbp)
jne    16d5 <main+0x545>
cmpl   $0xc0f1,-0x30(%rbp)
jne    16d5 <main+0x545>
lea    0xc36(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%esi
xor    %edx,%edx
call   1060 <phy_read@plt>
mov    %eax,%esi
lea    0xc26(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%esi
mov    $0x1,%edx
call   1060 <phy_read@plt>
mov    %eax,%esi
lea    0xc15(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%esi
mov    $0x4,%edx
call   1060 <phy_read@plt>
mov    %eax,%esi
lea    0xc04(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%esi
mov    $0x5,%edx
call   1060 <phy_read@plt>
mov    %eax,%esi
lea    0xbf3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%esi
mov    $0x6,%edx
call   1060 <phy_read@plt>
mov    %eax,%esi
lea    0xbe2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%esi
mov    $0x11,%edx
call   1060 <phy_read@plt>
mov    %eax,%esi
lea    0xbd1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%esi
mov    $0x12,%edx
call   1060 <phy_read@plt>
mov    %eax,%esi
lea    0xbc0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%esi
mov    $0x1a,%edx
call   1060 <phy_read@plt>
mov    %eax,%esi
lea    0xbaf(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%esi
mov    $0x1b,%edx
call   1060 <phy_read@plt>
mov    %eax,%esi
lea    0xb9e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%esi
mov    $0x1d,%edx
call   1060 <phy_read@plt>
mov    %eax,%esi
lea    0xb8d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%esi
mov    $0x1e,%edx
call   1060 <phy_read@plt>
mov    %eax,%esi
lea    0xb7c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%esi
mov    $0x1f,%edx
call   1060 <phy_read@plt>
mov    %eax,%esi
lea    0xb6b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    183c <main+0x6ac>
cmpl   $0x22,-0x2c(%rbp)
jne    1837 <main+0x6a7>
cmpl   $0x1560,-0x30(%rbp)
jne    1837 <main+0x6a7>
lea    0xb51(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x38(%rbp)
cmpl   $0x8,-0x38(%rbp)
jg     1741 <main+0x5b1>
mov    -0x38(%rbp),%eax
mov    %eax,-0x48(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%esi
mov    -0x38(%rbp),%edx
call   1060 <phy_read@plt>
mov    -0x48(%rbp),%esi
mov    %eax,%edx
lea    0x9c1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    1701 <main+0x571>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%esi
mov    $0x10,%edx
call   1060 <phy_read@plt>
mov    %eax,%esi
lea    0xaf6(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%esi
mov    $0x11,%edx
call   1060 <phy_read@plt>
mov    %eax,%esi
lea    0xaec(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x15,-0x38(%rbp)
cmpl   $0x18,-0x38(%rbp)
jg     17ca <main+0x63a>
mov    -0x38(%rbp),%eax
mov    %eax,-0x4c(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%esi
mov    -0x38(%rbp),%edx
call   1060 <phy_read@plt>
mov    -0x4c(%rbp),%esi
mov    %eax,%edx
lea    0x938(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    178a <main+0x5fa>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%esi
mov    $0x1b,%edx
call   1060 <phy_read@plt>
mov    %eax,%esi
lea    0x94d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1d,-0x38(%rbp)
cmpl   $0x1f,-0x38(%rbp)
jg     1832 <main+0x6a2>
mov    -0x38(%rbp),%eax
mov    %eax,-0x50(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%esi
mov    -0x38(%rbp),%edx
call   1060 <phy_read@plt>
mov    -0x50(%rbp),%esi
mov    %eax,%edx
lea    0x8d0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    17f2 <main+0x662>
jmp    1837 <main+0x6a7>
jmp    183c <main+0x6ac>
jmp    1841 <main+0x6b1>
jmp    1846 <main+0x6b6>
mov    -0x20(%rbp),%rdi
mov    $0x1000,%esi
call   1070 <munmap@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
xor    %r15d,%r15d
cmp    $0x2,%edi
jl     11bc <main+0x1c>
mov    0x8(%rsi),%rdi
call   10c0 <atoi@plt>
mov    %eax,%r15d
mov    0x2e15(%rip),%rax
mov    (%rax),%esi
lea    0xe34(%rip),%rdi
call   10a0 <open@plt>
mov    %eax,%ebx
test   %eax,%eax
js     1b62 <main+0x9c2>
mov    0x2e16(%rip),%rax
mov    0x2dcf(%rip),%rcx
mov    (%rcx),%edx
or     (%rax),%edx
mov    0x2ddc(%rip),%rax
mov    0x2ded(%rip),%rcx
mov    (%rcx),%ecx
or     (%rax),%ecx
xor    %edi,%edi
mov    $0x1000,%esi
mov    %ebx,%r8d
mov    $0x4a101000,%r9d
call   1040 <mmap@plt>
mov    %rax,%r12
mov    0x2d92(%rip),%rax
cmp    %r12,(%rax)
je     1b70 <main+0x9d0>
mov    %r12,%rdi
mov    %r15d,%esi
mov    $0x2,%edx
call   1070 <phy_read@plt>
mov    %eax,%ebp
mov    %r12,%rdi
mov    %r15d,%esi
mov    $0x3,%edx
call   1070 <phy_read@plt>
mov    %eax,%ebx
lea    0xdc1(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xdc7(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1050 <printf@plt>
cmp    $0x22,%ebp
jne    131c <main+0x17c>
cmp    $0x1622,%ebx
jne    131c <main+0x17c>
lea    0xfe8(%rip),%rdi
call   1030 <puts@plt>
mov    %r12,%rdi
mov    $0x2,%esi
mov    %r15d,%edx
mov    $0x4,%ecx
call   1090 <phy_read_mmd@plt>
lea    0xd97(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
mov    $0x2,%esi
mov    %r15d,%edx
mov    $0x5,%ecx
call   1090 <phy_read_mmd@plt>
lea    0xd97(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
mov    $0x2,%esi
mov    %r15d,%edx
mov    $0x6,%ecx
call   1090 <phy_read_mmd@plt>
lea    0xd97(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
mov    $0x2,%esi
mov    %r15d,%edx
mov    $0x8,%ecx
call   1090 <phy_read_mmd@plt>
lea    0xd97(%rip),%rdi
jmp    18a8 <main+0x708>
cmp    $0x22,%ebp
jne    1713 <main+0x573>
cmp    $0x1611,%ebx
jne    1713 <main+0x573>
lea    0xf2b(%rip),%rdi
call   1030 <puts@plt>
mov    %r12,%rdi
mov    %r15d,%esi
xor    %edx,%edx
call   1070 <phy_read@plt>
lea    0xd82(%rip),%r14
mov    %r14,%rdi
xor    %esi,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
mov    %r15d,%esi
mov    $0x1,%edx
call   1070 <phy_read@plt>
mov    %r14,%rdi
mov    $0x1,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
mov    %r15d,%esi
mov    $0x2,%edx
call   1070 <phy_read@plt>
mov    %r14,%rdi
mov    $0x2,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
mov    %r15d,%esi
mov    $0x3,%edx
call   1070 <phy_read@plt>
mov    %r14,%rdi
mov    $0x3,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
mov    %r15d,%esi
mov    $0x4,%edx
call   1070 <phy_read@plt>
mov    %r14,%rdi
mov    $0x4,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
mov    %r15d,%esi
mov    $0x5,%edx
call   1070 <phy_read@plt>
mov    %r14,%rdi
mov    $0x5,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
mov    %r15d,%esi
mov    $0x6,%edx
call   1070 <phy_read@plt>
mov    %r14,%rdi
mov    $0x6,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
mov    %r15d,%esi
mov    $0x7,%edx
call   1070 <phy_read@plt>
mov    %r14,%rdi
mov    $0x7,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
mov    %r15d,%esi
mov    $0x8,%edx
call   1070 <phy_read@plt>
mov    %r14,%rdi
mov    $0x8,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
mov    %r15d,%esi
mov    $0x9,%edx
call   1070 <phy_read@plt>
mov    %r14,%rdi
mov    $0x9,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
mov    %r15d,%esi
mov    $0xa,%edx
call   1070 <phy_read@plt>
mov    %r14,%rdi
mov    $0xa,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
mov    %r15d,%esi
mov    $0xb,%edx
call   1070 <phy_read@plt>
mov    %r14,%rdi
mov    $0xb,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
mov    %r15d,%esi
mov    $0xc,%edx
call   1070 <phy_read@plt>
mov    %r14,%rdi
mov    $0xc,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
mov    %r15d,%esi
mov    $0xd,%edx
call   1070 <phy_read@plt>
mov    %r14,%rdi
mov    $0xd,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
mov    %r15d,%esi
mov    $0xf,%edx
call   1070 <phy_read@plt>
lea    0xbc7(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
mov    %r15d,%esi
mov    $0x11,%edx
call   1070 <phy_read@plt>
mov    %r14,%rdi
mov    $0x11,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
mov    %r15d,%esi
mov    $0x12,%edx
call   1070 <phy_read@plt>
mov    %r14,%rdi
mov    $0x12,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
mov    %r15d,%esi
mov    $0x13,%edx
call   1070 <phy_read@plt>
mov    %r14,%rdi
mov    $0x13,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
mov    %r15d,%esi
mov    $0x15,%edx
call   1070 <phy_read@plt>
lea    0xb5a(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
mov    %r15d,%esi
mov    $0x1b,%edx
call   1070 <phy_read@plt>
lea    0xb51(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
mov    %r15d,%esi
mov    $0x1c,%edx
call   1070 <phy_read@plt>
lea    0xb48(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
mov    %r15d,%esi
mov    $0x1f,%edx
call   1070 <phy_read@plt>
lea    0xb3f(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
mov    %r15d,%esi
mov    $0x100,%edx
call   1060 <phy_read_ext@plt>
mov    %r14,%rdi
mov    $0x100,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
mov    %r15d,%esi
mov    $0x101,%edx
call   1060 <phy_read_ext@plt>
mov    %r14,%rdi
mov    $0x101,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
mov    %r15d,%esi
mov    $0x102,%edx
call   1060 <phy_read_ext@plt>
mov    %r14,%rdi
mov    $0x102,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
mov    %r15d,%esi
mov    $0x103,%edx
call   1060 <phy_read_ext@plt>
mov    %r14,%rdi
mov    $0x103,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
mov    %r15d,%esi
mov    $0x104,%edx
call   1060 <phy_read_ext@plt>
mov    %r14,%rdi
mov    $0x104,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
mov    %r15d,%esi
mov    $0x105,%edx
call   1060 <phy_read_ext@plt>
mov    %r14,%rdi
mov    $0x105,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
mov    %r15d,%esi
mov    $0x106,%edx
call   1060 <phy_read_ext@plt>
mov    %r14,%rdi
mov    $0x106,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
mov    %r15d,%esi
mov    $0x107,%edx
call   1060 <phy_read_ext@plt>
mov    %r14,%rdi
mov    $0x107,%esi
jmp    1b3f <main+0x99f>
cmp    $0x7,%ebp
jne    18b6 <main+0x716>
cmp    $0xc0f1,%ebx
jne    18b6 <main+0x716>
lea    0xb27(%rip),%rdi
call   1030 <puts@plt>
mov    %r12,%rdi
mov    %r15d,%esi
xor    %edx,%edx
call   1070 <phy_read@plt>
lea    0xa14(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
mov    %r15d,%esi
mov    $0x1,%edx
call   1070 <phy_read@plt>
lea    0xa04(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
mov    %r15d,%esi
mov    $0x4,%edx
call   1070 <phy_read@plt>
lea    0x9f4(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
mov    %r15d,%esi
mov    $0x5,%edx
call   1070 <phy_read@plt>
lea    0x9e4(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
mov    %r15d,%esi
mov    $0x6,%edx
call   1070 <phy_read@plt>
lea    0x9d4(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
mov    %r15d,%esi
mov    $0x11,%edx
call   1070 <phy_read@plt>
lea    0x9c4(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
mov    %r15d,%esi
mov    $0x12,%edx
call   1070 <phy_read@plt>
lea    0x9b4(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
mov    %r15d,%esi
mov    $0x1a,%edx
call   1070 <phy_read@plt>
lea    0x9a4(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
mov    %r15d,%esi
mov    $0x1b,%edx
call   1070 <phy_read@plt>
lea    0x994(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
mov    %r15d,%esi
mov    $0x1d,%edx
call   1070 <phy_read@plt>
lea    0x984(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
mov    %r15d,%esi
mov    $0x1e,%edx
call   1070 <phy_read@plt>
lea    0x974(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
mov    %r15d,%esi
mov    $0x1f,%edx
call   1070 <phy_read@plt>
lea    0x964(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    1b48 <main+0x9a8>
cmp    $0x22,%ebp
jne    1b48 <main+0x9a8>
cmp    $0x1560,%ebx
jne    1b48 <main+0x9a8>
lea    0x978(%rip),%rdi
call   1030 <puts@plt>
mov    %r12,%rdi
mov    %r15d,%esi
xor    %edx,%edx
call   1070 <phy_read@plt>
lea    0x7e8(%rip),%r14
mov    %r14,%rdi
xor    %esi,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
mov    %r15d,%esi
mov    $0x1,%edx
call   1070 <phy_read@plt>
mov    %r14,%rdi
mov    $0x1,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
mov    %r15d,%esi
mov    $0x2,%edx
call   1070 <phy_read@plt>
mov    %r14,%rdi
mov    $0x2,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
mov    %r15d,%esi
mov    $0x3,%edx
call   1070 <phy_read@plt>
mov    %r14,%rdi
mov    $0x3,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
mov    %r15d,%esi
mov    $0x4,%edx
call   1070 <phy_read@plt>
mov    %r14,%rdi
mov    $0x4,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
mov    %r15d,%esi
mov    $0x5,%edx
call   1070 <phy_read@plt>
mov    %r14,%rdi
mov    $0x5,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
mov    %r15d,%esi
mov    $0x6,%edx
call   1070 <phy_read@plt>
mov    %r14,%rdi
mov    $0x6,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
mov    %r15d,%esi
mov    $0x7,%edx
call   1070 <phy_read@plt>
mov    %r14,%rdi
mov    $0x7,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
mov    %r15d,%esi
mov    $0x8,%edx
call   1070 <phy_read@plt>
mov    %r14,%rdi
mov    $0x8,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
mov    %r15d,%esi
mov    $0x10,%edx
call   1070 <phy_read@plt>
lea    0x804(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
mov    %r15d,%esi
mov    $0x11,%edx
call   1070 <phy_read@plt>
lea    0x7fb(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
mov    %r15d,%esi
mov    $0x15,%edx
call   1070 <phy_read@plt>
mov    %r14,%rdi
mov    $0x15,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
mov    %r15d,%esi
mov    $0x16,%edx
call   1070 <phy_read@plt>
mov    %r14,%rdi
mov    $0x16,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
mov    %r15d,%esi
mov    $0x17,%edx
call   1070 <phy_read@plt>
mov    %r14,%rdi
mov    $0x17,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
mov    %r15d,%esi
mov    $0x18,%edx
call   1070 <phy_read@plt>
mov    %r14,%rdi
mov    $0x18,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
mov    %r15d,%esi
mov    $0x1b,%edx
call   1070 <phy_read@plt>
lea    0x63b(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
mov    %r15d,%esi
mov    $0x1d,%edx
call   1070 <phy_read@plt>
mov    %r14,%rdi
mov    $0x1d,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
mov    %r15d,%esi
mov    $0x1e,%edx
call   1070 <phy_read@plt>
mov    %r14,%rdi
mov    $0x1e,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
mov    %r15d,%esi
mov    $0x1f,%edx
call   1070 <phy_read@plt>
mov    %r14,%rdi
mov    $0x1f,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
mov    $0x1000,%esi
call   1080 <munmap@plt>
xor    %ebx,%ebx
mov    %ebx,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0x4a0(%rip),%rdi
call   10b0 <perror@plt>
jmp    1b57 <main+0x9b7>
lea    0x497(%rip),%rdi
call   10b0 <perror@plt>
mov    0x243d(%rip),%rax
mov    (%rax),%ebx
jmp    1b57 <main+0x9b7>

LLVM IR (-O0):
@.str = [9 x i8] c"/dev/mem\00"
@O_RDWR = global i32 0
@.str.1 = [5 x i8] c"open\00"
@PROT_READ = global i32 0
@PROT_WRITE = global i32 0
@MAP_FILE = global i32 0
@MAP_SHARED = global i32 0
@MAP_FAILED = global i8* null
@.str.2 = [5 x i8] c"mmap\00"
@errno = global i32 0
@.str.3 = [22 x i8] c"Register 0x2 =\09 0x%X\0A\00"
@.str.4 = [22 x i8] c"Register 0x3 =\09 0x%X\0A\00"
@.str.5 = [13 x i8] c"### KSZ9031\0A\00"
@.str.6 = [37 x i8] c"MMD Address 2h, Register 4h =\09 0x%X\0A\00"
@.str.7 = [37 x i8] c"MMD Address 2h, Register 5h =\09 0x%X\0A\00"
@.str.8 = [37 x i8] c"MMD Address 2h, Register 6h =\09 0x%X\0A\00"
@.str.9 = [37 x i8] c"MMD Address 2h, Register 8h =\09 0x%X\0A\00"
@.str.10 = [13 x i8] c"### KSZ9021\0A\00"
@.str.11 = [23 x i8] c"Register 0x%x =\09 0x%X\0A\00"
@.str.12 = [22 x i8] c"Register 0xf =\09 0x%X\0A\00"
@.str.13 = [23 x i8] c"Register 0x15 =\09 0x%X\0A\00"
@.str.14 = [23 x i8] c"Register 0x1b =\09 0x%X\0A\00"
@.str.15 = [23 x i8] c"Register 0x1c =\09 0x%X\0A\00"
@.str.16 = [23 x i8] c"Register 0x1f =\09 0x%X\0A\00"
@.str.17 = [14 x i8] c"### LAN8710A\0A\00"
@.str.18 = [16 x i8] c"Reg 0 =\09 0x%X\0A\00"
@.str.19 = [16 x i8] c"Reg 1 =\09 0x%X\0A\00"
@.str.20 = [16 x i8] c"Reg 4 =\09 0x%X\0A\00"
@.str.21 = [16 x i8] c"Reg 5 =\09 0x%X\0A\00"
@.str.22 = [16 x i8] c"Reg 6 =\09 0x%X\0A\00"
@.str.23 = [16 x i8] c"Reg 17 =\09 0x%X\0A\00"
@.str.24 = [16 x i8] c"Reg 18 =\09 0x%X\0A\00"
@.str.25 = [16 x i8] c"Reg 26 =\09 0x%X\0A\00"
@.str.26 = [16 x i8] c"Reg 27 =\09 0x%X\0A\00"
@.str.27 = [16 x i8] c"Reg 29 =\09 0x%X\0A\00"
@.str.28 = [16 x i8] c"Reg 30 =\09 0x%X\0A\00"
@.str.29 = [16 x i8] c"Reg 31 =\09 0x%X\0A\00"
@.str.30 = [13 x i8] c"### KSZ8091\0A\00"
@.str.31 = [23 x i8] c"Register 0x10 =\09 0x%X\0A\00"
@.str.32 = [23 x i8] c"Register 0x11 =\09 0x%X\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %9
%14 = load i32, i32* %4
%15 = icmp sgt i32 %14, 1
br i1 %15, label %16, label %21
16: ; preds = %2
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 1
%19 = load i8*, i8** %18
%20 = call i32 @atoi(i8* %19)
store i32 %20, i32* %9
br label %21
21: ; preds = %16, %2
%22 = load i32, i32* @O_RDWR
%23 = call i32 @open(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %22)
store i32 %23, i32* %6
%24 = load i32, i32* %6
%25 = icmp slt i32 %24, 0
br i1 %25, label %26, label %29
26: ; preds = %21
%27 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%28 = load i32, i32* %6
store i32 %28, i32* %3
br label %273
29: ; preds = %21
%30 = load i32, i32* @PROT_READ
%31 = load i32, i32* @PROT_WRITE
%32 = or i32 %30, %31
%33 = load i32, i32* @MAP_FILE
%34 = load i32, i32* @MAP_SHARED
%35 = or i32 %33, %34
%36 = load i32, i32* %6
%37 = call i64 @mmap(i32 0, i32 4096, i32 %32, i32 %35, i32 %36, i32 1242566656)
%38 = inttoptr i64 %37 to i8*
store i8* %38, i8** %7
%39 = load i8*, i8** %7
%40 = load i8*, i8** @MAP_FAILED
%41 = icmp eq i8* %39, %40
br i1 %41, label %42, label %45
42: ; preds = %29
%43 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%44 = load i32, i32* @errno
store i32 %44, i32* %3
br label %273
45: ; preds = %29
%46 = load i8*, i8** %7
%47 = load i32, i32* %9
%48 = call i32 @phy_read(i8* %46, i32 %47, i32 2)
store i32 %48, i32* %10
%49 = load i8*, i8** %7
%50 = load i32, i32* %9
%51 = call i32 @phy_read(i8* %49, i32 %50, i32 3)
store i32 %51, i32* %11
%52 = load i32, i32* %10
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i32 %52)
%54 = load i32, i32* %11
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i32 %54)
%56 = load i32, i32* %10
%57 = icmp eq i32 %56, 34
br i1 %57, label %58, label %79
58: ; preds = %45
%59 = load i32, i32* %11
%60 = icmp eq i32 %59, 5666
br i1 %60, label %61, label %79
61: ; preds = %58
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0))
%63 = load i8*, i8** %7
%64 = load i32, i32* %9
%65 = call i32 @phy_read_mmd(i8* %63, i32 2, i32 %64, i32 4)
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.6, i64 0, i64 0), i32 %65)
%67 = load i8*, i8** %7
%68 = load i32, i32* %9
%69 = call i32 @phy_read_mmd(i8* %67, i32 2, i32 %68, i32 5)
%70 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.7, i64 0, i64 0), i32 %69)
%71 = load i8*, i8** %7
%72 = load i32, i32* %9
%73 = call i32 @phy_read_mmd(i8* %71, i32 2, i32 %72, i32 6)
%74 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.8, i64 0, i64 0), i32 %73)
%75 = load i8*, i8** %7
%76 = load i32, i32* %9
%77 = call i32 @phy_read_mmd(i8* %75, i32 2, i32 %76, i32 8)
%78 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.9, i64 0, i64 0), i32 %77)
br label %270
79: ; preds = %58, %45
%80 = load i32, i32* %10
%81 = icmp eq i32 %80, 34
br i1 %81, label %82, label %149
82: ; preds = %79
%83 = load i32, i32* %11
%84 = icmp eq i32 %83, 5649
br i1 %84, label %85, label %149
85: ; preds = %82
%86 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.10, i64 0, i64 0))
store i32 0, i32* %12
br label %87
87: ; preds = %97, %85
%88 = load i32, i32* %12
%89 = icmp slt i32 %88, 14
br i1 %89, label %90, label %100
90: ; preds = %87
%91 = load i32, i32* %12
%92 = load i8*, i8** %7
%93 = load i32, i32* %9
%94 = load i32, i32* %12
%95 = call i32 @phy_read(i8* %92, i32 %93, i32 %94)
%96 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.11, i64 0, i64 0), i32 %91, i32 %95)
br label %97
97: ; preds = %90
%98 = load i32, i32* %12
%99 = add nsw i32 %98, 1
store i32 %99, i32* %12
br label %87
100: ; preds = %87
%101 = load i8*, i8** %7
%102 = load i32, i32* %9
%103 = call i32 @phy_read(i8* %101, i32 %102, i32 15)
%104 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.12, i64 0, i64 0), i32 %103)
store i32 17, i32* %12
br label %105
105: ; preds = %115, %100
%106 = load i32, i32* %12
%107 = icmp slt i32 %106, 20
br i1 %107, label %108, label %118
108: ; preds = %105
%109 = load i32, i32* %12
%110 = load i8*, i8** %7
%111 = load i32, i32* %9
%112 = load i32, i32* %12
%113 = call i32 @phy_read(i8* %110, i32 %111, i32 %112)
%114 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.11, i64 0, i64 0), i32 %109, i32 %113)
br label %115
115: ; preds = %108
%116 = load i32, i32* %12
%117 = add nsw i32 %116, 1
store i32 %117, i32* %12
br label %105
118: ; preds = %105
%119 = load i8*, i8** %7
%120 = load i32, i32* %9
%121 = call i32 @phy_read(i8* %119, i32 %120, i32 21)
%122 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.13, i64 0, i64 0), i32 %121)
%123 = load i8*, i8** %7
%124 = load i32, i32* %9
%125 = call i32 @phy_read(i8* %123, i32 %124, i32 27)
%126 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.14, i64 0, i64 0), i32 %125)
%127 = load i8*, i8** %7
%128 = load i32, i32* %9
%129 = call i32 @phy_read(i8* %127, i32 %128, i32 28)
%130 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.15, i64 0, i64 0), i32 %129)
%131 = load i8*, i8** %7
%132 = load i32, i32* %9
%133 = call i32 @phy_read(i8* %131, i32 %132, i32 31)
%134 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.16, i64 0, i64 0), i32 %133)
store i32 256, i32* %12
br label %135
135: ; preds = %145, %118
%136 = load i32, i32* %12
%137 = icmp slt i32 %136, 264
br i1 %137, label %138, label %148
138: ; preds = %135
%139 = load i32, i32* %12
%140 = load i8*, i8** %7
%141 = load i32, i32* %9
%142 = load i32, i32* %12
%143 = call i32 @phy_read_ext(i8* %140, i32 %141, i32 %142)
%144 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.11, i64 0, i64 0), i32 %139, i32 %143)
br label %145
145: ; preds = %138
%146 = load i32, i32* %12
%147 = add nsw i32 %146, 1
store i32 %147, i32* %12
br label %135
148: ; preds = %135
br label %269
149: ; preds = %82, %79
%150 = load i32, i32* %10
%151 = icmp eq i32 %150, 7
br i1 %151, label %152, label %205
152: ; preds = %149
%153 = load i32, i32* %11
%154 = icmp eq i32 %153, 49393
br i1 %154, label %155, label %205
155: ; preds = %152
%156 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.17, i64 0, i64 0))
%157 = load i8*, i8** %7
%158 = load i32, i32* %9
%159 = call i32 @phy_read(i8* %157, i32 %158, i32 0)
%160 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.18, i64 0, i64 0), i32 %159)
%161 = load i8*, i8** %7
%162 = load i32, i32* %9
%163 = call i32 @phy_read(i8* %161, i32 %162, i32 1)
%164 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.19, i64 0, i64 0), i32 %163)
%165 = load i8*, i8** %7
%166 = load i32, i32* %9
%167 = call i32 @phy_read(i8* %165, i32 %166, i32 4)
%168 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.20, i64 0, i64 0), i32 %167)
%169 = load i8*, i8** %7
%170 = load i32, i32* %9
%171 = call i32 @phy_read(i8* %169, i32 %170, i32 5)
%172 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.21, i64 0, i64 0), i32 %171)
%173 = load i8*, i8** %7
%174 = load i32, i32* %9
%175 = call i32 @phy_read(i8* %173, i32 %174, i32 6)
%176 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.22, i64 0, i64 0), i32 %175)
%177 = load i8*, i8** %7
%178 = load i32, i32* %9
%179 = call i32 @phy_read(i8* %177, i32 %178, i32 17)
%180 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.23, i64 0, i64 0), i32 %179)
%181 = load i8*, i8** %7
%182 = load i32, i32* %9
%183 = call i32 @phy_read(i8* %181, i32 %182, i32 18)
%184 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.24, i64 0, i64 0), i32 %183)
%185 = load i8*, i8** %7
%186 = load i32, i32* %9
%187 = call i32 @phy_read(i8* %185, i32 %186, i32 26)
%188 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.25, i64 0, i64 0), i32 %187)
%189 = load i8*, i8** %7
%190 = load i32, i32* %9
%191 = call i32 @phy_read(i8* %189, i32 %190, i32 27)
%192 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.26, i64 0, i64 0), i32 %191)
%193 = load i8*, i8** %7
%194 = load i32, i32* %9
%195 = call i32 @phy_read(i8* %193, i32 %194, i32 29)
%196 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.27, i64 0, i64 0), i32 %195)
%197 = load i8*, i8** %7
%198 = load i32, i32* %9
%199 = call i32 @phy_read(i8* %197, i32 %198, i32 30)
%200 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.28, i64 0, i64 0), i32 %199)
%201 = load i8*, i8** %7
%202 = load i32, i32* %9
%203 = call i32 @phy_read(i8* %201, i32 %202, i32 31)
%204 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.29, i64 0, i64 0), i32 %203)
br label %268
205: ; preds = %152, %149
%206 = load i32, i32* %10
%207 = icmp eq i32 %206, 34
br i1 %207, label %208, label %267
208: ; preds = %205
%209 = load i32, i32* %11
%210 = icmp eq i32 %209, 5472
br i1 %210, label %211, label %267
211: ; preds = %208
%212 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.30, i64 0, i64 0))
store i32 0, i32* %13
br label %213
213: ; preds = %223, %211
%214 = load i32, i32* %13
%215 = icmp sle i32 %214, 8
br i1 %215, label %216, label %226
216: ; preds = %213
%217 = load i32, i32* %13
%218 = load i8*, i8** %7
%219 = load i32, i32* %9
%220 = load i32, i32* %13
%221 = call i32 @phy_read(i8* %218, i32 %219, i32 %220)
%222 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.11, i64 0, i64 0), i32 %217, i32 %221)
br label %223
223: ; preds = %216
%224 = load i32, i32* %13
%225 = add nsw i32 %224, 1
store i32 %225, i32* %13
br label %213
226: ; preds = %213
%227 = load i8*, i8** %7
%228 = load i32, i32* %9
%229 = call i32 @phy_read(i8* %227, i32 %228, i32 16)
%230 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.31, i64 0, i64 0), i32 %229)
%231 = load i8*, i8** %7
%232 = load i32, i32* %9
%233 = call i32 @phy_read(i8* %231, i32 %232, i32 17)
%234 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.32, i64 0, i64 0), i32 %233)
store i32 21, i32* %13
br label %235
235: ; preds = %245, %226
%236 = load i32, i32* %13
%237 = icmp sle i32 %236, 24
br i1 %237, label %238, label %248
238: ; preds = %235
%239 = load i32, i32* %13
%240 = load i8*, i8** %7
%241 = load i32, i32* %9
%242 = load i32, i32* %13
%243 = call i32 @phy_read(i8* %240, i32 %241, i32 %242)
%244 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.11, i64 0, i64 0), i32 %239, i32 %243)
br label %245
245: ; preds = %238
%246 = load i32, i32* %13
%247 = add nsw i32 %246, 1
store i32 %247, i32* %13
br label %235
248: ; preds = %235
%249 = load i8*, i8** %7
%250 = load i32, i32* %9
%251 = call i32 @phy_read(i8* %249, i32 %250, i32 27)
%252 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.14, i64 0, i64 0), i32 %251)
store i32 29, i32* %13
br label %253
253: ; preds = %263, %248
%254 = load i32, i32* %13
%255 = icmp sle i32 %254, 31
br i1 %255, label %256, label %266
256: ; preds = %253
%257 = load i32, i32* %13
%258 = load i8*, i8** %7
%259 = load i32, i32* %9
%260 = load i32, i32* %13
%261 = call i32 @phy_read(i8* %258, i32 %259, i32 %260)
%262 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.11, i64 0, i64 0), i32 %257, i32 %261)
br label %263
263: ; preds = %256
%264 = load i32, i32* %13
%265 = add nsw i32 %264, 1
store i32 %265, i32* %13
br label %253
266: ; preds = %253
br label %267
267: ; preds = %266, %208, %205
br label %268
268: ; preds = %267, %155
br label %269
269: ; preds = %268, %148
br label %270
270: ; preds = %269, %61
%271 = load i8*, i8** %7
%272 = call i32 @munmap(i8* %271, i32 4096)
store i32 0, i32* %3
br label %273
273: ; preds = %270, %42, %26
%274 = load i32, i32* %3
ret i32 %274
}

LLVM IR (-O2):
@.str = [9 x i8] c"/dev/mem\00"
@O_RDWR = global i32 0
@.str.1 = [5 x i8] c"open\00"
@PROT_READ = global i32 0
@PROT_WRITE = global i32 0
@MAP_FILE = global i32 0
@MAP_SHARED = global i32 0
@MAP_FAILED = global i8* null
@.str.2 = [5 x i8] c"mmap\00"
@errno = global i32 0
@.str.3 = [22 x i8] c"Register 0x2 =\09 0x%X\0A\00"
@.str.4 = [22 x i8] c"Register 0x3 =\09 0x%X\0A\00"
@.str.6 = [37 x i8] c"MMD Address 2h, Register 4h =\09 0x%X\0A\00"
@.str.7 = [37 x i8] c"MMD Address 2h, Register 5h =\09 0x%X\0A\00"
@.str.8 = [37 x i8] c"MMD Address 2h, Register 6h =\09 0x%X\0A\00"
@.str.9 = [37 x i8] c"MMD Address 2h, Register 8h =\09 0x%X\0A\00"
@.str.11 = [23 x i8] c"Register 0x%x =\09 0x%X\0A\00"
@.str.12 = [22 x i8] c"Register 0xf =\09 0x%X\0A\00"
@.str.13 = [23 x i8] c"Register 0x15 =\09 0x%X\0A\00"
@.str.14 = [23 x i8] c"Register 0x1b =\09 0x%X\0A\00"
@.str.15 = [23 x i8] c"Register 0x1c =\09 0x%X\0A\00"
@.str.16 = [23 x i8] c"Register 0x1f =\09 0x%X\0A\00"
@.str.18 = [16 x i8] c"Reg 0 =\09 0x%X\0A\00"
@.str.19 = [16 x i8] c"Reg 1 =\09 0x%X\0A\00"
@.str.20 = [16 x i8] c"Reg 4 =\09 0x%X\0A\00"
@.str.21 = [16 x i8] c"Reg 5 =\09 0x%X\0A\00"
@.str.22 = [16 x i8] c"Reg 6 =\09 0x%X\0A\00"
@.str.23 = [16 x i8] c"Reg 17 =\09 0x%X\0A\00"
@.str.24 = [16 x i8] c"Reg 18 =\09 0x%X\0A\00"
@.str.25 = [16 x i8] c"Reg 26 =\09 0x%X\0A\00"
@.str.26 = [16 x i8] c"Reg 27 =\09 0x%X\0A\00"
@.str.27 = [16 x i8] c"Reg 29 =\09 0x%X\0A\00"
@.str.28 = [16 x i8] c"Reg 30 =\09 0x%X\0A\00"
@.str.29 = [16 x i8] c"Reg 31 =\09 0x%X\0A\00"
@.str.31 = [23 x i8] c"Register 0x10 =\09 0x%X\0A\00"
@.str.32 = [23 x i8] c"Register 0x11 =\09 0x%X\0A\00"
@str = [12 x i8] c"### KSZ8091\00"
@str.33 = [13 x i8] c"### LAN8710A\00"
@str.34 = [12 x i8] c"### KSZ9021\00"
@str.35 = [12 x i8] c"### KSZ9031\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32 @atoi(i8* %6)
br label %8
8: ; preds = %4, %2
%9 = phi i32 [ %7, %4 ], [ 0, %2 ]
%10 = load i32, i32* @O_RDWR
%11 = tail call i32 @open(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = icmp slt i32 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %8
%14 = tail call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
br label %187
15: ; preds = %8
%16 = load i32, i32* @PROT_READ
%17 = load i32, i32* @PROT_WRITE
%18 = or i32 %17, %16
%19 = load i32, i32* @MAP_FILE
%20 = load i32, i32* @MAP_SHARED
%21 = or i32 %20, %19
%22 = tail call i64 @mmap(i32 0, i32 4096, i32 %18, i32 %21, i32 %11, i32 1242566656)
%23 = inttoptr i64 %22 to i8*
%24 = load i8*, i8** @MAP_FAILED
%25 = icmp eq i8* %24, %23
br i1 %25, label %26, label %29
26: ; preds = %15
%27 = tail call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%28 = load i32, i32* @errno
br label %187
29: ; preds = %15
%30 = tail call i32 @phy_read(i8* %23, i32 %9, i32 2)
%31 = tail call i32 @phy_read(i8* %23, i32 %9, i32 3)
%32 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i32 %30)
%33 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i32 %31)
%34 = icmp eq i32 %30, 34
%35 = icmp eq i32 %31, 5666
%36 = select i1 %34, i1 %35, i1 false
br i1 %36, label %37, label %47
37: ; preds = %29
%38 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.35, i64 0, i64 0))
%39 = tail call i32 @phy_read_mmd(i8* %23, i32 2, i32 %9, i32 4)
%40 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.6, i64 0, i64 0), i32 %39)
%41 = tail call i32 @phy_read_mmd(i8* %23, i32 2, i32 %9, i32 5)
%42 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.7, i64 0, i64 0), i32 %41)
%43 = tail call i32 @phy_read_mmd(i8* %23, i32 2, i32 %9, i32 6)
%44 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.8, i64 0, i64 0), i32 %43)
%45 = tail call i32 @phy_read_mmd(i8* %23, i32 2, i32 %9, i32 8)
%46 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.9, i64 0, i64 0), i32 %45)
br label %185
47: ; preds = %29
%48 = icmp eq i32 %31, 5649
%49 = select i1 %34, i1 %48, i1 false
br i1 %49, label %50, label %112
50: ; preds = %47
%51 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.34, i64 0, i64 0))
%52 = tail call i32 @phy_read(i8* %23, i32 %9, i32 0)
%53 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.11, i64 0, i64 0), i32 0, i32 %52)
%54 = tail call i32 @phy_read(i8* %23, i32 %9, i32 1)
%55 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.11, i64 0, i64 0), i32 1, i32 %54)
%56 = tail call i32 @phy_read(i8* %23, i32 %9, i32 2)
%57 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.11, i64 0, i64 0), i32 2, i32 %56)
%58 = tail call i32 @phy_read(i8* %23, i32 %9, i32 3)
%59 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.11, i64 0, i64 0), i32 3, i32 %58)
%60 = tail call i32 @phy_read(i8* %23, i32 %9, i32 4)
%61 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.11, i64 0, i64 0), i32 4, i32 %60)
%62 = tail call i32 @phy_read(i8* %23, i32 %9, i32 5)
%63 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.11, i64 0, i64 0), i32 5, i32 %62)
%64 = tail call i32 @phy_read(i8* %23, i32 %9, i32 6)
%65 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.11, i64 0, i64 0), i32 6, i32 %64)
%66 = tail call i32 @phy_read(i8* %23, i32 %9, i32 7)
%67 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.11, i64 0, i64 0), i32 7, i32 %66)
%68 = tail call i32 @phy_read(i8* %23, i32 %9, i32 8)
%69 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.11, i64 0, i64 0), i32 8, i32 %68)
%70 = tail call i32 @phy_read(i8* %23, i32 %9, i32 9)
%71 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.11, i64 0, i64 0), i32 9, i32 %70)
%72 = tail call i32 @phy_read(i8* %23, i32 %9, i32 10)
%73 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.11, i64 0, i64 0), i32 10, i32 %72)
%74 = tail call i32 @phy_read(i8* %23, i32 %9, i32 11)
%75 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.11, i64 0, i64 0), i32 11, i32 %74)
%76 = tail call i32 @phy_read(i8* %23, i32 %9, i32 12)
%77 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.11, i64 0, i64 0), i32 12, i32 %76)
%78 = tail call i32 @phy_read(i8* %23, i32 %9, i32 13)
%79 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.11, i64 0, i64 0), i32 13, i32 %78)
%80 = tail call i32 @phy_read(i8* %23, i32 %9, i32 15)
%81 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.12, i64 0, i64 0), i32 %80)
%82 = tail call i32 @phy_read(i8* %23, i32 %9, i32 17)
%83 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.11, i64 0, i64 0), i32 17, i32 %82)
%84 = tail call i32 @phy_read(i8* %23, i32 %9, i32 18)
%85 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.11, i64 0, i64 0), i32 18, i32 %84)
%86 = tail call i32 @phy_read(i8* %23, i32 %9, i32 19)
%87 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.11, i64 0, i64 0), i32 19, i32 %86)
%88 = tail call i32 @phy_read(i8* %23, i32 %9, i32 21)
%89 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.13, i64 0, i64 0), i32 %88)
%90 = tail call i32 @phy_read(i8* %23, i32 %9, i32 27)
%91 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.14, i64 0, i64 0), i32 %90)
%92 = tail call i32 @phy_read(i8* %23, i32 %9, i32 28)
%93 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.15, i64 0, i64 0), i32 %92)
%94 = tail call i32 @phy_read(i8* %23, i32 %9, i32 31)
%95 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.16, i64 0, i64 0), i32 %94)
%96 = tail call i32 @phy_read_ext(i8* %23, i32 %9, i32 256)
%97 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.11, i64 0, i64 0), i32 256, i32 %96)
%98 = tail call i32 @phy_read_ext(i8* %23, i32 %9, i32 257)
%99 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.11, i64 0, i64 0), i32 257, i32 %98)
%100 = tail call i32 @phy_read_ext(i8* %23, i32 %9, i32 258)
%101 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.11, i64 0, i64 0), i32 258, i32 %100)
%102 = tail call i32 @phy_read_ext(i8* %23, i32 %9, i32 259)
%103 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.11, i64 0, i64 0), i32 259, i32 %102)
%104 = tail call i32 @phy_read_ext(i8* %23, i32 %9, i32 260)
%105 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.11, i64 0, i64 0), i32 260, i32 %104)
%106 = tail call i32 @phy_read_ext(i8* %23, i32 %9, i32 261)
%107 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.11, i64 0, i64 0), i32 261, i32 %106)
%108 = tail call i32 @phy_read_ext(i8* %23, i32 %9, i32 262)
%109 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.11, i64 0, i64 0), i32 262, i32 %108)
%110 = tail call i32 @phy_read_ext(i8* %23, i32 %9, i32 263)
%111 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.11, i64 0, i64 0), i32 263, i32 %110)
br label %185
112: ; preds = %47
%113 = icmp eq i32 %30, 7
%114 = icmp eq i32 %31, 49393
%115 = select i1 %113, i1 %114, i1 false
br i1 %115, label %116, label %142
116: ; preds = %112
%117 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.33, i64 0, i64 0))
%118 = tail call i32 @phy_read(i8* %23, i32 %9, i32 0)
%119 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.18, i64 0, i64 0), i32 %118)
%120 = tail call i32 @phy_read(i8* %23, i32 %9, i32 1)
%121 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.19, i64 0, i64 0), i32 %120)
%122 = tail call i32 @phy_read(i8* %23, i32 %9, i32 4)
%123 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.20, i64 0, i64 0), i32 %122)
%124 = tail call i32 @phy_read(i8* %23, i32 %9, i32 5)
%125 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.21, i64 0, i64 0), i32 %124)
%126 = tail call i32 @phy_read(i8* %23, i32 %9, i32 6)
%127 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.22, i64 0, i64 0), i32 %126)
%128 = tail call i32 @phy_read(i8* %23, i32 %9, i32 17)
%129 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.23, i64 0, i64 0), i32 %128)
%130 = tail call i32 @phy_read(i8* %23, i32 %9, i32 18)
%131 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.24, i64 0, i64 0), i32 %130)
%132 = tail call i32 @phy_read(i8* %23, i32 %9, i32 26)
%133 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.25, i64 0, i64 0), i32 %132)
%134 = tail call i32 @phy_read(i8* %23, i32 %9, i32 27)
%135 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.26, i64 0, i64 0), i32 %134)
%136 = tail call i32 @phy_read(i8* %23, i32 %9, i32 29)
%137 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.27, i64 0, i64 0), i32 %136)
%138 = tail call i32 @phy_read(i8* %23, i32 %9, i32 30)
%139 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.28, i64 0, i64 0), i32 %138)
%140 = tail call i32 @phy_read(i8* %23, i32 %9, i32 31)
%141 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.29, i64 0, i64 0), i32 %140)
br label %185
142: ; preds = %112
%143 = icmp eq i32 %31, 5472
%144 = select i1 %34, i1 %143, i1 false
br i1 %144, label %145, label %185
145: ; preds = %142
%146 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
%147 = tail call i32 @phy_read(i8* %23, i32 %9, i32 0)
%148 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.11, i64 0, i64 0), i32 0, i32 %147)
%149 = tail call i32 @phy_read(i8* %23, i32 %9, i32 1)
%150 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.11, i64 0, i64 0), i32 1, i32 %149)
%151 = tail call i32 @phy_read(i8* %23, i32 %9, i32 2)
%152 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.11, i64 0, i64 0), i32 2, i32 %151)
%153 = tail call i32 @phy_read(i8* %23, i32 %9, i32 3)
%154 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.11, i64 0, i64 0), i32 3, i32 %153)
%155 = tail call i32 @phy_read(i8* %23, i32 %9, i32 4)
%156 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.11, i64 0, i64 0), i32 4, i32 %155)
%157 = tail call i32 @phy_read(i8* %23, i32 %9, i32 5)
%158 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.11, i64 0, i64 0), i32 5, i32 %157)
%159 = tail call i32 @phy_read(i8* %23, i32 %9, i32 6)
%160 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.11, i64 0, i64 0), i32 6, i32 %159)
%161 = tail call i32 @phy_read(i8* %23, i32 %9, i32 7)
%162 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.11, i64 0, i64 0), i32 7, i32 %161)
%163 = tail call i32 @phy_read(i8* %23, i32 %9, i32 8)
%164 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.11, i64 0, i64 0), i32 8, i32 %163)
%165 = tail call i32 @phy_read(i8* %23, i32 %9, i32 16)
%166 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.31, i64 0, i64 0), i32 %165)
%167 = tail call i32 @phy_read(i8* %23, i32 %9, i32 17)
%168 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.32, i64 0, i64 0), i32 %167)
%169 = tail call i32 @phy_read(i8* %23, i32 %9, i32 21)
%170 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.11, i64 0, i64 0), i32 21, i32 %169)
%171 = tail call i32 @phy_read(i8* %23, i32 %9, i32 22)
%172 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.11, i64 0, i64 0), i32 22, i32 %171)
%173 = tail call i32 @phy_read(i8* %23, i32 %9, i32 23)
%174 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.11, i64 0, i64 0), i32 23, i32 %173)
%175 = tail call i32 @phy_read(i8* %23, i32 %9, i32 24)
%176 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.11, i64 0, i64 0), i32 24, i32 %175)
%177 = tail call i32 @phy_read(i8* %23, i32 %9, i32 27)
%178 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.14, i64 0, i64 0), i32 %177)
%179 = tail call i32 @phy_read(i8* %23, i32 %9, i32 29)
%180 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.11, i64 0, i64 0), i32 29, i32 %179)
%181 = tail call i32 @phy_read(i8* %23, i32 %9, i32 30)
%182 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.11, i64 0, i64 0), i32 30, i32 %181)
%183 = tail call i32 @phy_read(i8* %23, i32 %9, i32 31)
%184 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.11, i64 0, i64 0), i32 31, i32 %183)
br label %185
185: ; preds = %145, %50, %142, %116, %37
%186 = tail call i32 @munmap(i8* %23, i32 4096)
br label %187
187: ; preds = %185, %26, %13
%188 = phi i32 [ %11, %13 ], [ %28, %26 ], [ 0, %185 ]
ret i32 %188
}