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

/* Variables and functions */
int /*<<< orphan*/ O_RDONLY;
int atoi(char *);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, char *);
int /*<<< orphan*/ ioctl(int, int, ...);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ pclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *popen(char *, char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ ra_reg_mod_bits(int, int, int, int);
int /*<<< orphan*/ snprintf(char *, int, char *, int);
int strlen(char *);
int strtoul(char *, int /*<<< orphan*/ *, int);
int /*<<< orphan*/ system(char *);
int main(int argc, char *argv[]) {
  int fd, method = 0, offset = 0, value = 0;
  char *p;
  char driver[32] = {0};
  char devnum[32] = {0};
  char cmd[64] = {0};
  FILE *fp = NULL;
  fp = popen("cat /proc/devices | grep rdm | sed  -r -n \"s/[0-9]+ //p\"", "r");
  fscanf(fp, "%s", driver);
  pclose(fp);
  fp = popen("cat /proc/devices | grep rdm | sed  -r -n \"s/ [a-z0-9]*//p\"",
             "r");
  fscanf(fp, "%s", devnum);
  pclose(fp);
  if (strlen(driver) && strlen(devnum)) {
    snprintf(cmd, sizeof(cmd), "[ -c /dev/rdm0 ] || mknod /dev/rdm0 c %d 0",
             atoi(devnum));
    system(cmd);
  } else {
    printf("RDM module not enabled!\n");
  }
  if (argc < 3) {
    printf(
        "syntax: reg [method(r/w/s/d/f)] [offset(Hex)] [value(hex, w only)]\n");
    printf("syntax: reg q [interval(Hex in ms)] [count(Hex)]\n");
    printf("syntax: reg o [offset_number] [offset_value]\n");
    printf("read example : reg r 18\n");
    printf("write example : reg w 18 12345678\n");
    printf("dump example : reg d 18 \n");
    printf("dump example [FPGA emulation]: reg f 18 \n");
    printf("modify example : reg m [Offset:Hex] [Data:Hex] [StartBit:Decimal] "
           "[DataLen:Decimal] \n");
    printf("To use system register: reg s 0\n");
    printf("To use wireless register: reg s 1\n");
    printf("To use other base address offset: reg s [offset]\n");
    printf("for example: reg s 0xa0500000\n");
    printf("for example: reg m c8 1 31 1\n");
    printf("To show current base address offset: reg s 2\n");
    printf("reg q reads and shows the 16 register values  [count] times in the "
           "interval of [interval]ms.\n");
    printf("the addresses of the 16 registers are assigned by reg o\n");
    printf(
        "for example: reg o 5 10. This sets the 5th register offset as 0x10\n");
    printf(
        "[interval]: 1 ~ 1000. [count]: 1 ~ 1000. [offset_number]: 0 ~ 15.\n");
    return 0;
  }
  p = argv[1];
  if (*p == 'r') {
    method = 0x6B01;
  } else if (*p == 'p') {
    method = 0x6B03;
  } else if (*p == 'd') {
    method = 0x6B05;
  } else if (*p == 'q') {
    method = 0x6B11;
  } else if (*p == 'f') {
    method = 0x6B06;
  } else if (*p == 'w') {
    method = 0x6B02;
  } else if (*p == 's') {
    p = argv[2];
    if (*p == '0' && *(p + 1) == '\0') {
      method = 0x6B0E;
    } else if (*p == '1') {
      method = 0x6B0F;
    } else if (*p == '2') {
      method = 0x6B0C;
    } else {
      method = 0x6B0D;
    }
    if (method != 0x6B0D) {
      fd = open("/dev/rdm0", O_RDONLY);
      if (fd < 0) {
        printf("Open pseudo device failed\n");
        return 0;
      }
      ioctl(fd, method, offset);
      close(fd);
      return 0;
    }
  } else if (*p == 'm') {
    int offset = strtoul(argv[2], NULL, 16);
    int data = strtoul(argv[3], NULL, 16);
    int start_bit = strtoul(argv[4], NULL, 10);
    int len = strtoul(argv[5], NULL, 10);
    if (len > 32) {
      printf("len must <= 32\n");
      return 0;
    }
    ra_reg_mod_bits(offset, data, start_bit, len);
  } else if (*p == 'o') {
    method = 0x6B10;
  } else {
    printf("method must be either r p d f w s m\n");
    return 0;
  }
  p = argv[2];
  if (*p == '0' && *(p + 1) == 'x')
    p += 2;
  if (strlen(p) > 8) {
    printf("invalid offset\n");
  }
  while (*p != '\0') {
    if (*p >= '0' && *p <= '9')
      offset = offset * 16 + *p - 48;
    else {
      if (*p >= 'A' && *p <= 'F')
        offset = offset * 16 + *p - 55;
      else if (*p >= 'a' && *p <= 'f')
        offset = offset * 16 + *p - 87;
      else {
        printf("invalid offset\n");
        return 0;
      }
    }
    p++;
  }
  if (method == 0x6B02 || method == 0x6B11 || method == 0x6B10) {
    p = argv[3];
    if (*p == '0' && *(p + 1) == 'x')
      p += 2;
    if (strlen(p) > 8) {
      printf("invalid value\n");
    }
    method = (method | (offset << 16));
    while (*p != '\0') {
      if (*p >= '0' && *p <= '9')
        value = value * 16 + *p - 48;
      else {
        if (*p >= 'A' && *p <= 'F')
          value = value * 16 + *p - 55;
        else if (*p >= 'a' && *p <= 'f')
          value = value * 16 + *p - 87;
        else {
          printf("invalid value\n");
          return 0;
        }
      }
      p++;
    }
    offset = value;
  }
  if ((method & 0xffff) == 0x6B11 &&
      (((method >> 16) > 1023 || (method >> 16) == 0) ||
       (offset > 1023 || offset == 0))) {
    printf("[interval]: 1 ~ 3ff . [count]: 1 ~ 3ff.\n");
    return 0;
  }
  if (method == 0) {
    printf("no method\n");
    return 0;
  }
  fd = open("/dev/rdm0", O_RDONLY);
  if (fd < 0) {
    printf("Open pseudo device failed\n");
    return 0;
  }
  ioctl(fd, method, &offset);
  if (method == 0x6B03) {
    printf("0x%x\n", offset);
  }
  close(fd);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
lea    -0x50(%rbp),%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1080 <memset@plt>
lea    -0x70(%rbp),%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1080 <memset@plt>
lea    -0xb0(%rbp),%rdi
xor    %esi,%esi
mov    $0x40,%edx
call   1080 <memset@plt>
movq   $0x0,-0xb8(%rbp)
lea    0xdad(%rip),%rdi
lea    0xddf(%rip),%rsi
call   10e0 <popen@plt>
mov    %rax,-0xb8(%rbp)
mov    -0xb8(%rbp),%rdi
lea    -0x50(%rbp),%rdx
lea    0xdc3(%rip),%rsi
call   1090 <fscanf@plt>
mov    -0xb8(%rbp),%rdi
call   1060 <pclose@plt>
lea    0xdae(%rip),%rdi
lea    0xda2(%rip),%rsi
call   10e0 <popen@plt>
mov    %rax,-0xb8(%rbp)
mov    -0xb8(%rbp),%rdi
lea    -0x70(%rbp),%rdx
lea    0xd86(%rip),%rsi
call   1090 <fscanf@plt>
mov    -0xb8(%rbp),%rdi
call   1060 <pclose@plt>
lea    -0x50(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x0,%eax
je     132c <main+0x14c>
lea    -0x70(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x0,%eax
je     132c <main+0x14c>
lea    -0xb0(%rbp),%rax
mov    %rax,-0xd0(%rbp)
lea    -0x70(%rbp),%rdi
call   1100 <atoi@plt>
mov    -0xd0(%rbp),%rdi
mov    %eax,%ecx
mov    $0x40,%esi
lea    0xd64(%rip),%rdx
call   1070 <snprintf@plt>
lea    -0xb0(%rbp),%rdi
call   1040 <system@plt>
jmp    133a <main+0x15a>
lea    0xd72(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
cmpl   $0x3,-0x8(%rbp)
jge    144c <main+0x26c>
lea    0xd73(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xda9(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xdcd(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xded(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xdf8(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe0d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe19(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe35(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe7d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe90(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xea5(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xec9(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xeda(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xeea(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xf0a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xf5a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xf85(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xfbb(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1b05 <main+0x925>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x72,%eax
jne    1474 <main+0x294>
movl   $0x6b01,-0x18(%rbp)
jmp    172b <main+0x54b>
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x70,%eax
jne    1490 <main+0x2b0>
movl   $0x6b03,-0x18(%rbp)
jmp    1726 <main+0x546>
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x64,%eax
jne    14ac <main+0x2cc>
movl   $0x6b05,-0x18(%rbp)
jmp    1721 <main+0x541>
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x71,%eax
jne    14c8 <main+0x2e8>
movl   $0x6b11,-0x18(%rbp)
jmp    171c <main+0x53c>
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x66,%eax
jne    14e4 <main+0x304>
movl   $0x6b06,-0x18(%rbp)
jmp    1717 <main+0x537>
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x77,%eax
jne    1500 <main+0x320>
movl   $0x6b02,-0x18(%rbp)
jmp    1712 <main+0x532>
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x73,%eax
jne    1604 <main+0x424>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x30,%eax
jne    1549 <main+0x369>
mov    -0x28(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x0,%eax
jne    1549 <main+0x369>
movl   $0x6b0e,-0x18(%rbp)
jmp    1592 <main+0x3b2>
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x31,%eax
jne    1565 <main+0x385>
movl   $0x6b0f,-0x18(%rbp)
jmp    158d <main+0x3ad>
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x32,%eax
jne    1581 <main+0x3a1>
movl   $0x6b0c,-0x18(%rbp)
jmp    1588 <main+0x3a8>
movl   $0x6b0d,-0x18(%rbp)
jmp    158d <main+0x3ad>
jmp    1592 <main+0x3b2>
cmpl   $0x6b0d,-0x18(%rbp)
je     15ff <main+0x41f>
mov    0x2a42(%rip),%rax
mov    (%rax),%esi
lea    0xe88(%rip),%rdi
call   10d0 <open@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    15db <main+0x3fb>
lea    0xe79(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1b05 <main+0x925>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    -0x1c(%rbp),%edx
mov    $0x0,%al
call   10a0 <ioctl@plt>
mov    -0x14(%rbp),%edi
call   10b0 <close@plt>
movl   $0x0,-0x4(%rbp)
jmp    1b05 <main+0x925>
jmp    170d <main+0x52d>
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x6d,%eax
jne    16cd <main+0x4ed>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0x10,%edx
call   10f0 <strtoul@plt>
mov    %eax,-0xbc(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0x10,%edx
call   10f0 <strtoul@plt>
mov    %eax,-0xc0(%rbp)
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   10f0 <strtoul@plt>
mov    %eax,-0xc4(%rbp)
mov    -0x10(%rbp),%rax
mov    0x28(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   10f0 <strtoul@plt>
mov    %eax,-0xc8(%rbp)
cmpl   $0x20,-0xc8(%rbp)
jle    16ab <main+0x4cb>
lea    0xdc4(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1b05 <main+0x925>
mov    -0xbc(%rbp),%edi
mov    -0xc0(%rbp),%esi
mov    -0xc4(%rbp),%edx
mov    -0xc8(%rbp),%ecx
call   10c0 <ra_reg_mod_bits@plt>
jmp    1708 <main+0x528>
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x6f,%eax
jne    16e9 <main+0x509>
movl   $0x6b10,-0x18(%rbp)
jmp    1703 <main+0x523>
lea    0xd7c(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1b05 <main+0x925>
jmp    1708 <main+0x528>
jmp    170d <main+0x52d>
jmp    1712 <main+0x532>
jmp    1717 <main+0x537>
jmp    171c <main+0x53c>
jmp    1721 <main+0x541>
jmp    1726 <main+0x546>
jmp    172b <main+0x54b>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x30,%eax
jne    1764 <main+0x584>
mov    -0x28(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x78,%eax
jne    1764 <main+0x584>
mov    -0x28(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x8,%eax
jle    1784 <main+0x5a4>
lea    0xd14(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1789 <main+0x5a9>
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     187c <main+0x69c>
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x30,%eax
jl     17d3 <main+0x5f3>
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x39,%eax
jg     17d3 <main+0x5f3>
mov    -0x1c(%rbp),%eax
shl    $0x4,%eax
mov    -0x28(%rbp),%rcx
movsbl (%rcx),%ecx
add    %ecx,%eax
sub    $0x30,%eax
mov    %eax,-0x1c(%rbp)
jmp    186b <main+0x68b>
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x41,%eax
jl     180d <main+0x62d>
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x46,%eax
jg     180d <main+0x62d>
mov    -0x1c(%rbp),%eax
shl    $0x4,%eax
mov    -0x28(%rbp),%rcx
movsbl (%rcx),%ecx
add    %ecx,%eax
sub    $0x37,%eax
mov    %eax,-0x1c(%rbp)
jmp    1866 <main+0x686>
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x61,%eax
jl     1847 <main+0x667>
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x66,%eax
jg     1847 <main+0x667>
mov    -0x1c(%rbp),%eax
shl    $0x4,%eax
mov    -0x28(%rbp),%rcx
movsbl (%rcx),%ecx
add    %ecx,%eax
sub    $0x57,%eax
mov    %eax,-0x1c(%rbp)
jmp    1861 <main+0x681>
lea    0xc43(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1b05 <main+0x925>
jmp    1866 <main+0x686>
jmp    186b <main+0x68b>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    1789 <main+0x5a9>
cmpl   $0x6b02,-0x18(%rbp)
je     18a3 <main+0x6c3>
cmpl   $0x6b11,-0x18(%rbp)
je     18a3 <main+0x6c3>
cmpl   $0x6b10,-0x18(%rbp)
jne    1a03 <main+0x823>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x30,%eax
jne    18dc <main+0x6fc>
mov    -0x28(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x78,%eax
jne    18dc <main+0x6fc>
mov    -0x28(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x8,%eax
jle    18fc <main+0x71c>
lea    0xbac(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x18(%rbp),%eax
mov    -0x1c(%rbp),%ecx
shl    $0x10,%ecx
or     %ecx,%eax
mov    %eax,-0x18(%rbp)
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     19fd <main+0x81d>
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x30,%eax
jl     1954 <main+0x774>
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x39,%eax
jg     1954 <main+0x774>
mov    -0x20(%rbp),%eax
shl    $0x4,%eax
mov    -0x28(%rbp),%rcx
movsbl (%rcx),%ecx
add    %ecx,%eax
sub    $0x30,%eax
mov    %eax,-0x20(%rbp)
jmp    19ec <main+0x80c>
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x41,%eax
jl     198e <main+0x7ae>
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x46,%eax
jg     198e <main+0x7ae>
mov    -0x20(%rbp),%eax
shl    $0x4,%eax
mov    -0x28(%rbp),%rcx
movsbl (%rcx),%ecx
add    %ecx,%eax
sub    $0x37,%eax
mov    %eax,-0x20(%rbp)
jmp    19e7 <main+0x807>
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x61,%eax
jl     19c8 <main+0x7e8>
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x66,%eax
jg     19c8 <main+0x7e8>
mov    -0x20(%rbp),%eax
shl    $0x4,%eax
mov    -0x28(%rbp),%rcx
movsbl (%rcx),%ecx
add    %ecx,%eax
sub    $0x57,%eax
mov    %eax,-0x20(%rbp)
jmp    19e2 <main+0x802>
lea    0xad2(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1b05 <main+0x925>
jmp    19e7 <main+0x807>
jmp    19ec <main+0x80c>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    190a <main+0x72a>
mov    -0x20(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%eax
and    $0xffff,%eax
cmp    $0x6b11,%eax
jne    1a67 <main+0x887>
mov    -0x18(%rbp),%eax
sar    $0x10,%eax
cmp    $0x3ff,%eax
jg     1a4d <main+0x86d>
mov    -0x18(%rbp),%eax
sar    $0x10,%eax
cmp    $0x0,%eax
je     1a4d <main+0x86d>
cmpl   $0x3ff,-0x1c(%rbp)
jg     1a4d <main+0x86d>
cmpl   $0x0,-0x1c(%rbp)
jne    1a67 <main+0x887>
lea    0xa5c(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1b05 <main+0x925>
cmpl   $0x0,-0x18(%rbp)
jne    1a8b <main+0x8ab>
lea    0xa61(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1b05 <main+0x925>
mov    0x2556(%rip),%rax
mov    (%rax),%esi
lea    0x99c(%rip),%rdi
call   10d0 <open@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    1ac7 <main+0x8e7>
lea    0x98d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1b05 <main+0x925>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
lea    -0x1c(%rbp),%rdx
mov    $0x0,%al
call   10a0 <ioctl@plt>
cmpl   $0x6b03,-0x18(%rbp)
jne    1af6 <main+0x916>
mov    -0x1c(%rbp),%esi
lea    0x9f5(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x14(%rbp),%edi
call   10b0 <close@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x98,%rsp
mov    %rsi,%r15
mov    %edi,%r14d
movl   $0x0,0x4(%rsp)
xorps  %xmm0,%xmm0
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,0x80(%rsp)
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
lea    0xe1c(%rip),%rdi
lea    0xe4e(%rip),%rbp
mov    %rbp,%rsi
call   10e0 <popen@plt>
mov    %rax,%rbx
lea    0xe3e(%rip),%r12
lea    0x30(%rsp),%r13
mov    %rax,%rdi
mov    %r12,%rsi
mov    %r13,%rdx
call   1090 <fscanf@plt>
mov    %rbx,%rdi
call   1070 <pclose@plt>
lea    0xe1f(%rip),%rdi
mov    %rbp,%rsi
call   10e0 <popen@plt>
mov    %rax,%rbx
lea    0x10(%rsp),%rdx
mov    %rax,%rdi
mov    %r12,%rsi
call   1090 <fscanf@plt>
mov    %rbx,%rdi
call   1070 <pclose@plt>
mov    %r13,%rdi
call   1040 <strlen@plt>
test   %eax,%eax
je     131a <main+0x13a>
lea    0x10(%rsp),%rdi
call   1040 <strlen@plt>
test   %eax,%eax
je     131a <main+0x13a>
lea    0x10(%rsp),%rdi
call   1100 <atoi@plt>
lea    0xe0d(%rip),%rdx
lea    0x50(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x40,%esi
mov    %eax,%ecx
call   1080 <snprintf@plt>
mov    %rbx,%rdi
call   1050 <system@plt>
cmp    $0x2,%r14d
jle    132c <main+0x14c>
mov    0x8(%r15),%rax
mov    (%rax),%al
add    $0x9c,%al
cmp    $0x13,%al
ja     1418 <main+0x238>
mov    $0x6b01,%edx
xor    %r12d,%r12d
movzbl %al,%eax
lea    0xcff(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
xor    %r13d,%r13d
xor    %r14d,%r14d
jmp    *%rax
mov    $0x6b05,%edx
jmp    1499 <main+0x2b9>
lea    0xde4(%rip),%rdi
call   1030 <puts@plt>
cmp    $0x2,%r14d
jg     12df <main+0xff>
lea    0xe86(%rip),%rdi
call   1030 <puts@plt>
lea    0xebd(%rip),%rdi
call   1030 <puts@plt>
lea    0xee2(%rip),%rdi
call   1030 <puts@plt>
lea    0xf03(%rip),%rdi
call   1030 <puts@plt>
lea    0xf0f(%rip),%rdi
call   1030 <puts@plt>
lea    0xf25(%rip),%rdi
call   1030 <puts@plt>
lea    0xf32(%rip),%rdi
call   1030 <puts@plt>
lea    0xf4f(%rip),%rdi
call   1030 <puts@plt>
lea    0xf98(%rip),%rdi
call   1030 <puts@plt>
lea    0xfac(%rip),%rdi
call   1030 <puts@plt>
lea    0xfc2(%rip),%rdi
call   1030 <puts@plt>
lea    0xfe7(%rip),%rdi
call   1030 <puts@plt>
lea    0xff9(%rip),%rdi
call   1030 <puts@plt>
lea    0x100a(%rip),%rdi
call   1030 <puts@plt>
lea    0x102b(%rip),%rdi
call   1030 <puts@plt>
lea    0x107c(%rip),%rdi
call   1030 <puts@plt>
lea    0x10a8(%rip),%rdi
call   1030 <puts@plt>
lea    0x10df(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x98,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xcfe(%rip),%rdi
jmp    13ff <main+0x21f>
mov    $0x6b06,%edx
jmp    1499 <main+0x2b9>
mov    0x10(%r15),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   10f0 <strtoul@plt>
mov    %eax,%r12d
mov    0x18(%r15),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   10f0 <strtoul@plt>
mov    %eax,%ebp
mov    0x20(%r15),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   10f0 <strtoul@plt>
mov    %eax,%ebx
mov    0x28(%r15),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   10f0 <strtoul@plt>
cmp    $0x21,%eax
jl     16e9 <main+0x509>
lea    0xd11(%rip),%rdi
jmp    13ff <main+0x21f>
mov    $0x6b10,%edx
mov    $0x1,%r14b
xor    %r12d,%r12d
xor    %r13d,%r13d
jmp    14eb <main+0x30b>
mov    $0x6b03,%edx
xor    %r12d,%r12d
jmp    14e5 <main+0x305>
mov    $0x6b11,%edx
mov    $0x1,%r13b
xor    %r12d,%r12d
jmp    14e8 <main+0x308>
mov    0x10(%r15),%rax
mov    (%rax),%cl
cmp    $0x32,%cl
je     1707 <main+0x527>
cmp    $0x31,%cl
je     170e <main+0x52e>
mov    $0x6b0d,%edx
cmp    $0x30,%cl
jne    1499 <main+0x2b9>
cmpb   $0x0,0x1(%rax)
jne    1499 <main+0x2b9>
mov    $0x6b0e,%ebx
jmp    1713 <main+0x533>
mov    $0x6b02,%edx
mov    $0x1,%r12b
xor    %r13d,%r13d
xor    %r14d,%r14d
mov    %rdx,0x8(%rsp)
mov    0x10(%r15),%rbx
cmpb   $0x30,(%rbx)
jne    1506 <main+0x326>
xor    %eax,%eax
cmpb   $0x78,0x1(%rbx)
sete   %al
lea    (%rbx,%rax,2),%rbx
mov    %rbx,%rdi
call   1040 <strlen@plt>
cmp    $0x9,%eax
jl     151f <main+0x33f>
lea    0xc67(%rip),%rdi
call   1030 <puts@plt>
mov    (%rbx),%al
test   %al,%al
je     1584 <main+0x3a4>
add    $0x1,%rbx
xor    %ebp,%ebp
jmp    1547 <main+0x367>
nopl   (%rax)
shl    $0x4,%ebp
add    %ecx,%ebp
add    $0xffffffd0,%ebp
mov    %ebp,0x4(%rsp)
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
je     1586 <main+0x3a6>
movsbl %al,%ecx
lea    -0x30(%rcx),%edx
cmp    $0x9,%dl
jbe    1530 <main+0x350>
lea    -0x41(%rax),%edx
cmp    $0x5,%dl
ja     1570 <main+0x390>
shl    $0x4,%ebp
add    %ecx,%ebp
add    $0xffffffc9,%ebp
jmp    1538 <main+0x358>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x9f,%al
cmp    $0x5,%al
ja     16dd <main+0x4fd>
shl    $0x4,%ebp
add    %ecx,%ebp
add    $0xffffffa9,%ebp
jmp    1538 <main+0x358>
xor    %ebp,%ebp
or     %r13b,%r12b
or     %r14b,%r12b
cmp    $0x1,%r12b
jne    162b <main+0x44b>
mov    0x18(%r15),%rbx
cmpb   $0x30,(%rbx)
jne    15ac <main+0x3cc>
xor    %eax,%eax
cmpb   $0x78,0x1(%rbx)
sete   %al
lea    (%rbx,%rax,2),%rbx
mov    %rbx,%rdi
call   1040 <strlen@plt>
cmp    $0x9,%eax
jl     15c5 <main+0x3e5>
lea    0xbb3(%rip),%rdi
call   1030 <puts@plt>
mov    (%rbx),%cl
test   %cl,%cl
je     1632 <main+0x452>
add    $0x1,%rbx
xor    %eax,%eax
jmp    15f5 <main+0x415>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsbl %cl,%ecx
shl    $0x4,%eax
add    %edx,%eax
add    %ecx,%eax
movzbl (%rbx),%ecx
add    $0x1,%rbx
test   %cl,%cl
je     1634 <main+0x454>
lea    -0x30(%rcx),%esi
mov    $0xffffffd0,%edx
cmp    $0xa,%sil
jb     15e0 <main+0x400>
lea    -0x41(%rcx),%esi
mov    $0xffffffc9,%edx
cmp    $0x6,%sil
jb     15e0 <main+0x400>
lea    -0x61(%rcx),%esi
mov    $0xffffffa9,%edx
cmp    $0x6,%sil
jb     15e0 <main+0x400>
lea    0xb4d(%rip),%rdi
jmp    13ff <main+0x21f>
mov    0x8(%rsp),%rcx
jmp    1643 <main+0x463>
xor    %eax,%eax
shl    $0x10,%ebp
mov    %ebp,%ecx
add    0x8(%rsp),%ecx
mov    %eax,0x4(%rsp)
mov    %eax,%ebp
movzwl %cx,%eax
cmp    $0x6b11,%eax
jne    1669 <main+0x489>
cmp    $0x3ffffff,%ecx
jg     16c5 <main+0x4e5>
cmp    $0x10000,%ecx
jb     16c5 <main+0x4e5>
cmp    $0x3ff,%ebp
jg     16c5 <main+0x4e5>
test   %ebp,%ebp
je     16c5 <main+0x4e5>
test   %ecx,%ecx
je     16d1 <main+0x4f1>
mov    %rcx,%rbp
mov    0x2971(%rip),%rax
mov    (%rax),%esi
lea    0xa75(%rip),%rdi
call   10d0 <open@plt>
test   %eax,%eax
js     1742 <main+0x562>
mov    %eax,%ebx
lea    0x4(%rsp),%rdx
mov    %eax,%edi
mov    %ebp,%esi
xor    %eax,%eax
call   10a0 <ioctl@plt>
cmp    $0x6b03,%ebp
jne    16b9 <main+0x4d9>
mov    0x4(%rsp),%esi
lea    0xa4d(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %ebx,%edi
call   10b0 <close@plt>
jmp    1404 <main+0x224>
lea    0xa7f(%rip),%rdi
jmp    13ff <main+0x21f>
lea    0xa69(%rip),%rdi
jmp    13ff <main+0x21f>
lea    0xa9d(%rip),%rdi
jmp    13ff <main+0x21f>
mov    %r12d,%edi
mov    %ebp,%esi
mov    %ebx,%edx
mov    %eax,%ecx
call   10c0 <ra_reg_mod_bits@plt>
xor    %r12d,%r12d
xor    %r13d,%r13d
xor    %r14d,%r14d
xor    %edx,%edx
jmp    14eb <main+0x30b>
mov    $0x6b0c,%ebx
jmp    1713 <main+0x533>
mov    $0x6b0f,%ebx
mov    0x28ce(%rip),%rax
mov    (%rax),%esi
lea    0x9d2(%rip),%rdi
call   10d0 <open@plt>
test   %eax,%eax
js     1742 <main+0x562>
mov    %eax,%ebp
mov    %eax,%edi
mov    %ebx,%esi
xor    %edx,%edx
xor    %eax,%eax
call   10a0 <ioctl@plt>
mov    %ebp,%edi
jmp    16bb <main+0x4db>
lea    0xa56(%rip),%rdi
jmp    13ff <main+0x21f>

LLVM IR (-O0):
@.str = [57 x i8] c"cat /proc/devices | grep rdm | sed -r -n \22s/[0-9]+ //p\22\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [3 x i8] c"%s\00"
@.str.3 = [60 x i8] c"cat /proc/devices | grep rdm | sed -r -n \22s/ [a-z0-9]*//p\22\00"
@.str.4 = [43 x i8] c"[ -c /dev/rdm0 ] || mknod /dev/rdm0 c %d 0\00"
@.str.5 = [25 x i8] c"RDM module not enabled!\0A\00"
@.str.6 = [68 x i8] c"syntax: reg [method(r/w/s/d/f)] [offset(Hex)] [value(hex, w only)]\0A\00"
@.str.7 = [50 x i8] c"syntax: reg q [interval(Hex in ms)] [count(Hex)]\0A\00"
@.str.8 = [46 x i8] c"syntax: reg o [offset_number] [offset_value]\0A\00"
@.str.9 = [25 x i8] c"read example : reg r 18\0A\00"
@.str.10 = [35 x i8] c"write example : reg w 18 12345678\0A\00"
@.str.11 = [26 x i8] c"dump example : reg d 18 \0A\00"
@.str.12 = [42 x i8] c"dump example [FPGA emulation]: reg f 18 \0A\00"
@.str.13 = [86 x i8] c"modify example : reg m [Offset:Hex] [Data:Hex] [StartBit:Decimal] [DataLen:Decimal] \0A\00"
@.str.14 = [33 x i8] c"To use system register: reg s 0\0A\00"
@.str.15 = [35 x i8] c"To use wireless register: reg s 1\0A\00"
@.str.16 = [50 x i8] c"To use other base address offset: reg s [offset]\0A\00"
@.str.17 = [31 x i8] c"for example: reg s 0xa0500000\0A\00"
@.str.18 = [30 x i8] c"for example: reg m c8 1 31 1\0A\00"
@.str.19 = [46 x i8] c"To show current base address offset: reg s 2\0A\00"
@.str.20 = [94 x i8] c"reg q reads and shows the 16 register values [count] times in the interval of [interval]ms.\0A\00"
@.str.21 = [57 x i8] c"the addresses of the 16 registers are assigned by reg o\0A\00"
@.str.22 = [68 x i8] c"for example: reg o 5 10. This sets the 5th register offset as 0x10\0A\00"
@.str.23 = [67 x i8] c"[interval]: 1 ~ 1000. [count]: 1 ~ 1000. [offset_number]: 0 ~ 15.\0A\00"
@.str.24 = [10 x i8] c"/dev/rdm0\00"
@O_RDONLY = global i32 0
@.str.25 = [27 x i8] c"Open pseudo device failed\0A\00"
@.str.26 = [16 x i8] c"len must <= 32\0A\00"
@.str.27 = [37 x i8] c"method must be either r p d f w s m\0A\00"
@.str.28 = [16 x i8] c"invalid offset\0A\00"
@.str.29 = [15 x i8] c"invalid value\0A\00"
@.str.30 = [41 x i8] c"[interval]: 1 ~ 3ff . [count]: 1 ~ 3ff.\0A\00"
@.str.31 = [11 x i8] c"no method\0A\00"
@.str.32 = [6 x i8] c"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 i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i8*
%11 = alloca [32 x i8]
%12 = alloca [32 x i8]
%13 = alloca [64 x i8]
%14 = alloca i32*
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %7
store i32 0, i32* %8
store i32 0, i32* %9
%19 = bitcast [32 x i8]* %11 to i8*
%20 = bitcast [32 x i8]* %12 to i8*
%21 = bitcast [64 x i8]* %13 to i8*
store i32* null, i32** %14
%22 = call i32* @popen(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %22, i32** %14
%23 = load i32*, i32** %14
%24 = getelementptr inbounds [32 x i8], [32 x i8]* %11, i64 0, i64 0
%25 = call i32 @fscanf(i32* %23, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %24)
%26 = load i32*, i32** %14
%27 = call i32 @pclose(i32* %26)
%28 = call i32* @popen(i8* getelementptr inbounds ([60 x i8], [60 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* %28, i32** %14
%29 = load i32*, i32** %14
%30 = getelementptr inbounds [32 x i8], [32 x i8]* %12, i64 0, i64 0
%31 = call i32 @fscanf(i32* %29, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %30)
%32 = load i32*, i32** %14
%33 = call i32 @pclose(i32* %32)
%34 = getelementptr inbounds [32 x i8], [32 x i8]* %11, i64 0, i64 0
%35 = call i32 @strlen(i8* %34)
%36 = icmp ne i32 %35, 0
br i1 %36, label %37, label %48
37: ; preds = %2
%38 = getelementptr inbounds [32 x i8], [32 x i8]* %12, i64 0, i64 0
%39 = call i32 @strlen(i8* %38)
%40 = icmp ne i32 %39, 0
br i1 %40, label %41, label %48
41: ; preds = %37
%42 = getelementptr inbounds [64 x i8], [64 x i8]* %13, i64 0, i64 0
%43 = getelementptr inbounds [32 x i8], [32 x i8]* %12, i64 0, i64 0
%44 = call i32 @atoi(i8* %43)
%45 = call i32 @snprintf(i8* %42, i32 64, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.4, i64 0, i64 0), i32 %44)
%46 = getelementptr inbounds [64 x i8], [64 x i8]* %13, i64 0, i64 0
%47 = call i32 @system(i8* %46)
br label %50
48: ; preds = %37, %2
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0))
br label %50
50: ; preds = %48, %41
%51 = load i32, i32* %4
%52 = icmp slt i32 %51, 3
br i1 %52, label %53, label %72
53: ; preds = %50
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str.6, i64 0, i64 0))
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.7, i64 0, i64 0))
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.8, i64 0, i64 0))
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.9, i64 0, i64 0))
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.10, i64 0, i64 0))
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.11, i64 0, i64 0))
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.12, i64 0, i64 0))
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([86 x i8], [86 x i8]* @.str.13, i64 0, i64 0))
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.14, i64 0, i64 0))
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.15, i64 0, i64 0))
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.16, i64 0, i64 0))
%65 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.17, i64 0, i64 0))
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.18, i64 0, i64 0))
%67 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.19, i64 0, i64 0))
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([94 x i8], [94 x i8]* @.str.20, i64 0, i64 0))
%69 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.21, i64 0, i64 0))
%70 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str.22, i64 0, i64 0))
%71 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str.23, i64 0, i64 0))
store i32 0, i32* %3
br label %451
72: ; preds = %50
%73 = load i8**, i8*** %5
%74 = getelementptr inbounds i8*, i8** %73, i64 1
%75 = load i8*, i8** %74
store i8* %75, i8** %10
%76 = load i8*, i8** %10
%77 = load i8, i8* %76
%78 = sext i8 %77 to i32
%79 = icmp eq i32 %78, 114
br i1 %79, label %80, label %81
80: ; preds = %72
store i32 27393, i32* %7
br label %212
81: ; preds = %72
%82 = load i8*, i8** %10
%83 = load i8, i8* %82
%84 = sext i8 %83 to i32
%85 = icmp eq i32 %84, 112
br i1 %85, label %86, label %87
86: ; preds = %81
store i32 27395, i32* %7
br label %211
87: ; preds = %81
%88 = load i8*, i8** %10
%89 = load i8, i8* %88
%90 = sext i8 %89 to i32
%91 = icmp eq i32 %90, 100
br i1 %91, label %92, label %93
92: ; preds = %87
store i32 27397, i32* %7
br label %210
93: ; preds = %87
%94 = load i8*, i8** %10
%95 = load i8, i8* %94
%96 = sext i8 %95 to i32
%97 = icmp eq i32 %96, 113
br i1 %97, label %98, label %99
98: ; preds = %93
store i32 27409, i32* %7
br label %209
99: ; preds = %93
%100 = load i8*, i8** %10
%101 = load i8, i8* %100
%102 = sext i8 %101 to i32
%103 = icmp eq i32 %102, 102
br i1 %103, label %104, label %105
104: ; preds = %99
store i32 27398, i32* %7
br label %208
105: ; preds = %99
%106 = load i8*, i8** %10
%107 = load i8, i8* %106
%108 = sext i8 %107 to i32
%109 = icmp eq i32 %108, 119
br i1 %109, label %110, label %111
110: ; preds = %105
store i32 27394, i32* %7
br label %207
111: ; preds = %105
%112 = load i8*, i8** %10
%113 = load i8, i8* %112
%114 = sext i8 %113 to i32
%115 = icmp eq i32 %114, 115
br i1 %115, label %116, label %164
116: ; preds = %111
%117 = load i8**, i8*** %5
%118 = getelementptr inbounds i8*, i8** %117, i64 2
%119 = load i8*, i8** %118
store i8* %119, i8** %10
%120 = load i8*, i8** %10
%121 = load i8, i8* %120
%122 = sext i8 %121 to i32
%123 = icmp eq i32 %122, 48
br i1 %123, label %124, label %131
124: ; preds = %116
%125 = load i8*, i8** %10
%126 = getelementptr inbounds i8, i8* %125, i64 1
%127 = load i8, i8* %126
%128 = sext i8 %127 to i32
%129 = icmp eq i32 %128, 0
br i1 %129, label %130, label %131
130: ; preds = %124
store i32 27406, i32* %7
br label %146
131: ; preds = %124, %116
%132 = load i8*, i8** %10
%133 = load i8, i8* %132
%134 = sext i8 %133 to i32
%135 = icmp eq i32 %134, 49
br i1 %135, label %136, label %137
136: ; preds = %131
store i32 27407, i32* %7
br label %145
137: ; preds = %131
%138 = load i8*, i8** %10
%139 = load i8, i8* %138
%140 = sext i8 %139 to i32
%141 = icmp eq i32 %140, 50
br i1 %141, label %142, label %143
142: ; preds = %137
store i32 27404, i32* %7
br label %144
143: ; preds = %137
store i32 27405, i32* %7
br label %144
144: ; preds = %143, %142
br label %145
145: ; preds = %144, %136
br label %146
146: ; preds = %145, %130
%147 = load i32, i32* %7
%148 = icmp ne i32 %147, 27405
br i1 %148, label %149, label %163
149: ; preds = %146
%150 = load i32, i32* @O_RDONLY
%151 = call i32 @open(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.24, i64 0, i64 0), i32 %150)
store i32 %151, i32* %6
%152 = load i32, i32* %6
%153 = icmp slt i32 %152, 0
br i1 %153, label %154, label %156
154: ; preds = %149
%155 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.25, i64 0, i64 0))
store i32 0, i32* %3
br label %451
156: ; preds = %149
%157 = load i32, i32* %6
%158 = load i32, i32* %7
%159 = load i32, i32* %8
%160 = call i32 (i32, i32, ...) @ioctl(i32 %157, i32 %158, i32 %159)
%161 = load i32, i32* %6
%162 = call i32 @close(i32 %161)
store i32 0, i32* %3
br label %451
163: ; preds = %146
br label %206
164: ; preds = %111
%165 = load i8*, i8** %10
%166 = load i8, i8* %165
%167 = sext i8 %166 to i32
%168 = icmp eq i32 %167, 109
br i1 %168, label %169, label %196
169: ; preds = %164
%170 = load i8**, i8*** %5
%171 = getelementptr inbounds i8*, i8** %170, i64 2
%172 = load i8*, i8** %171
%173 = call i32 @strtoul(i8* %172, i32* null, i32 16)
store i32 %173, i32* %15
%174 = load i8**, i8*** %5
%175 = getelementptr inbounds i8*, i8** %174, i64 3
%176 = load i8*, i8** %175
%177 = call i32 @strtoul(i8* %176, i32* null, i32 16)
store i32 %177, i32* %16
%178 = load i8**, i8*** %5
%179 = getelementptr inbounds i8*, i8** %178, i64 4
%180 = load i8*, i8** %179
%181 = call i32 @strtoul(i8* %180, i32* null, i32 10)
store i32 %181, i32* %17
%182 = load i8**, i8*** %5
%183 = getelementptr inbounds i8*, i8** %182, i64 5
%184 = load i8*, i8** %183
%185 = call i32 @strtoul(i8* %184, i32* null, i32 10)
store i32 %185, i32* %18
%186 = load i32, i32* %18
%187 = icmp sgt i32 %186, 32
br i1 %187, label %188, label %190
188: ; preds = %169
%189 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.26, i64 0, i64 0))
store i32 0, i32* %3
br label %451
190: ; preds = %169
%191 = load i32, i32* %15
%192 = load i32, i32* %16
%193 = load i32, i32* %17
%194 = load i32, i32* %18
%195 = call i32 @ra_reg_mod_bits(i32 %191, i32 %192, i32 %193, i32 %194)
br label %205
196: ; preds = %164
%197 = load i8*, i8** %10
%198 = load i8, i8* %197
%199 = sext i8 %198 to i32
%200 = icmp eq i32 %199, 111
br i1 %200, label %201, label %202
201: ; preds = %196
store i32 27408, i32* %7
br label %204
202: ; preds = %196
%203 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.27, i64 0, i64 0))
store i32 0, i32* %3
br label %451
204: ; preds = %201
br label %205
205: ; preds = %204, %190
br label %206
206: ; preds = %205, %163
br label %207
207: ; preds = %206, %110
br label %208
208: ; preds = %207, %104
br label %209
209: ; preds = %208, %98
br label %210
210: ; preds = %209, %92
br label %211
211: ; preds = %210, %86
br label %212
212: ; preds = %211, %80
%213 = load i8**, i8*** %5
%214 = getelementptr inbounds i8*, i8** %213, i64 2
%215 = load i8*, i8** %214
store i8* %215, i8** %10
%216 = load i8*, i8** %10
%217 = load i8, i8* %216
%218 = sext i8 %217 to i32
%219 = icmp eq i32 %218, 48
br i1 %219, label %220, label %229
220: ; preds = %212
%221 = load i8*, i8** %10
%222 = getelementptr inbounds i8, i8* %221, i64 1
%223 = load i8, i8* %222
%224 = sext i8 %223 to i32
%225 = icmp eq i32 %224, 120
br i1 %225, label %226, label %229
226: ; preds = %220
%227 = load i8*, i8** %10
%228 = getelementptr inbounds i8, i8* %227, i64 2
store i8* %228, i8** %10
br label %229
229: ; preds = %226, %220, %212
%230 = load i8*, i8** %10
%231 = call i32 @strlen(i8* %230)
%232 = icmp sgt i32 %231, 8
br i1 %232, label %233, label %235
233: ; preds = %229
%234 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.28, i64 0, i64 0))
br label %235
235: ; preds = %233, %229
br label %236
236: ; preds = %299, %235
%237 = load i8*, i8** %10
%238 = load i8, i8* %237
%239 = sext i8 %238 to i32
%240 = icmp ne i32 %239, 0
br i1 %240, label %241, label %302
241: ; preds = %236
%242 = load i8*, i8** %10
%243 = load i8, i8* %242
%244 = sext i8 %243 to i32
%245 = icmp sge i32 %244, 48
br i1 %245, label %246, label %259
246: ; preds = %241
%247 = load i8*, i8** %10
%248 = load i8, i8* %247
%249 = sext i8 %248 to i32
%250 = icmp sle i32 %249, 57
br i1 %250, label %251, label %259
251: ; preds = %246
%252 = load i32, i32* %8
%253 = mul nsw i32 %252, 16
%254 = load i8*, i8** %10
%255 = load i8, i8* %254
%256 = sext i8 %255 to i32
%257 = add nsw i32 %253, %256
%258 = sub nsw i32 %257, 48
store i32 %258, i32* %8
br label %299
259: ; preds = %246, %241
%260 = load i8*, i8** %10
%261 = load i8, i8* %260
%262 = sext i8 %261 to i32
%263 = icmp sge i32 %262, 65
br i1 %263, label %264, label %277
264: ; preds = %259
%265 = load i8*, i8** %10
%266 = load i8, i8* %265
%267 = sext i8 %266 to i32
%268 = icmp sle i32 %267, 70
br i1 %268, label %269, label %277
269: ; preds = %264
%270 = load i32, i32* %8
%271 = mul nsw i32 %270, 16
%272 = load i8*, i8** %10
%273 = load i8, i8* %272
%274 = sext i8 %273 to i32
%275 = add nsw i32 %271, %274
%276 = sub nsw i32 %275, 55
store i32 %276, i32* %8
br label %298
277: ; preds = %264, %259
%278 = load i8*, i8** %10
%279 = load i8, i8* %278
%280 = sext i8 %279 to i32
%281 = icmp sge i32 %280, 97
br i1 %281, label %282, label %295
282: ; preds = %277
%283 = load i8*, i8** %10
%284 = load i8, i8* %283
%285 = sext i8 %284 to i32
%286 = icmp sle i32 %285, 102
br i1 %286, label %287, label %295
287: ; preds = %282
%288 = load i32, i32* %8
%289 = mul nsw i32 %288, 16
%290 = load i8*, i8** %10
%291 = load i8, i8* %290
%292 = sext i8 %291 to i32
%293 = add nsw i32 %289, %292
%294 = sub nsw i32 %293, 87
store i32 %294, i32* %8
br label %297
295: ; preds = %282, %277
%296 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.28, i64 0, i64 0))
store i32 0, i32* %3
br label %451
297: ; preds = %287
br label %298
298: ; preds = %297, %269
br label %299
299: ; preds = %298, %251
%300 = load i8*, i8** %10
%301 = getelementptr inbounds i8, i8* %300, i32 1
store i8* %301, i8** %10
br label %236
302: ; preds = %236
%303 = load i32, i32* %7
%304 = icmp eq i32 %303, 27394
br i1 %304, label %311, label %305
305: ; preds = %302
%306 = load i32, i32* %7
%307 = icmp eq i32 %306, 27409
br i1 %307, label %311, label %308
308: ; preds = %305
%309 = load i32, i32* %7
%310 = icmp eq i32 %309, 27408
br i1 %310, label %311, label %407
311: ; preds = %308, %305, %302
%312 = load i8**, i8*** %5
%313 = getelementptr inbounds i8*, i8** %312, i64 3
%314 = load i8*, i8** %313
store i8* %314, i8** %10
%315 = load i8*, i8** %10
%316 = load i8, i8* %315
%317 = sext i8 %316 to i32
%318 = icmp eq i32 %317, 48
br i1 %318, label %319, label %328
319: ; preds = %311
%320 = load i8*, i8** %10
%321 = getelementptr inbounds i8, i8* %320, i64 1
%322 = load i8, i8* %321
%323 = sext i8 %322 to i32
%324 = icmp eq i32 %323, 120
br i1 %324, label %325, label %328
325: ; preds = %319
%326 = load i8*, i8** %10
%327 = getelementptr inbounds i8, i8* %326, i64 2
store i8* %327, i8** %10
br label %328
328: ; preds = %325, %319, %311
%329 = load i8*, i8** %10
%330 = call i32 @strlen(i8* %329)
%331 = icmp sgt i32 %330, 8
br i1 %331, label %332, label %334
332: ; preds = %328
%333 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.29, i64 0, i64 0))
br label %334
334: ; preds = %332, %328
%335 = load i32, i32* %7
%336 = load i32, i32* %8
%337 = shl i32 %336, 16
%338 = or i32 %335, %337
store i32 %338, i32* %7
br label %339
339: ; preds = %402, %334
%340 = load i8*, i8** %10
%341 = load i8, i8* %340
%342 = sext i8 %341 to i32
%343 = icmp ne i32 %342, 0
br i1 %343, label %344, label %405
344: ; preds = %339
%345 = load i8*, i8** %10
%346 = load i8, i8* %345
%347 = sext i8 %346 to i32
%348 = icmp sge i32 %347, 48
br i1 %348, label %349, label %362
349: ; preds = %344
%350 = load i8*, i8** %10
%351 = load i8, i8* %350
%352 = sext i8 %351 to i32
%353 = icmp sle i32 %352, 57
br i1 %353, label %354, label %362
354: ; preds = %349
%355 = load i32, i32* %9
%356 = mul nsw i32 %355, 16
%357 = load i8*, i8** %10
%358 = load i8, i8* %357
%359 = sext i8 %358 to i32
%360 = add nsw i32 %356, %359
%361 = sub nsw i32 %360, 48
store i32 %361, i32* %9
br label %402
362: ; preds = %349, %344
%363 = load i8*, i8** %10
%364 = load i8, i8* %363
%365 = sext i8 %364 to i32
%366 = icmp sge i32 %365, 65
br i1 %366, label %367, label %380
367: ; preds = %362
%368 = load i8*, i8** %10
%369 = load i8, i8* %368
%370 = sext i8 %369 to i32
%371 = icmp sle i32 %370, 70
br i1 %371, label %372, label %380
372: ; preds = %367
%373 = load i32, i32* %9
%374 = mul nsw i32 %373, 16
%375 = load i8*, i8** %10
%376 = load i8, i8* %375
%377 = sext i8 %376 to i32
%378 = add nsw i32 %374, %377
%379 = sub nsw i32 %378, 55
store i32 %379, i32* %9
br label %401
380: ; preds = %367, %362
%381 = load i8*, i8** %10
%382 = load i8, i8* %381
%383 = sext i8 %382 to i32
%384 = icmp sge i32 %383, 97
br i1 %384, label %385, label %398
385: ; preds = %380
%386 = load i8*, i8** %10
%387 = load i8, i8* %386
%388 = sext i8 %387 to i32
%389 = icmp sle i32 %388, 102
br i1 %389, label %390, label %398
390: ; preds = %385
%391 = load i32, i32* %9
%392 = mul nsw i32 %391, 16
%393 = load i8*, i8** %10
%394 = load i8, i8* %393
%395 = sext i8 %394 to i32
%396 = add nsw i32 %392, %395
%397 = sub nsw i32 %396, 87
store i32 %397, i32* %9
br label %400
398: ; preds = %385, %380
%399 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.29, i64 0, i64 0))
store i32 0, i32* %3
br label %451
400: ; preds = %390
br label %401
401: ; preds = %400, %372
br label %402
402: ; preds = %401, %354
%403 = load i8*, i8** %10
%404 = getelementptr inbounds i8, i8* %403, i32 1
store i8* %404, i8** %10
br label %339
405: ; preds = %339
%406 = load i32, i32* %9
store i32 %406, i32* %8
br label %407
407: ; preds = %405, %308
%408 = load i32, i32* %7
%409 = and i32 %408, 65535
%410 = icmp eq i32 %409, 27409
br i1 %410, label %411, label %427
411: ; preds = %407
%412 = load i32, i32* %7
%413 = ashr i32 %412, 16
%414 = icmp sgt i32 %413, 1023
br i1 %414, label %425, label %415
415: ; preds = %411
%416 = load i32, i32* %7
%417 = ashr i32 %416, 16
%418 = icmp eq i32 %417, 0
br i1 %418, label %425, label %419
419: ; preds = %415
%420 = load i32, i32* %8
%421 = icmp sgt i32 %420, 1023
br i1 %421, label %425, label %422
422: ; preds = %419
%423 = load i32, i32* %8
%424 = icmp eq i32 %423, 0
br i1 %424, label %425, label %427
425: ; preds = %422, %419, %415, %411
%426 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.30, i64 0, i64 0))
store i32 0, i32* %3
br label %451
427: ; preds = %422, %407
%428 = load i32, i32* %7
%429 = icmp eq i32 %428, 0
br i1 %429, label %430, label %432
430: ; preds = %427
%431 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.31, i64 0, i64 0))
store i32 0, i32* %3
br label %451
432: ; preds = %427
%433 = load i32, i32* @O_RDONLY
%434 = call i32 @open(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.24, i64 0, i64 0), i32 %433)
store i32 %434, i32* %6
%435 = load i32, i32* %6
%436 = icmp slt i32 %435, 0
br i1 %436, label %437, label %439
437: ; preds = %432
%438 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.25, i64 0, i64 0))
store i32 0, i32* %3
br label %451
439: ; preds = %432
%440 = load i32, i32* %6
%441 = load i32, i32* %7
%442 = call i32 (i32, i32, ...) @ioctl(i32 %440, i32 %441, i32* %8)
%443 = load i32, i32* %7
%444 = icmp eq i32 %443, 27395
br i1 %444, label %445, label %448
445: ; preds = %439
%446 = load i32, i32* %8
%447 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.32, i64 0, i64 0), i32 %446)
br label %448
448: ; preds = %445, %439
%449 = load i32, i32* %6
%450 = call i32 @close(i32 %449)
store i32 0, i32* %3
br label %451
451: ; preds = %448, %437, %430, %425, %398, %295, %202, %188, %156, %154, %53
%452 = load i32, i32* %3
ret i32 %452
}

LLVM IR (-O2):
@.str = [57 x i8] c"cat /proc/devices | grep rdm | sed -r -n \22s/[0-9]+ //p\22\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [3 x i8] c"%s\00"
@.str.3 = [60 x i8] c"cat /proc/devices | grep rdm | sed -r -n \22s/ [a-z0-9]*//p\22\00"
@.str.4 = [43 x i8] c"[ -c /dev/rdm0 ] || mknod /dev/rdm0 c %d 0\00"
@.str.24 = [10 x i8] c"/dev/rdm0\00"
@O_RDONLY = global i32 0
@.str.32 = [6 x i8] c"0x%x\0A\00"
@str = [24 x i8] c"RDM module not enabled!\00"
@str.33 = [36 x i8] c"method must be either r p d f w s m\00"
@str.35 = [10 x i8] c"no method\00"
@str.36 = [40 x i8] c"[interval]: 1 ~ 3ff . [count]: 1 ~ 3ff.\00"
@str.38 = [14 x i8] c"invalid value\00"
@str.40 = [15 x i8] c"invalid offset\00"
@str.41 = [15 x i8] c"len must <= 32\00"
@str.42 = [26 x i8] c"Open pseudo device failed\00"
@str.43 = [67 x i8] c"syntax: reg [method(r/w/s/d/f)] [offset(Hex)] [value(hex, w only)]\00"
@str.44 = [49 x i8] c"syntax: reg q [interval(Hex in ms)] [count(Hex)]\00"
@str.45 = [45 x i8] c"syntax: reg o [offset_number] [offset_value]\00"
@str.46 = [24 x i8] c"read example : reg r 18\00"
@str.47 = [34 x i8] c"write example : reg w 18 12345678\00"
@str.48 = [25 x i8] c"dump example : reg d 18 \00"
@str.49 = [41 x i8] c"dump example [FPGA emulation]: reg f 18 \00"
@str.50 = [85 x i8] c"modify example : reg m [Offset:Hex] [Data:Hex] [StartBit:Decimal] [DataLen:Decimal] \00"
@str.51 = [32 x i8] c"To use system register: reg s 0\00"
@str.52 = [34 x i8] c"To use wireless register: reg s 1\00"
@str.53 = [49 x i8] c"To use other base address offset: reg s [offset]\00"
@str.54 = [30 x i8] c"for example: reg s 0xa0500000\00"
@str.55 = [29 x i8] c"for example: reg m c8 1 31 1\00"
@str.56 = [45 x i8] c"To show current base address offset: reg s 2\00"
@str.57 = [93 x i8] c"reg q reads and shows the 16 register values [count] times in the interval of [interval]ms.\00"
@str.58 = [56 x i8] c"the addresses of the 16 registers are assigned by reg o\00"
@str.59 = [67 x i8] c"for example: reg o 5 10. This sets the 5th register offset as 0x10\00"
@str.60 = [66 x i8] c"[interval]: 1 ~ 1000. [count]: 1 ~ 1000. [offset_number]: 0 ~ 15.\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca [32 x i8]
%5 = alloca [32 x i8]
%6 = alloca [64 x i8]
%7 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%8 = getelementptr inbounds [32 x i8], [32 x i8]* %4, i64 0, i64 0
%9 = getelementptr inbounds [32 x i8], [32 x i8]* %5, i64 0, i64 0
%10 = getelementptr inbounds [64 x i8], [64 x i8]* %6, i64 0, i64 0
%11 = tail call i32* @popen(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%12 = call i32 @fscanf(i32* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %8)
%13 = call i32 @pclose(i32* %11)
%14 = call i32* @popen(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%15 = call i32 @fscanf(i32* %14, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %9)
%16 = call i32 @pclose(i32* %14)
%17 = call i32 @strlen(i8* %8)
%18 = icmp eq i32 %17, 0
br i1 %18, label %26, label %19
19: ; preds = %2
%20 = call i32 @strlen(i8* %9)
%21 = icmp eq i32 %20, 0
br i1 %21, label %26, label %22
22: ; preds = %19
%23 = call i32 @atoi(i8* %9)
%24 = call i32 @snprintf(i8* %10, i32 64, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.4, i64 0, i64 0), i32 %23)
%25 = call i32 @system(i8* %10)
br label %28
26: ; preds = %19, %2
%27 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0))
br label %28
28: ; preds = %26, %22
%29 = icmp slt i32 %0, 3
br i1 %29, label %30, label %49
30: ; preds = %28
%31 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([67 x i8], [67 x i8]* @str.43, i64 0, i64 0))
%32 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @str.44, i64 0, i64 0))
%33 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @str.45, i64 0, i64 0))
%34 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.46, i64 0, i64 0))
%35 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str.47, i64 0, i64 0))
%36 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.48, i64 0, i64 0))
%37 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str.49, i64 0, i64 0))
%38 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([85 x i8], [85 x i8]* @str.50, i64 0, i64 0))
%39 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.51, i64 0, i64 0))
%40 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str.52, i64 0, i64 0))
%41 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @str.53, i64 0, i64 0))
%42 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str.54, i64 0, i64 0))
%43 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str.55, i64 0, i64 0))
%44 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @str.56, i64 0, i64 0))
%45 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([93 x i8], [93 x i8]* @str.57, i64 0, i64 0))
%46 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([56 x i8], [56 x i8]* @str.58, i64 0, i64 0))
%47 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([67 x i8], [67 x i8]* @str.59, i64 0, i64 0))
%48 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([66 x i8], [66 x i8]* @str.60, i64 0, i64 0))
br label %238
49: ; preds = %28
%50 = getelementptr inbounds i8*, i8** %1, i64 1
%51 = load i8*, i8** %50
%52 = load i8, i8* %51
switch i8 %52, label %96 [
i8 114, label %98
i8 112, label %53
i8 100, label %54
i8 113, label %55
i8 102, label %56
i8 119, label %57
i8 115, label %58
i8 109, label %77
i8 111, label %95
]
53: ; preds = %49
br label %98
54: ; preds = %49
br label %98
55: ; preds = %49
br label %98
56: ; preds = %49
br label %98
57: ; preds = %49
br label %98
58: ; preds = %49
%59 = getelementptr inbounds i8*, i8** %1, i64 2
%60 = load i8*, i8** %59
%61 = load i8, i8* %60
switch i8 %61, label %98 [
i8 48, label %62
i8 49, label %67
i8 50, label %66
]
62: ; preds = %58
%63 = getelementptr inbounds i8, i8* %60, i64 1
%64 = load i8, i8* %63
%65 = icmp eq i8 %64, 0
br i1 %65, label %67, label %98
66: ; preds = %58
br label %67
67: ; preds = %58, %66, %62
%68 = phi i32 [ 27406, %62 ], [ 27404, %66 ], [ 27407, %58 ]
%69 = load i32, i32* @O_RDONLY
%70 = call i32 @open(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.24, i64 0, i64 0), i32 %69)
%71 = icmp slt i32 %70, 0
br i1 %71, label %72, label %74
72: ; preds = %67
%73 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.42, i64 0, i64 0))
br label %238
74: ; preds = %67
%75 = call i32 (i32, i32, ...) @ioctl(i32 %70, i32 %68, i32 0)
%76 = call i32 @close(i32 %70)
br label %238
77: ; preds = %49
%78 = getelementptr inbounds i8*, i8** %1, i64 2
%79 = load i8*, i8** %78
%80 = call i32 @strtoul(i8* nocapture %79, i32* null, i32 16)
%81 = getelementptr inbounds i8*, i8** %1, i64 3
%82 = load i8*, i8** %81
%83 = call i32 @strtoul(i8* nocapture %82, i32* null, i32 16)
%84 = getelementptr inbounds i8*, i8** %1, i64 4
%85 = load i8*, i8** %84
%86 = call i32 @strtoul(i8* nocapture %85, i32* null, i32 10)
%87 = getelementptr inbounds i8*, i8** %1, i64 5
%88 = load i8*, i8** %87
%89 = call i32 @strtoul(i8* nocapture %88, i32* null, i32 10)
%90 = icmp sgt i32 %89, 32
br i1 %90, label %91, label %93
91: ; preds = %77
%92 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.41, i64 0, i64 0))
br label %238
93: ; preds = %77
%94 = call i32 @ra_reg_mod_bits(i32 %80, i32 %83, i32 %86, i32 %89)
br label %98
95: ; preds = %49
br label %98
96: ; preds = %49
%97 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str.33, i64 0, i64 0))
br label %238
98: ; preds = %58, %62, %93, %49, %53, %55, %57, %95, %56, %54
%99 = phi i1 [ false, %53 ], [ false, %55 ], [ true, %57 ], [ false, %95 ], [ false, %93 ], [ false, %56 ], [ false, %54 ], [ false, %49 ], [ false, %62 ], [ false, %58 ]
%100 = phi i1 [ false, %53 ], [ true, %55 ], [ false, %57 ], [ false, %95 ], [ false, %93 ], [ false, %56 ], [ false, %54 ], [ false, %49 ], [ false, %62 ], [ false, %58 ]
%101 = phi i1 [ false, %53 ], [ false, %55 ], [ false, %57 ], [ true, %95 ], [ false, %93 ], [ false, %56 ], [ false, %54 ], [ false, %49 ], [ false, %62 ], [ false, %58 ]
%102 = phi i32 [ 27395, %53 ], [ 27409, %55 ], [ 27394, %57 ], [ 27408, %95 ], [ 0, %93 ], [ 27398, %56 ], [ 27397, %54 ], [ 27393, %49 ], [ 27405, %62 ], [ 27405, %58 ]
%103 = getelementptr inbounds i8*, i8** %1, i64 2
%104 = load i8*, i8** %103
%105 = load i8, i8* %104
%106 = icmp eq i8 %105, 48
br i1 %106, label %107, label %113
107: ; preds = %98
%108 = getelementptr inbounds i8, i8* %104, i64 1
%109 = load i8, i8* %108
%110 = icmp eq i8 %109, 120
%111 = select i1 %110, i64 2, i64 0
%112 = getelementptr i8, i8* %104, i64 %111
br label %113
113: ; preds = %107, %98
%114 = phi i8* [ %104, %98 ], [ %112, %107 ]
%115 = call i32 @strlen(i8* %114)
%116 = icmp sgt i32 %115, 8
br i1 %116, label %117, label %119
117: ; preds = %113
%118 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.40, i64 0, i64 0))
br label %119
119: ; preds = %117, %113
%120 = load i8, i8* %114
%121 = icmp eq i8 %120, 0
br i1 %121, label %154, label %122
122: ; preds = %119, %149
%123 = phi i32 [ %150, %149 ], [ 0, %119 ]
%124 = phi i8 [ %152, %149 ], [ %120, %119 ]
%125 = phi i8* [ %151, %149 ], [ %114, %119 ]
%126 = sext i8 %124 to i32
%127 = add i8 %124, -48
%128 = icmp ult i8 %127, 10
br i1 %128, label %129, label %133
129: ; preds = %122
%130 = shl nsw i32 %123, 4
%131 = add nsw i32 %126, -48
%132 = add i32 %131, %130
store i32 %132, i32* %3
br label %149
133: ; preds = %122
%134 = add i8 %124, -65
%135 = icmp ult i8 %134, 6
br i1 %135, label %136, label %140
136: ; preds = %133
%137 = shl nsw i32 %123, 4
%138 = add nsw i32 %126, -55
%139 = add i32 %138, %137
store i32 %139, i32* %3
br label %149
140: ; preds = %133
%141 = add i8 %124, -97
%142 = icmp ult i8 %141, 6
br i1 %142, label %143, label %147
143: ; preds = %140
%144 = shl nsw i32 %123, 4
%145 = add nsw i32 %126, -87
%146 = add i32 %145, %144
store i32 %146, i32* %3
br label %149
147: ; preds = %140
%148 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.40, i64 0, i64 0))
br label %238
149: ; preds = %136, %143, %129
%150 = phi i32 [ %139, %136 ], [ %146, %143 ], [ %132, %129 ]
%151 = getelementptr inbounds i8, i8* %125, i64 1
%152 = load i8, i8* %151
%153 = icmp eq i8 %152, 0
br i1 %153, label %154, label %122
154: ; preds = %149, %119
%155 = phi i32 [ 0, %119 ], [ %150, %149 ]
%156 = or i1 %99, %100
%157 = or i1 %156, %101
br i1 %157, label %158, label %205
158: ; preds = %154
%159 = getelementptr inbounds i8*, i8** %1, i64 3
%160 = load i8*, i8** %159
%161 = load i8, i8* %160
%162 = icmp eq i8 %161, 48
br i1 %162, label %163, label %169
163: ; preds = %158
%164 = getelementptr inbounds i8, i8* %160, i64 1
%165 = load i8, i8* %164
%166 = icmp eq i8 %165, 120
%167 = select i1 %166, i64 2, i64 0
%168 = getelementptr i8, i8* %160, i64 %167
br label %169
169: ; preds = %163, %158
%170 = phi i8* [ %160, %158 ], [ %168, %163 ]
%171 = call i32 @strlen(i8* %170)
%172 = icmp sgt i32 %171, 8
br i1 %172, label %173, label %175
173: ; preds = %169
%174 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.38, i64 0, i64 0))
br label %175
175: ; preds = %173, %169
%176 = shl i32 %155, 16
%177 = or i32 %176, %102
%178 = load i8, i8* %170
%179 = icmp eq i8 %178, 0
br i1 %179, label %203, label %180
180: ; preds = %175, %195
%181 = phi i8 [ %201, %195 ], [ %178, %175 ]
%182 = phi i32 [ %199, %195 ], [ 0, %175 ]
%183 = phi i8* [ %200, %195 ], [ %170, %175 ]
%184 = sext i8 %181 to i32
%185 = add i8 %181, -48
%186 = icmp ult i8 %185, 10
br i1 %186, label %195, label %187
187: ; preds = %180
%188 = add i8 %181, -65
%189 = icmp ult i8 %188, 6
br i1 %189, label %195, label %190
190: ; preds = %187
%191 = add i8 %181, -97
%192 = icmp ult i8 %191, 6
br i1 %192, label %195, label %193
193: ; preds = %190
%194 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.38, i64 0, i64 0))
br label %238
195: ; preds = %190, %187, %180
%196 = phi i32 [ -48, %180 ], [ -55, %187 ], [ -87, %190 ]
%197 = shl nsw i32 %182, 4
%198 = add i32 %197, %196
%199 = add i32 %198, %184
%200 = getelementptr inbounds i8, i8* %183, i64 1
%201 = load i8, i8* %200
%202 = icmp eq i8 %201, 0
br i1 %202, label %203, label %180
203: ; preds = %195, %175
%204 = phi i32 [ 0, %175 ], [ %199, %195 ]
store i32 %204, i32* %3
br label %205
205: ; preds = %154, %203
%206 = phi i32 [ %204, %203 ], [ %155, %154 ]
%207 = phi i32 [ %177, %203 ], [ %102, %154 ]
%208 = and i32 %207, 65535
%209 = icmp eq i32 %208, 27409
br i1 %209, label %210, label %220
210: ; preds = %205
%211 = icmp sgt i32 %207, 67108863
br i1 %211, label %218, label %212
212: ; preds = %210
%213 = icmp ult i32 %207, 65536
%214 = icmp sgt i32 %206, 1023
%215 = select i1 %213, i1 true, i1 %214
%216 = icmp eq i32 %206, 0
%217 = select i1 %215, i1 true, i1 %216
br i1 %217, label %218, label %220
218: ; preds = %212, %210
%219 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str.36, i64 0, i64 0))
br label %238
220: ; preds = %212, %205
%221 = icmp eq i32 %207, 0
br i1 %221, label %222, label %224
222: ; preds = %220
%223 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str.35, i64 0, i64 0))
br label %238
224: ; preds = %220
%225 = load i32, i32* @O_RDONLY
%226 = call i32 @open(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.24, i64 0, i64 0), i32 %225)
%227 = icmp slt i32 %226, 0
br i1 %227, label %228, label %230
228: ; preds = %224
%229 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.42, i64 0, i64 0))
br label %238
230: ; preds = %224
%231 = call i32 (i32, i32, ...) @ioctl(i32 %226, i32 %207, i32* %3)
%232 = icmp eq i32 %207, 27395
br i1 %232, label %233, label %236
233: ; preds = %230
%234 = load i32, i32* %3
%235 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.32, i64 0, i64 0), i32 %234)
br label %236
236: ; preds = %233, %230
%237 = call i32 @close(i32 %226)
br label %238
238: ; preds = %91, %236, %228, %222, %218, %193, %147, %96, %74, %72, %30
ret i32 0
}