#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 */
struct js_event {
  int type;
  char number;
  int value;
};
typedef int /*<<< orphan*/ filename;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int EOF;
int /*<<< orphan*/ EXIT_FAILURE;
int JS_EVENT_AXIS;
int JS_EVENT_BUTTON;
int JS_EVENT_INIT;
int /*<<< orphan*/ ewc(int /*<<< orphan*/, char *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int getc(int /*<<< orphan*/);
int read(int, struct js_event *, int);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ *stdout;
int strlen(char *);
void map_buttons_axes(int joyfd, struct js_event *joystick, char jsbuttons,
                      char jsaxes, char *jsname, char *buttons, char *axes,
                      char *reversed) {
  fprintf(stdout, "%s\n",
          "Press the button on the joystick to init the configuration wizard!");
  int temp_stat;
  while ((temp_stat = read(joyfd, joystick, sizeof(struct js_event))) >= 0 &&
         (joystick->type & JS_EVENT_INIT) != 0)
    ;
  if (temp_stat < 0)
    ewc(EXIT_FAILURE, "Error while reading from the joystick.");
  if (read(joyfd, joystick, sizeof(struct js_event)) < 0)
    ewc(EXIT_FAILURE, "Error while reading from the joystick.");
  short temp_negative;
  for (temp_negative = 0; temp_negative < jsbuttons; ++temp_negative)
    buttons[temp_negative] = -1;
  for (temp_negative = 0; temp_negative < jsaxes; ++temp_negative) {
    axes[temp_negative] = -1;
    reversed[temp_negative] = 1;
  }
  char i = 0;
  fprintf(stdout,
          "Press all of the %d buttons! Do NOT press any button again.\n",
          jsbuttons);
  while (i < jsbuttons) {
    if (read(joyfd, joystick, sizeof(struct js_event)) < 0)
      ewc(EXIT_FAILURE, "Error in read() function.\n");
    if (joystick->type != JS_EVENT_BUTTON)
      continue;
    char temp_check, cont = 0;
    for (temp_check = 0; temp_check < jsbuttons; ++temp_check)
      if (buttons[temp_check] == joystick->number) {
        fprintf(stderr, "%s\n", "This button was pressed already!");
        cont = 1;
      }
    if (cont)
      continue;
    if (joystick->value == 1) {
      buttons[i] = joystick->number;
      fprintf(stdout, "%s %d\n", "Pressed button code:", joystick->number);
    }
    while (joystick->number != buttons[i] || joystick->value != 0)
      read(joyfd, joystick, sizeof(struct js_event));
    ++i;
  }
  fprintf(stdout,
          "Move all of the %d axes! Do NOT move any axis again. Try to move "
          "the analogs perfectly straight. Move them right and up, not left "
          "and down.\n",
          jsaxes);
  i = 0;
  while (i < jsaxes) {
    if (read(joyfd, joystick, sizeof(struct js_event)) < 0)
      ewc(EXIT_FAILURE, "Error in read() function.\n");
    if (joystick->type != JS_EVENT_AXIS)
      continue;
    char temp_check, cont = 0;
    for (temp_check = 0; temp_check < jsaxes; ++temp_check)
      if (axes[temp_check] == joystick->number) {
        fprintf(stderr, "%s\n", "This axis was moved already!");
        cont = 1;
      }
    if (cont)
      continue;
    if (joystick->value != 0) {
      axes[i] = joystick->number;
      fprintf(stdout, "%s %d\n", "Moved axis code:", joystick->number);
      if (joystick->value < 0) {
        reversed[i] = -1;
        fprintf(stdout, "%s\n", "Known as reversed.");
      }
    }
    while (joystick->number != axes[i] || joystick->value != 0)
      read(joyfd, joystick, sizeof(struct js_event));
    ++i;
  }
  fprintf(stdout, "Configuration is finished! Would you like to save the "
                  "configuration in a file for future usage? [Yy/Nn] ");
  int yesorno = getc(stdin);
  if (yesorno == 'Y' || yesorno == 'y') {
    while ((yesorno = getc(stdin)) != '\n' && yesorno != EOF)
      ;
    fprintf(stdout, "Under the name of (no more than 255 characters): ");
    char filename[256];
    if (fgets(filename, sizeof(filename), stdin) == NULL)
      ewc(EXIT_FAILURE, "Failed to get the filename string.");
    filename[strlen(filename) - 1] = '\0';
    FILE *temp = fopen(filename, "r");
    if (temp != NULL) {
      fclose(temp);
      fprintf(stdout, "Are you sure you want to overwrite %s? [Yy/Nn] ",
              filename);
      yesorno = getc(stdin);
      if (yesorno == 'Y' || yesorno == 'y') {
        while ((yesorno = getc(stdin)) != '\n' && yesorno != EOF)
          ;
        FILE *saveFile = fopen(filename, "w");
        fprintf(saveFile, "%s\n", jsname);
        for (i = 0; i < jsbuttons; ++i)
          fprintf(saveFile, "%d\n", buttons[i]);
        for (i = 0; i < jsaxes; ++i)
          fprintf(saveFile, "%d\n", axes[i]);
        for (i = 0; i < jsaxes; ++i)
          fprintf(saveFile, "%d\n", reversed[i]);
        fclose(saveFile);
      }
    } else {
      FILE *saveFile = fopen(filename, "w");
      fprintf(saveFile, "%s\n", jsname);
      for (i = 0; i < jsbuttons; ++i)
        fprintf(saveFile, "%d\n", buttons[i]);
      for (i = 0; i < jsaxes; ++i)
        fprintf(saveFile, "%d\n", axes[i]);
      for (i = 0; i < jsaxes; ++i)
        fprintf(saveFile, "%d\n", reversed[i]);
      fclose(saveFile);
    }
  }
}


x86 assembly (clang, -O0):
<map_buttons_axes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x160,%rsp
mov    %cl,%al
mov    %dl,%cl
mov    0x18(%rbp),%rdx
mov    0x10(%rbp),%rdx
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %cl,-0x11(%rbp)
mov    %al,-0x12(%rbp)
mov    %r8,-0x20(%rbp)
mov    %r9,-0x28(%rbp)
mov    0x2dfd(%rip),%rax
mov    (%rax),%rdi
lea    0xe43(%rip),%rsi
lea    0xe40(%rip),%rdx
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    $0xc,%edx
call   1050 <read@plt>
mov    %eax,%ecx
mov    %ecx,-0x2c(%rbp)
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x159(%rbp)
jl     120d <map_buttons_axes+0x8d>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    0x2db9(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x159(%rbp)
mov    -0x159(%rbp),%al
test   $0x1,%al
jne    1220 <map_buttons_axes+0xa0>
jmp    1225 <map_buttons_axes+0xa5>
jmp    11cb <map_buttons_axes+0x4b>
cmpl   $0x0,-0x2c(%rbp)
jge    1244 <map_buttons_axes+0xc4>
mov    0x2d8a(%rip),%rax
mov    (%rax),%edi
lea    0xe08(%rip),%rsi
call   1080 <ewc@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    $0xc,%edx
call   1050 <read@plt>
cmp    $0x0,%eax
jge    1273 <map_buttons_axes+0xf3>
mov    0x2d5b(%rip),%rax
mov    (%rax),%edi
lea    0xdd9(%rip),%rsi
call   1080 <ewc@plt>
movw   $0x0,-0x2e(%rbp)
movswl -0x2e(%rbp),%eax
movsbl -0x11(%rbp),%ecx
cmp    %ecx,%eax
jge    12a7 <map_buttons_axes+0x127>
mov    -0x28(%rbp),%rax
movswq -0x2e(%rbp),%rcx
movb   $0xff,(%rax,%rcx,1)
mov    -0x2e(%rbp),%ax
add    $0x1,%ax
mov    %ax,-0x2e(%rbp)
jmp    1279 <map_buttons_axes+0xf9>
movw   $0x0,-0x2e(%rbp)
movswl -0x2e(%rbp),%eax
movsbl -0x12(%rbp),%ecx
cmp    %ecx,%eax
jge    12e8 <map_buttons_axes+0x168>
mov    0x10(%rbp),%rax
movswq -0x2e(%rbp),%rcx
movb   $0xff,(%rax,%rcx,1)
mov    0x18(%rbp),%rax
movswq -0x2e(%rbp),%rcx
movb   $0x1,(%rax,%rcx,1)
mov    -0x2e(%rbp),%ax
add    $0x1,%ax
mov    %ax,-0x2e(%rbp)
jmp    12ad <map_buttons_axes+0x12d>
movb   $0x0,-0x2f(%rbp)
mov    0x2cbd(%rip),%rax
mov    (%rax),%rdi
movsbl -0x11(%rbp),%edx
lea    0xd6d(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movsbl -0x2f(%rbp),%eax
movsbl -0x11(%rbp),%ecx
cmp    %ecx,%eax
jge    1493 <map_buttons_axes+0x313>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    $0xc,%edx
call   1050 <read@plt>
cmp    $0x0,%eax
jge    1347 <map_buttons_axes+0x1c7>
mov    0x2c87(%rip),%rax
mov    (%rax),%edi
lea    0xd69(%rip),%rsi
call   1080 <ewc@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    0x2c4c(%rip),%rcx
cmp    (%rcx),%eax
je     1361 <map_buttons_axes+0x1e1>
jmp    1308 <map_buttons_axes+0x188>
movb   $0x0,-0x31(%rbp)
movb   $0x0,-0x30(%rbp)
movsbl -0x30(%rbp),%eax
movsbl -0x11(%rbp),%ecx
cmp    %ecx,%eax
jge    13cb <map_buttons_axes+0x24b>
mov    -0x28(%rbp),%rax
movsbq -0x30(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
mov    -0x10(%rbp),%rcx
movsbl 0x4(%rcx),%ecx
cmp    %ecx,%eax
jne    13b9 <map_buttons_axes+0x239>
mov    0x2c2b(%rip),%rax
movslq (%rax),%rdi
lea    0xc59(%rip),%rsi
lea    0xd18(%rip),%rdx
mov    $0x0,%al
call   1070 <fprintf@plt>
movb   $0x1,-0x31(%rbp)
jmp    13be <map_buttons_axes+0x23e>
mov    -0x30(%rbp),%al
add    $0x1,%al
mov    %al,-0x30(%rbp)
jmp    1369 <map_buttons_axes+0x1e9>
cmpb   $0x0,-0x31(%rbp)
je     13da <map_buttons_axes+0x25a>
jmp    1308 <map_buttons_axes+0x188>
mov    -0x10(%rbp),%rax
cmpl   $0x1,0x8(%rax)
jne    1422 <map_buttons_axes+0x2a2>
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%dl
mov    -0x28(%rbp),%rax
movsbq -0x2f(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    0x2bae(%rip),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rax
movsbl 0x4(%rax),%ecx
lea    0xcd3(%rip),%rsi
lea    0xcd3(%rip),%rdx
mov    $0x0,%al
call   1070 <fprintf@plt>
jmp    1427 <map_buttons_axes+0x2a7>
mov    -0x10(%rbp),%rax
movsbl 0x4(%rax),%ecx
mov    -0x28(%rbp),%rax
movsbq -0x2f(%rbp),%rdx
movsbl (%rax,%rdx,1),%edx
mov    $0x1,%al
cmp    %edx,%ecx
mov    %al,-0x15a(%rbp)
jne    145d <map_buttons_axes+0x2dd>
mov    -0x10(%rbp),%rax
cmpl   $0x0,0x8(%rax)
setne  %al
mov    %al,-0x15a(%rbp)
mov    -0x15a(%rbp),%al
test   $0x1,%al
jne    1470 <map_buttons_axes+0x2f0>
jmp    1486 <map_buttons_axes+0x306>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    $0xc,%edx
call   1050 <read@plt>
jmp    1427 <map_buttons_axes+0x2a7>
mov    -0x2f(%rbp),%al
add    $0x1,%al
mov    %al,-0x2f(%rbp)
jmp    1308 <map_buttons_axes+0x188>
mov    0x2b16(%rip),%rax
mov    (%rax),%rdi
movsbl -0x12(%rbp),%edx
lea    0xc5b(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movb   $0x0,-0x2f(%rbp)
movsbl -0x2f(%rbp),%eax
movsbl -0x12(%rbp),%ecx
cmp    %ecx,%eax
jge    167d <map_buttons_axes+0x4fd>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    $0xc,%edx
call   1050 <read@plt>
cmp    $0x0,%eax
jge    14f2 <map_buttons_axes+0x372>
mov    0x2adc(%rip),%rax
mov    (%rax),%edi
lea    0xbbe(%rip),%rsi
call   1080 <ewc@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    0x2ae1(%rip),%rcx
cmp    (%rcx),%eax
je     150c <map_buttons_axes+0x38c>
jmp    14b3 <map_buttons_axes+0x333>
movb   $0x0,-0x33(%rbp)
movb   $0x0,-0x32(%rbp)
movsbl -0x32(%rbp),%eax
movsbl -0x12(%rbp),%ecx
cmp    %ecx,%eax
jge    1576 <map_buttons_axes+0x3f6>
mov    0x10(%rbp),%rax
movsbq -0x32(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
mov    -0x10(%rbp),%rcx
movsbl 0x4(%rcx),%ecx
cmp    %ecx,%eax
jne    1564 <map_buttons_axes+0x3e4>
mov    0x2a80(%rip),%rax
movslq (%rax),%rdi
lea    0xaae(%rip),%rsi
lea    0xc37(%rip),%rdx
mov    $0x0,%al
call   1070 <fprintf@plt>
movb   $0x1,-0x33(%rbp)
jmp    1569 <map_buttons_axes+0x3e9>
mov    -0x32(%rbp),%al
add    $0x1,%al
mov    %al,-0x32(%rbp)
jmp    1514 <map_buttons_axes+0x394>
cmpb   $0x0,-0x33(%rbp)
je     1585 <map_buttons_axes+0x405>
jmp    14b3 <map_buttons_axes+0x333>
mov    -0x10(%rbp),%rax
cmpl   $0x0,0x8(%rax)
je     160c <map_buttons_axes+0x48c>
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%dl
mov    0x10(%rbp),%rax
movsbq -0x2f(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    0x2a03(%rip),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rax
movsbl 0x4(%rax),%ecx
lea    0xb28(%rip),%rsi
lea    0xbe7(%rip),%rdx
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x10(%rbp),%rax
cmpl   $0x0,0x8(%rax)
jge    1607 <map_buttons_axes+0x487>
mov    0x18(%rbp),%rax
movsbq -0x2f(%rbp),%rcx
movb   $0xff,(%rax,%rcx,1)
mov    0x29c1(%rip),%rax
mov    (%rax),%rdi
lea    0xa07(%rip),%rsi
lea    0xbbe(%rip),%rdx
mov    $0x0,%al
call   1070 <fprintf@plt>
jmp    160c <map_buttons_axes+0x48c>
jmp    1611 <map_buttons_axes+0x491>
mov    -0x10(%rbp),%rax
movsbl 0x4(%rax),%ecx
mov    0x10(%rbp),%rax
movsbq -0x2f(%rbp),%rdx
movsbl (%rax,%rdx,1),%edx
mov    $0x1,%al
cmp    %edx,%ecx
mov    %al,-0x15b(%rbp)
jne    1647 <map_buttons_axes+0x4c7>
mov    -0x10(%rbp),%rax
cmpl   $0x0,0x8(%rax)
setne  %al
mov    %al,-0x15b(%rbp)
mov    -0x15b(%rbp),%al
test   $0x1,%al
jne    165a <map_buttons_axes+0x4da>
jmp    1670 <map_buttons_axes+0x4f0>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    $0xc,%edx
call   1050 <read@plt>
jmp    1611 <map_buttons_axes+0x491>
mov    -0x2f(%rbp),%al
add    $0x1,%al
mov    %al,-0x2f(%rbp)
jmp    14b3 <map_buttons_axes+0x333>
mov    0x292c(%rip),%rax
mov    (%rax),%rdi
lea    0xb43(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    0x294c(%rip),%rax
mov    (%rax),%edi
call   10a0 <getc@plt>
mov    %eax,-0x38(%rbp)
cmpl   $0x59,-0x38(%rbp)
je     16ba <map_buttons_axes+0x53a>
cmpl   $0x79,-0x38(%rbp)
jne    1a62 <map_buttons_axes+0x8e2>
jmp    16bf <map_buttons_axes+0x53f>
mov    0x2922(%rip),%rax
mov    (%rax),%edi
call   10a0 <getc@plt>
mov    %eax,%ecx
mov    %ecx,-0x38(%rbp)
xor    %eax,%eax
cmp    $0xa,%ecx
mov    %al,-0x15c(%rbp)
je     16f8 <map_buttons_axes+0x578>
mov    -0x38(%rbp),%eax
mov    0x28eb(%rip),%rcx
cmp    (%rcx),%eax
setne  %al
mov    %al,-0x15c(%rbp)
mov    -0x15c(%rbp),%al
test   $0x1,%al
jne    170b <map_buttons_axes+0x58b>
jmp    1710 <map_buttons_axes+0x590>
jmp    16bf <map_buttons_axes+0x53f>
mov    0x2899(%rip),%rax
mov    (%rax),%rdi
lea    0xb19(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
lea    -0x140(%rbp),%rdi
mov    0x28b2(%rip),%rax
mov    (%rax),%edx
mov    $0x100,%esi
call   1060 <fgets@plt>
cmp    $0x0,%rax
jne    1761 <map_buttons_axes+0x5e1>
mov    0x286d(%rip),%rax
mov    (%rax),%edi
lea    0xb10(%rip),%rsi
call   1080 <ewc@plt>
lea    -0x140(%rbp),%rdi
call   1040 <strlen@plt>
sub    $0x1,%eax
cltq
movb   $0x0,-0x140(%rbp,%rax,1)
lea    -0x140(%rbp),%rdi
lea    0xb07(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x148(%rbp)
cmpq   $0x0,-0x148(%rbp)
je     1955 <map_buttons_axes+0x7d5>
mov    -0x148(%rbp),%rdi
call   1030 <fclose@plt>
mov    0x27fb(%rip),%rax
mov    (%rax),%rdi
lea    -0x140(%rbp),%rdx
lea    0xacb(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    0x2814(%rip),%rax
mov    (%rax),%edi
call   10a0 <getc@plt>
mov    %eax,-0x38(%rbp)
cmpl   $0x59,-0x38(%rbp)
je     17f2 <map_buttons_axes+0x672>
cmpl   $0x79,-0x38(%rbp)
jne    1950 <map_buttons_axes+0x7d0>
jmp    17f7 <map_buttons_axes+0x677>
mov    0x27ea(%rip),%rax
mov    (%rax),%edi
call   10a0 <getc@plt>
mov    %eax,%ecx
mov    %ecx,-0x38(%rbp)
xor    %eax,%eax
cmp    $0xa,%ecx
mov    %al,-0x15d(%rbp)
je     1830 <map_buttons_axes+0x6b0>
mov    -0x38(%rbp),%eax
mov    0x27b3(%rip),%rcx
cmp    (%rcx),%eax
setne  %al
mov    %al,-0x15d(%rbp)
mov    -0x15d(%rbp),%al
test   $0x1,%al
jne    1843 <map_buttons_axes+0x6c3>
jmp    1848 <map_buttons_axes+0x6c8>
jmp    17f7 <map_buttons_axes+0x677>
lea    -0x140(%rbp),%rdi
lea    0xa6b(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x150(%rbp)
mov    -0x150(%rbp),%rdi
mov    -0x20(%rbp),%rdx
lea    0x78c(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movb   $0x0,-0x2f(%rbp)
movsbl -0x2f(%rbp),%eax
movsbl -0x11(%rbp),%ecx
cmp    %ecx,%eax
jge    18be <map_buttons_axes+0x73e>
mov    -0x150(%rbp),%rdi
mov    -0x28(%rbp),%rax
movsbq -0x2f(%rbp),%rcx
movsbl (%rax,%rcx,1),%edx
lea    0x840(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x2f(%rbp),%al
add    $0x1,%al
mov    %al,-0x2f(%rbp)
jmp    187f <map_buttons_axes+0x6ff>
movb   $0x0,-0x2f(%rbp)
movsbl -0x2f(%rbp),%eax
movsbl -0x12(%rbp),%ecx
cmp    %ecx,%eax
jge    1901 <map_buttons_axes+0x781>
mov    -0x150(%rbp),%rdi
mov    0x10(%rbp),%rax
movsbq -0x2f(%rbp),%rcx
movsbl (%rax,%rcx,1),%edx
lea    0x7fd(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x2f(%rbp),%al
add    $0x1,%al
mov    %al,-0x2f(%rbp)
jmp    18c2 <map_buttons_axes+0x742>
movb   $0x0,-0x2f(%rbp)
movsbl -0x2f(%rbp),%eax
movsbl -0x12(%rbp),%ecx
cmp    %ecx,%eax
jge    1944 <map_buttons_axes+0x7c4>
mov    -0x150(%rbp),%rdi
mov    0x18(%rbp),%rax
movsbq -0x2f(%rbp),%rcx
movsbl (%rax,%rcx,1),%edx
lea    0x7ba(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x2f(%rbp),%al
add    $0x1,%al
mov    %al,-0x2f(%rbp)
jmp    1905 <map_buttons_axes+0x785>
mov    -0x150(%rbp),%rdi
call   1030 <fclose@plt>
jmp    1a5d <map_buttons_axes+0x8dd>
lea    -0x140(%rbp),%rdi
lea    0x95e(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x158(%rbp)
mov    -0x158(%rbp),%rdi
mov    -0x20(%rbp),%rdx
lea    0x67f(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movb   $0x0,-0x2f(%rbp)
movsbl -0x2f(%rbp),%eax
movsbl -0x11(%rbp),%ecx
cmp    %ecx,%eax
jge    19cb <map_buttons_axes+0x84b>
mov    -0x158(%rbp),%rdi
mov    -0x28(%rbp),%rax
movsbq -0x2f(%rbp),%rcx
movsbl (%rax,%rcx,1),%edx
lea    0x733(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x2f(%rbp),%al
add    $0x1,%al
mov    %al,-0x2f(%rbp)
jmp    198c <map_buttons_axes+0x80c>
movb   $0x0,-0x2f(%rbp)
movsbl -0x2f(%rbp),%eax
movsbl -0x12(%rbp),%ecx
cmp    %ecx,%eax
jge    1a0e <map_buttons_axes+0x88e>
mov    -0x158(%rbp),%rdi
mov    0x10(%rbp),%rax
movsbq -0x2f(%rbp),%rcx
movsbl (%rax,%rcx,1),%edx
lea    0x6f0(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x2f(%rbp),%al
add    $0x1,%al
mov    %al,-0x2f(%rbp)
jmp    19cf <map_buttons_axes+0x84f>
movb   $0x0,-0x2f(%rbp)
movsbl -0x2f(%rbp),%eax
movsbl -0x12(%rbp),%ecx
cmp    %ecx,%eax
jge    1a51 <map_buttons_axes+0x8d1>
mov    -0x158(%rbp),%rdi
mov    0x18(%rbp),%rax
movsbq -0x2f(%rbp),%rcx
movsbl (%rax,%rcx,1),%edx
lea    0x6ad(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x2f(%rbp),%al
add    $0x1,%al
mov    %al,-0x2f(%rbp)
jmp    1a12 <map_buttons_axes+0x892>
mov    -0x158(%rbp),%rdi
call   1030 <fclose@plt>
jmp    1a62 <map_buttons_axes+0x8e2>
add    $0x160,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<map_buttons_axes>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x138,%rsp
mov    %r9,0x18(%rsp)
mov    %r8,0x28(%rsp)
mov    %ecx,%r15d
mov    %edx,%r12d
mov    %rsi,%rbp
mov    %edi,%r13d
mov    0x178(%rsp),%r14
mov    0x2dda(%rip),%rax
mov    (%rax),%rdi
lea    0xe30(%rip),%rsi
lea    0xe2d(%rip),%rdx
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    0x2dc3(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r13d,%edi
mov    %rbp,%rsi
mov    $0xc,%edx
call   1060 <read@plt>
test   %eax,%eax
js     121d <map_buttons_axes+0x7d>
mov    (%rbx),%eax
test   %eax,0x0(%rbp)
jne    1200 <map_buttons_axes+0x60>
jmp    1232 <map_buttons_axes+0x92>
mov    0x2d9c(%rip),%rax
mov    (%rax),%edi
lea    0xe2a(%rip),%rsi
call   1090 <ewc@plt>
mov    %r13d,%edi
mov    %rbp,%rsi
mov    $0xc,%edx
call   1060 <read@plt>
test   %eax,%eax
jns    125b <map_buttons_axes+0xbb>
mov    0x2d73(%rip),%rax
mov    (%rax),%edi
lea    0xe01(%rip),%rsi
call   1090 <ewc@plt>
test   %r12b,%r12b
jle    1273 <map_buttons_axes+0xd3>
movzbl %r12b,%edx
mov    0x18(%rsp),%rdi
mov    $0xff,%esi
call   1050 <memset@plt>
movsbl %r12b,%edx
test   %r15b,%r15b
mov    0x170(%rsp),%rbx
jle    1313 <map_buttons_axes+0x173>
movzbl %r15b,%eax
cmp    $0x8,%r15b
jb     12ac <map_buttons_axes+0x10c>
lea    (%r14,%rax,1),%rcx
cmp    %rbx,%rcx
jbe    19d5 <map_buttons_axes+0x835>
lea    (%rbx,%rax,1),%rcx
cmp    %r14,%rcx
jbe    19d5 <map_buttons_axes+0x835>
xor    %ecx,%ecx
mov    %rcx,%rsi
not    %rsi
add    %rax,%rsi
mov    %rax,%rdi
and    $0x3,%rdi
je     12d3 <map_buttons_axes+0x133>
movb   $0xff,(%rbx,%rcx,1)
movb   $0x1,(%r14,%rcx,1)
add    $0x1,%rcx
add    $0xffffffffffffffff,%rdi
jne    12c0 <map_buttons_axes+0x120>
cmp    $0x3,%rsi
jb     1313 <map_buttons_axes+0x173>
nopl   0x0(%rax)
movb   $0xff,(%rbx,%rcx,1)
movb   $0x1,(%r14,%rcx,1)
movb   $0xff,0x1(%rbx,%rcx,1)
movb   $0x1,0x1(%r14,%rcx,1)
movb   $0xff,0x2(%rbx,%rcx,1)
movb   $0x1,0x2(%r14,%rcx,1)
movb   $0xff,0x3(%rbx,%rcx,1)
movb   $0x1,0x3(%r14,%rcx,1)
add    $0x4,%rcx
cmp    %rcx,%rax
jne    12e0 <map_buttons_axes+0x140>
mov    0x2c96(%rip),%rax
mov    (%rax),%rdi
lea    0xd5a(%rip),%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    %r15d,0x4(%rsp)
movsbl %r15b,%eax
mov    %eax,0x24(%rsp)
mov    %r12d,0x14(%rsp)
test   %r12b,%r12b
jle    14dc <map_buttons_axes+0x33c>
movzbl 0x14(%rsp),%r15d
neg    %r15
mov    0x2c6a(%rip),%r14
lea    0xd5e(%rip),%rbx
mov    0x2c3c(%rip),%r12
xor    %eax,%eax
jmp    138d <map_buttons_axes+0x1ed>
nopl   0x0(%rax,%rax,1)
mov    0x2c49(%rip),%r14
lea    0xd3d(%rip),%rbx
mov    0x8(%rsp),%rax
cmp    0x14(%rsp),%al
jge    14dc <map_buttons_axes+0x33c>
mov    %rax,0x8(%rsp)
jmp    13a9 <map_buttons_axes+0x209>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    0x0(%rbp),%eax
cmp    (%r12),%eax
je     13d0 <map_buttons_axes+0x230>
mov    %r13d,%edi
mov    %rbp,%rsi
mov    $0xc,%edx
call   1060 <read@plt>
test   %eax,%eax
jns    13a0 <map_buttons_axes+0x200>
mov    (%r14),%edi
mov    %rbx,%rsi
call   1090 <ewc@plt>
jmp    13a0 <map_buttons_axes+0x200>
nopw   0x0(%rax,%rax,1)
mov    $0x1,%bl
xor    %r14d,%r14d
mov    0x4(%rbp),%al
add    $0x1,%r14
mov    0x18(%rsp),%rdx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
cmp    %al,-0x1(%rdx,%r14,1)
je     1410 <map_buttons_axes+0x270>
lea    (%r15,%r14,1),%rcx
add    $0x1,%rcx
add    $0x1,%r14
cmp    $0x1,%rcx
jne    13f0 <map_buttons_axes+0x250>
jmp    1440 <map_buttons_axes+0x2a0>
nopl   0x0(%rax,%rax,1)
mov    0x2bb1(%rip),%rax
movslq (%rax),%rdi
xor    %ebx,%ebx
lea    0xbed(%rip),%rsi
lea    0xcac(%rip),%rdx
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    %r15,%rax
add    %r14,%rax
jne    13d5 <map_buttons_axes+0x235>
jmp    1370 <map_buttons_axes+0x1d0>
xchg   %ax,%ax
test   $0x1,%bl
je     1370 <map_buttons_axes+0x1d0>
cmpl   $0x1,0x8(%rbp)
jne    1490 <map_buttons_axes+0x2f0>
mov    0x4(%rbp),%al
movsbq 0x8(%rsp),%rbx
mov    %al,(%rdx,%rbx,1)
mov    0x2b4e(%rip),%rax
mov    (%rax),%rdi
movsbl 0x4(%rbp),%ecx
lea    0xc87(%rip),%rsi
lea    0xc87(%rip),%rdx
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    0x18(%rsp),%rdx
jmp    1496 <map_buttons_axes+0x2f6>
cs nopw 0x0(%rax,%rax,1)
nop
movsbq 0x8(%rsp),%rbx
mov    0x2b23(%rip),%r14
jmp    14b5 <map_buttons_axes+0x315>
nop
mov    %r13d,%edi
mov    %rbp,%rsi
mov    $0xc,%edx
call   1060 <read@plt>
mov    0x18(%rsp),%rdx
movzbl 0x4(%rbp),%eax
cmp    (%rdx,%rbx,1),%al
jne    14a0 <map_buttons_axes+0x300>
cmpl   $0x0,0x8(%rbp)
jne    14a0 <map_buttons_axes+0x300>
mov    0x8(%rsp),%rax
add    $0x1,%al
lea    0xbe9(%rip),%rbx
cmp    0x14(%rsp),%al
jl     138d <map_buttons_axes+0x1ed>
mov    0x2acd(%rip),%rax
mov    (%rax),%rdi
lea    0xc26(%rip),%rsi
mov    0x24(%rsp),%edx
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    0x4(%rsp),%eax
test   %al,%al
jle    16c7 <map_buttons_axes+0x527>
movzbl %al,%r14d
neg    %r14
mov    0x2aae(%rip),%r12
lea    0xba2(%rip),%rbx
mov    0x2ac0(%rip),%r15
xor    %eax,%eax
jmp    154f <map_buttons_axes+0x3af>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    0x4(%rsp),%ecx
mov    0x2a85(%rip),%r12
mov    0x8(%rsp),%rax
cmp    %cl,%al
lea    0xb72(%rip),%rbx
jge    16c7 <map_buttons_axes+0x527>
mov    %rax,0x8(%rsp)
jmp    1568 <map_buttons_axes+0x3c8>
cs nopw 0x0(%rax,%rax,1)
mov    0x0(%rbp),%eax
cmp    (%r15),%eax
je     1590 <map_buttons_axes+0x3f0>
mov    %r13d,%edi
mov    %rbp,%rsi
mov    $0xc,%edx
call   1060 <read@plt>
test   %eax,%eax
jns    1560 <map_buttons_axes+0x3c0>
mov    (%r12),%edi
mov    %rbx,%rsi
call   1090 <ewc@plt>
jmp    1560 <map_buttons_axes+0x3c0>
nopw   0x0(%rax,%rax,1)
mov    $0x1,%r12b
xor    %ebx,%ebx
mov    0x4(%rbp),%al
add    $0x1,%rbx
mov    0x170(%rsp),%rdx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
cmp    %al,-0x1(%rdx,%rbx,1)
je     15d0 <map_buttons_axes+0x430>
lea    (%r14,%rbx,1),%rcx
add    $0x1,%rcx
add    $0x1,%rbx
cmp    $0x1,%rcx
jne    15b0 <map_buttons_axes+0x410>
jmp    1600 <map_buttons_axes+0x460>
nopw   0x0(%rax,%rax,1)
mov    0x29f1(%rip),%rax
movslq (%rax),%rdi
xor    %r12d,%r12d
lea    0xa2c(%rip),%rsi
lea    0xbb5(%rip),%rdx
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    %r14,%rax
add    %rbx,%rax
jne    1595 <map_buttons_axes+0x3f5>
jmp    1530 <map_buttons_axes+0x390>
nop
test   $0x1,%r12b
je     1530 <map_buttons_axes+0x390>
cmpl   $0x0,0x8(%rbp)
je     166d <map_buttons_axes+0x4cd>
mov    0x4(%rbp),%al
movsbq 0x8(%rsp),%rbx
mov    %al,(%rdx,%rbx,1)
mov    0x298d(%rip),%r12
mov    (%r12),%rdi
movsbl 0x4(%rbp),%ecx
lea    0xac5(%rip),%rsi
lea    0xb84(%rip),%rdx
xor    %eax,%eax
call   1080 <fprintf@plt>
cmpl   $0x0,0x8(%rbp)
jns    1680 <map_buttons_axes+0x4e0>
mov    0x178(%rsp),%rax
movb   $0xff,(%rax,%rbx,1)
mov    (%r12),%rdi
lea    0x9b3(%rip),%rsi
lea    0xb6a(%rip),%rdx
xor    %eax,%eax
call   1080 <fprintf@plt>
jmp    1680 <map_buttons_axes+0x4e0>
movsbq 0x8(%rsp),%rbx
jmp    1688 <map_buttons_axes+0x4e8>
cs nopw 0x0(%rax,%rax,1)
nop
mov    0x170(%rsp),%rdx
mov    0x4(%rbp),%al
cmp    (%rdx,%rbx,1),%al
jne    1696 <map_buttons_axes+0x4f6>
cmpl   $0x0,0x8(%rbp)
je     16b0 <map_buttons_axes+0x510>
mov    %r13d,%edi
mov    %rbp,%rsi
mov    $0xc,%edx
call   1060 <read@plt>
jmp    1680 <map_buttons_axes+0x4e0>
nopl   0x0(%rax,%rax,1)
mov    0x8(%rsp),%rax
add    $0x1,%al
mov    0x2902(%rip),%r12
mov    0x4(%rsp),%ecx
jmp    1540 <map_buttons_axes+0x3a0>
mov    0x28e2(%rip),%r15
mov    (%r15),%rcx
lea    0xb09(%rip),%rdi
mov    $0x68,%esi
mov    $0x1,%edx
call   10b0 <fwrite@plt>
mov    0x28fa(%rip),%rbp
mov    0x0(%rbp),%edi
call   10c0 <getc@plt>
and    $0xffffffdf,%eax
cmp    $0x59,%eax
jne    19c3 <map_buttons_axes+0x823>
mov    0x28cf(%rip),%rbx
nopl   0x0(%rax)
mov    0x0(%rbp),%edi
call   10c0 <getc@plt>
cmp    $0xa,%eax
je     1721 <map_buttons_axes+0x581>
cmp    (%rbx),%eax
jne    1710 <map_buttons_axes+0x570>
mov    (%r15),%rcx
lea    0xb1f(%rip),%rdi
mov    $0x31,%esi
mov    $0x1,%edx
call   10b0 <fwrite@plt>
mov    0x0(%rbp),%edx
lea    0x30(%rsp),%r14
mov    %r14,%rdi
mov    $0x100,%esi
call   1070 <fgets@plt>
test   %rax,%rax
jne    1769 <map_buttons_axes+0x5c9>
mov    0x2865(%rip),%rax
mov    (%rax),%edi
lea    0xb18(%rip),%rsi
call   1090 <ewc@plt>
mov    %r14,%rdi
call   1040 <strlen@plt>
cltq
movb   $0x0,-0x1(%rax,%r14,1)
lea    0xb1f(%rip),%rsi
mov    %r14,%rdi
call   10a0 <fopen@plt>
test   %rax,%rax
je     18d0 <map_buttons_axes+0x730>
mov    %rax,%rdi
call   1030 <fclose@plt>
mov    (%r15),%rdi
lea    0xafe(%rip),%rsi
lea    0x30(%rsp),%rdx
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    0x0(%rbp),%edi
call   10c0 <getc@plt>
and    $0xffffffdf,%eax
cmp    $0x59,%eax
jne    19c3 <map_buttons_axes+0x823>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    0x0(%rbp),%edi
call   10c0 <getc@plt>
cmp    $0xa,%eax
je     17e1 <map_buttons_axes+0x641>
cmp    (%rbx),%eax
jne    17d0 <map_buttons_axes+0x630>
lea    0xae9(%rip),%rsi
lea    0x30(%rsp),%rdi
call   10a0 <fopen@plt>
mov    %rax,%r12
lea    0x814(%rip),%rsi
mov    %rax,%rdi
mov    0x28(%rsp),%rdx
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    0x14(%rsp),%eax
test   %al,%al
mov    0x18(%rsp),%rbx
jle    184a <map_buttons_axes+0x6aa>
movzbl %al,%r15d
lea    0x8d7(%rip),%r14
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nop
movsbl (%rbx,%rbp,1),%edx
mov    %r12,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
add    $0x1,%rbp
cmp    %rbp,%r15
jne    1830 <map_buttons_axes+0x690>
mov    0x4(%rsp),%eax
test   %al,%al
jle    19bb <map_buttons_axes+0x81b>
movzbl %al,%r15d
lea    0x899(%rip),%r14
xor    %ebp,%ebp
mov    0x170(%rsp),%rbx
nopl   0x0(%rax,%rax,1)
movsbl (%rbx,%rbp,1),%edx
mov    %r12,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
add    $0x1,%rbp
cmp    %rbp,%r15
jne    1870 <map_buttons_axes+0x6d0>
cmpb   $0x0,0x4(%rsp)
jle    19bb <map_buttons_axes+0x81b>
lea    0x85e(%rip),%r14
xor    %ebx,%ebx
mov    0x178(%rsp),%rbp
cs nopw 0x0(%rax,%rax,1)
movsbl 0x0(%rbp,%rbx,1),%edx
mov    %r12,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    18b0 <map_buttons_axes+0x710>
jmp    19bb <map_buttons_axes+0x81b>
lea    0x9fa(%rip),%rsi
lea    0x30(%rsp),%rdi
call   10a0 <fopen@plt>
mov    %rax,%r12
lea    0x725(%rip),%rsi
mov    %rax,%rdi
mov    0x28(%rsp),%rdx
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    0x14(%rsp),%eax
test   %al,%al
mov    0x18(%rsp),%rbx
jle    193a <map_buttons_axes+0x79a>
movzbl %al,%r15d
lea    0x7e8(%rip),%r14
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movsbl (%rbx,%rbp,1),%edx
mov    %r12,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
add    $0x1,%rbp
cmp    %rbp,%r15
jne    1920 <map_buttons_axes+0x780>
mov    0x4(%rsp),%eax
test   %al,%al
jle    19bb <map_buttons_axes+0x81b>
movzbl %al,%ebp
lea    0x7ae(%rip),%r14
xor    %ebx,%ebx
mov    0x170(%rsp),%r15
cs nopw 0x0(%rax,%rax,1)
movsbl (%r15,%rbx,1),%edx
mov    %r12,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1960 <map_buttons_axes+0x7c0>
cmpb   $0x0,0x4(%rsp)
mov    0x178(%rsp),%r15
jle    19bb <map_buttons_axes+0x81b>
lea    0x769(%rip),%r14
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsbl (%r15,%rbx,1),%edx
mov    %r12,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    19a0 <map_buttons_axes+0x800>
mov    %r12,%rdi
call   1030 <fclose@plt>
add    $0x138,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
cmp    $0x10,%r15b
jae    19e2 <map_buttons_axes+0x842>
xor    %ecx,%ecx
jmp    1a72 <map_buttons_axes+0x8d2>
mov    %eax,%ecx
and    $0xfffffff0,%ecx
pcmpeqd %xmm1,%xmm1
movdqu %xmm1,(%rbx)
movaps 0x60a(%rip),%xmm0
movups %xmm0,(%r14)
cmp    $0x10,%rcx
je     1a61 <map_buttons_axes+0x8c1>
movdqu %xmm1,0x10(%rbx)
movups %xmm0,0x10(%r14)
cmp    $0x20,%ecx
je     1a61 <map_buttons_axes+0x8c1>
pcmpeqd %xmm1,%xmm1
movdqu %xmm1,0x20(%rbx)
movups %xmm0,0x20(%r14)
cmp    $0x30,%ecx
je     1a61 <map_buttons_axes+0x8c1>
movdqu %xmm1,0x30(%rbx)
movups %xmm0,0x30(%r14)
cmp    $0x40,%ecx
je     1a61 <map_buttons_axes+0x8c1>
pcmpeqd %xmm1,%xmm1
movdqu %xmm1,0x40(%rbx)
movups %xmm0,0x40(%r14)
cmp    $0x50,%ecx
je     1a61 <map_buttons_axes+0x8c1>
movdqu %xmm1,0x50(%rbx)
movups %xmm0,0x50(%r14)
cmp    $0x60,%ecx
je     1a61 <map_buttons_axes+0x8c1>
pcmpeqd %xmm1,%xmm1
movdqu %xmm1,0x60(%rbx)
movups %xmm0,0x60(%r14)
cmp    %rax,%rcx
je     1313 <map_buttons_axes+0x173>
test   $0x8,%al
je     12ae <map_buttons_axes+0x10e>
mov    %rcx,%rsi
mov    %eax,%ecx
and    $0xfffffff8,%ecx
movabs $0x101010101010101,%rdi
01 01 01
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movq   $0xffffffffffffffff,(%rbx,%rsi,1)
ff
mov    %rdi,(%r14,%rsi,1)
add    $0x8,%rsi
cmp    %rsi,%rcx
jne    1a90 <map_buttons_axes+0x8f0>
cmp    %rax,%rcx
je     1313 <map_buttons_axes+0x173>
jmp    12ae <map_buttons_axes+0x10e>

LLVM IR (-O0):
%struct.js_event = type { i32, i8, i32 }
@stdout = global i32* null
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [67 x i8] c"Press the button on the joystick to init the configuration wizard!\00"
@JS_EVENT_INIT = global i32 0
@EXIT_FAILURE = global i32 0
@.str.2 = [39 x i8] c"Error while reading from the joystick.\00"
@.str.3 = [61 x i8] c"Press all of the %d buttons! Do NOT press any button again.\0A\00"
@.str.4 = [27 x i8] c"Error in read() function.\0A\00"
@JS_EVENT_BUTTON = global i32 0
@stderr = global i32 0
@.str.5 = [33 x i8] c"This button was pressed already!\00"
@.str.6 = [7 x i8] c"%s %d\0A\00"
@.str.7 = [21 x i8] c"Pressed button code:\00"
@.str.8 = [141 x i8] c"Move all of the %d axes! Do NOT move any axis again. Try to move the analogs perfectly straight. Move them right and up, not left and down.\0A\00"
@JS_EVENT_AXIS = global i32 0
@.str.9 = [29 x i8] c"This axis was moved already!\00"
@.str.10 = [17 x i8] c"Moved axis code:\00"
@.str.11 = [19 x i8] c"Known as reversed.\00"
@.str.12 = [105 x i8] c"Configuration is finished! Would you like to save the configuration in a file for future usage? [Yy/Nn] \00"
@stdin = global i32 0
@EOF = global i32 0
@.str.13 = [50 x i8] c"Under the name of (no more than 255 characters): \00"
@.str.14 = [35 x i8] c"Failed to get the filename string.\00"
@.str.15 = [2 x i8] c"r\00"
@.str.16 = [48 x i8] c"Are you sure you want to overwrite %s? [Yy/Nn] \00"
@.str.17 = [2 x i8] c"w\00"
@.str.18 = [4 x i8] c"%d\0A\00"
define void @map_buttons_axes(i32 %0, %struct.js_event* %1, i8 signext %2, i8 signext %3, i8* %4, i8* %5, i8* %6, i8* %7) {
%9 = alloca i32
%10 = alloca %struct.js_event*
%11 = alloca i8
%12 = alloca i8
%13 = alloca i8*
%14 = alloca i8*
%15 = alloca i8*
%16 = alloca i8*
%17 = alloca i32
%18 = alloca i16
%19 = alloca i8
%20 = alloca i8
%21 = alloca i8
%22 = alloca i8
%23 = alloca i8
%24 = alloca i32
%25 = alloca [256 x i8]
%26 = alloca i32*
%27 = alloca i32*
%28 = alloca i32*
store i32 %0, i32* %9
store %struct.js_event* %1, %struct.js_event** %10
store i8 %2, i8* %11
store i8 %3, i8* %12
store i8* %4, i8** %13
store i8* %5, i8** %14
store i8* %6, i8** %15
store i8* %7, i8** %16
%29 = load i32*, i32** @stdout
%30 = call i32 (i32*, i8*, ...) @fprintf(i32* %29, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str.1, i64 0, i64 0))
br label %31
31: ; preds = %45, %8
%32 = load i32, i32* %9
%33 = load %struct.js_event*, %struct.js_event** %10
%34 = call i32 @read(i32 %32, %struct.js_event* %33, i32 12)
store i32 %34, i32* %17
%35 = icmp sge i32 %34, 0
br i1 %35, label %36, label %43
36: ; preds = %31
%37 = load %struct.js_event*, %struct.js_event** %10
%38 = getelementptr inbounds %struct.js_event, %struct.js_event* %37, i32 0, i32 0
%39 = load i32, i32* %38
%40 = load i32, i32* @JS_EVENT_INIT
%41 = and i32 %39, %40
%42 = icmp ne i32 %41, 0
br label %43
43: ; preds = %36, %31
%44 = phi i1 [ false, %31 ], [ %42, %36 ]
br i1 %44, label %45, label %46
45: ; preds = %43
br label %31
46: ; preds = %43
%47 = load i32, i32* %17
%48 = icmp slt i32 %47, 0
br i1 %48, label %49, label %52
49: ; preds = %46
%50 = load i32, i32* @EXIT_FAILURE
%51 = call i32 @ewc(i32 %50, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0))
br label %52
52: ; preds = %49, %46
%53 = load i32, i32* %9
%54 = load %struct.js_event*, %struct.js_event** %10
%55 = call i32 @read(i32 %53, %struct.js_event* %54, i32 12)
%56 = icmp slt i32 %55, 0
br i1 %56, label %57, label %60
57: ; preds = %52
%58 = load i32, i32* @EXIT_FAILURE
%59 = call i32 @ewc(i32 %58, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0))
br label %60
60: ; preds = %57, %52
store i16 0, i16* %18
br label %61
61: ; preds = %72, %60
%62 = load i16, i16* %18
%63 = sext i16 %62 to i32
%64 = load i8, i8* %11
%65 = sext i8 %64 to i32
%66 = icmp slt i32 %63, %65
br i1 %66, label %67, label %75
67: ; preds = %61
%68 = load i8*, i8** %14
%69 = load i16, i16* %18
%70 = sext i16 %69 to i64
%71 = getelementptr inbounds i8, i8* %68, i64 %70
store i8 -1, i8* %71
br label %72
72: ; preds = %67
%73 = load i16, i16* %18
%74 = add i16 %73, 1
store i16 %74, i16* %18
br label %61
75: ; preds = %61
store i16 0, i16* %18
br label %76
76: ; preds = %91, %75
%77 = load i16, i16* %18
%78 = sext i16 %77 to i32
%79 = load i8, i8* %12
%80 = sext i8 %79 to i32
%81 = icmp slt i32 %78, %80
br i1 %81, label %82, label %94
82: ; preds = %76
%83 = load i8*, i8** %15
%84 = load i16, i16* %18
%85 = sext i16 %84 to i64
%86 = getelementptr inbounds i8, i8* %83, i64 %85
store i8 -1, i8* %86
%87 = load i8*, i8** %16
%88 = load i16, i16* %18
%89 = sext i16 %88 to i64
%90 = getelementptr inbounds i8, i8* %87, i64 %89
store i8 1, i8* %90
br label %91
91: ; preds = %82
%92 = load i16, i16* %18
%93 = add i16 %92, 1
store i16 %93, i16* %18
br label %76
94: ; preds = %76
store i8 0, i8* %19
%95 = load i32*, i32** @stdout
%96 = load i8, i8* %11
%97 = sext i8 %96 to i32
%98 = call i32 (i32*, i8*, ...) @fprintf(i32* %95, i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.3, i64 0, i64 0), i32 %97)
br label %99
99: ; preds = %195, %151, %119, %94
%100 = load i8, i8* %19
%101 = sext i8 %100 to i32
%102 = load i8, i8* %11
%103 = sext i8 %102 to i32
%104 = icmp slt i32 %101, %103
br i1 %104, label %105, label %198
105: ; preds = %99
%106 = load i32, i32* %9
%107 = load %struct.js_event*, %struct.js_event** %10
%108 = call i32 @read(i32 %106, %struct.js_event* %107, i32 12)
%109 = icmp slt i32 %108, 0
br i1 %109, label %110, label %113
110: ; preds = %105
%111 = load i32, i32* @EXIT_FAILURE
%112 = call i32 @ewc(i32 %111, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0))
br label %113
113: ; preds = %110, %105
%114 = load %struct.js_event*, %struct.js_event** %10
%115 = getelementptr inbounds %struct.js_event, %struct.js_event* %114, i32 0, i32 0
%116 = load i32, i32* %115
%117 = load i32, i32* @JS_EVENT_BUTTON
%118 = icmp ne i32 %116, %117
br i1 %118, label %119, label %120
119: ; preds = %113
br label %99
120: ; preds = %113
store i8 0, i8* %21
store i8 0, i8* %20
br label %121
121: ; preds = %145, %120
%122 = load i8, i8* %20
%123 = sext i8 %122 to i32
%124 = load i8, i8* %11
%125 = sext i8 %124 to i32
%126 = icmp slt i32 %123, %125
br i1 %126, label %127, label %148
127: ; preds = %121
%128 = load i8*, i8** %14
%129 = load i8, i8* %20
%130 = sext i8 %129 to i64
%131 = getelementptr inbounds i8, i8* %128, i64 %130
%132 = load i8, i8* %131
%133 = sext i8 %132 to i32
%134 = load %struct.js_event*, %struct.js_event** %10
%135 = getelementptr inbounds %struct.js_event, %struct.js_event* %134, i32 0, i32 1
%136 = load i8, i8* %135
%137 = sext i8 %136 to i32
%138 = icmp eq i32 %133, %137
br i1 %138, label %139, label %144
139: ; preds = %127
%140 = load i32, i32* @stderr
%141 = sext i32 %140 to i64
%142 = inttoptr i64 %141 to i32*
%143 = call i32 (i32*, i8*, ...) @fprintf(i32* %142, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.5, i64 0, i64 0))
store i8 1, i8* %21
br label %144
144: ; preds = %139, %127
br label %145
145: ; preds = %144
%146 = load i8, i8* %20
%147 = add i8 %146, 1
store i8 %147, i8* %20
br label %121
148: ; preds = %121
%149 = load i8, i8* %21
%150 = icmp ne i8 %149, 0
br i1 %150, label %151, label %152
151: ; preds = %148
br label %99
152: ; preds = %148
%153 = load %struct.js_event*, %struct.js_event** %10
%154 = getelementptr inbounds %struct.js_event, %struct.js_event* %153, i32 0, i32 2
%155 = load i32, i32* %154
%156 = icmp eq i32 %155, 1
br i1 %156, label %157, label %171
157: ; preds = %152
%158 = load %struct.js_event*, %struct.js_event** %10
%159 = getelementptr inbounds %struct.js_event, %struct.js_event* %158, i32 0, i32 1
%160 = load i8, i8* %159
%161 = load i8*, i8** %14
%162 = load i8, i8* %19
%163 = sext i8 %162 to i64
%164 = getelementptr inbounds i8, i8* %161, i64 %163
store i8 %160, i8* %164
%165 = load i32*, i32** @stdout
%166 = load %struct.js_event*, %struct.js_event** %10
%167 = getelementptr inbounds %struct.js_event, %struct.js_event* %166, i32 0, i32 1
%168 = load i8, i8* %167
%169 = sext i8 %168 to i32
%170 = call i32 (i32*, i8*, ...) @fprintf(i32* %165, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.7, i64 0, i64 0), i32 %169)
br label %171
171: ; preds = %157, %152
br label %172
172: ; preds = %191, %171
%173 = load %struct.js_event*, %struct.js_event** %10
%174 = getelementptr inbounds %struct.js_event, %struct.js_event* %173, i32 0, i32 1
%175 = load i8, i8* %174
%176 = sext i8 %175 to i32
%177 = load i8*, i8** %14
%178 = load i8, i8* %19
%179 = sext i8 %178 to i64
%180 = getelementptr inbounds i8, i8* %177, i64 %179
%181 = load i8, i8* %180
%182 = sext i8 %181 to i32
%183 = icmp ne i32 %176, %182
br i1 %183, label %189, label %184
184: ; preds = %172
%185 = load %struct.js_event*, %struct.js_event** %10
%186 = getelementptr inbounds %struct.js_event, %struct.js_event* %185, i32 0, i32 2
%187 = load i32, i32* %186
%188 = icmp ne i32 %187, 0
br label %189
189: ; preds = %184, %172
%190 = phi i1 [ true, %172 ], [ %188, %184 ]
br i1 %190, label %191, label %195
191: ; preds = %189
%192 = load i32, i32* %9
%193 = load %struct.js_event*, %struct.js_event** %10
%194 = call i32 @read(i32 %192, %struct.js_event* %193, i32 12)
br label %172
195: ; preds = %189
%196 = load i8, i8* %19
%197 = add i8 %196, 1
store i8 %197, i8* %19
br label %99
198: ; preds = %99
%199 = load i32*, i32** @stdout
%200 = load i8, i8* %12
%201 = sext i8 %200 to i32
%202 = call i32 (i32*, i8*, ...) @fprintf(i32* %199, i8* getelementptr inbounds ([141 x i8], [141 x i8]* @.str.8, i64 0, i64 0), i32 %201)
store i8 0, i8* %19
br label %203
203: ; preds = %311, %255, %223, %198
%204 = load i8, i8* %19
%205 = sext i8 %204 to i32
%206 = load i8, i8* %12
%207 = sext i8 %206 to i32
%208 = icmp slt i32 %205, %207
br i1 %208, label %209, label %314
209: ; preds = %203
%210 = load i32, i32* %9
%211 = load %struct.js_event*, %struct.js_event** %10
%212 = call i32 @read(i32 %210, %struct.js_event* %211, i32 12)
%213 = icmp slt i32 %212, 0
br i1 %213, label %214, label %217
214: ; preds = %209
%215 = load i32, i32* @EXIT_FAILURE
%216 = call i32 @ewc(i32 %215, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0))
br label %217
217: ; preds = %214, %209
%218 = load %struct.js_event*, %struct.js_event** %10
%219 = getelementptr inbounds %struct.js_event, %struct.js_event* %218, i32 0, i32 0
%220 = load i32, i32* %219
%221 = load i32, i32* @JS_EVENT_AXIS
%222 = icmp ne i32 %220, %221
br i1 %222, label %223, label %224
223: ; preds = %217
br label %203
224: ; preds = %217
store i8 0, i8* %23
store i8 0, i8* %22
br label %225
225: ; preds = %249, %224
%226 = load i8, i8* %22
%227 = sext i8 %226 to i32
%228 = load i8, i8* %12
%229 = sext i8 %228 to i32
%230 = icmp slt i32 %227, %229
br i1 %230, label %231, label %252
231: ; preds = %225
%232 = load i8*, i8** %15
%233 = load i8, i8* %22
%234 = sext i8 %233 to i64
%235 = getelementptr inbounds i8, i8* %232, i64 %234
%236 = load i8, i8* %235
%237 = sext i8 %236 to i32
%238 = load %struct.js_event*, %struct.js_event** %10
%239 = getelementptr inbounds %struct.js_event, %struct.js_event* %238, i32 0, i32 1
%240 = load i8, i8* %239
%241 = sext i8 %240 to i32
%242 = icmp eq i32 %237, %241
br i1 %242, label %243, label %248
243: ; preds = %231
%244 = load i32, i32* @stderr
%245 = sext i32 %244 to i64
%246 = inttoptr i64 %245 to i32*
%247 = call i32 (i32*, i8*, ...) @fprintf(i32* %246, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.9, i64 0, i64 0))
store i8 1, i8* %23
br label %248
248: ; preds = %243, %231
br label %249
249: ; preds = %248
%250 = load i8, i8* %22
%251 = add i8 %250, 1
store i8 %251, i8* %22
br label %225
252: ; preds = %225
%253 = load i8, i8* %23
%254 = icmp ne i8 %253, 0
br i1 %254, label %255, label %256
255: ; preds = %252
br label %203
256: ; preds = %252
%257 = load %struct.js_event*, %struct.js_event** %10
%258 = getelementptr inbounds %struct.js_event, %struct.js_event* %257, i32 0, i32 2
%259 = load i32, i32* %258
%260 = icmp ne i32 %259, 0
br i1 %260, label %261, label %287
261: ; preds = %256
%262 = load %struct.js_event*, %struct.js_event** %10
%263 = getelementptr inbounds %struct.js_event, %struct.js_event* %262, i32 0, i32 1
%264 = load i8, i8* %263
%265 = load i8*, i8** %15
%266 = load i8, i8* %19
%267 = sext i8 %266 to i64
%268 = getelementptr inbounds i8, i8* %265, i64 %267
store i8 %264, i8* %268
%269 = load i32*, i32** @stdout
%270 = load %struct.js_event*, %struct.js_event** %10
%271 = getelementptr inbounds %struct.js_event, %struct.js_event* %270, i32 0, i32 1
%272 = load i8, i8* %271
%273 = sext i8 %272 to i32
%274 = call i32 (i32*, i8*, ...) @fprintf(i32* %269, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.10, i64 0, i64 0), i32 %273)
%275 = load %struct.js_event*, %struct.js_event** %10
%276 = getelementptr inbounds %struct.js_event, %struct.js_event* %275, i32 0, i32 2
%277 = load i32, i32* %276
%278 = icmp slt i32 %277, 0
br i1 %278, label %279, label %286
279: ; preds = %261
%280 = load i8*, i8** %16
%281 = load i8, i8* %19
%282 = sext i8 %281 to i64
%283 = getelementptr inbounds i8, i8* %280, i64 %282
store i8 -1, i8* %283
%284 = load i32*, i32** @stdout
%285 = call i32 (i32*, i8*, ...) @fprintf(i32* %284, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.11, i64 0, i64 0))
br label %286
286: ; preds = %279, %261
br label %287
287: ; preds = %286, %256
br label %288
288: ; preds = %307, %287
%289 = load %struct.js_event*, %struct.js_event** %10
%290 = getelementptr inbounds %struct.js_event, %struct.js_event* %289, i32 0, i32 1
%291 = load i8, i8* %290
%292 = sext i8 %291 to i32
%293 = load i8*, i8** %15
%294 = load i8, i8* %19
%295 = sext i8 %294 to i64
%296 = getelementptr inbounds i8, i8* %293, i64 %295
%297 = load i8, i8* %296
%298 = sext i8 %297 to i32
%299 = icmp ne i32 %292, %298
br i1 %299, label %305, label %300
300: ; preds = %288
%301 = load %struct.js_event*, %struct.js_event** %10
%302 = getelementptr inbounds %struct.js_event, %struct.js_event* %301, i32 0, i32 2
%303 = load i32, i32* %302
%304 = icmp ne i32 %303, 0
br label %305
305: ; preds = %300, %288
%306 = phi i1 [ true, %288 ], [ %304, %300 ]
br i1 %306, label %307, label %311
307: ; preds = %305
%308 = load i32, i32* %9
%309 = load %struct.js_event*, %struct.js_event** %10
%310 = call i32 @read(i32 %308, %struct.js_event* %309, i32 12)
br label %288
311: ; preds = %305
%312 = load i8, i8* %19
%313 = add i8 %312, 1
store i8 %313, i8* %19
br label %203
314: ; preds = %203
%315 = load i32*, i32** @stdout
%316 = call i32 (i32*, i8*, ...) @fprintf(i32* %315, i8* getelementptr inbounds ([105 x i8], [105 x i8]* @.str.12, i64 0, i64 0))
%317 = load i32, i32* @stdin
%318 = call i32 @getc(i32 %317)
store i32 %318, i32* %24
%319 = load i32, i32* %24
%320 = icmp eq i32 %319, 89
br i1 %320, label %324, label %321
321: ; preds = %314
%322 = load i32, i32* %24
%323 = icmp eq i32 %322, 121
br i1 %323, label %324, label %513
324: ; preds = %321, %314
br label %325
325: ; preds = %335, %324
%326 = load i32, i32* @stdin
%327 = call i32 @getc(i32 %326)
store i32 %327, i32* %24
%328 = icmp ne i32 %327, 10
br i1 %328, label %329, label %333
329: ; preds = %325
%330 = load i32, i32* %24
%331 = load i32, i32* @EOF
%332 = icmp ne i32 %330, %331
br label %333
333: ; preds = %329, %325
%334 = phi i1 [ false, %325 ], [ %332, %329 ]
br i1 %334, label %335, label %336
335: ; preds = %333
br label %325
336: ; preds = %333
%337 = load i32*, i32** @stdout
%338 = call i32 (i32*, i8*, ...) @fprintf(i32* %337, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.13, i64 0, i64 0))
%339 = getelementptr inbounds [256 x i8], [256 x i8]* %25, i64 0, i64 0
%340 = load i32, i32* @stdin
%341 = call i32* @fgets(i8* %339, i32 256, i32 %340)
%342 = icmp eq i32* %341, null
br i1 %342, label %343, label %346
343: ; preds = %336
%344 = load i32, i32* @EXIT_FAILURE
%345 = call i32 @ewc(i32 %344, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.14, i64 0, i64 0))
br label %346
346: ; preds = %343, %336
%347 = getelementptr inbounds [256 x i8], [256 x i8]* %25, i64 0, i64 0
%348 = call i32 @strlen(i8* %347)
%349 = sub nsw i32 %348, 1
%350 = sext i32 %349 to i64
%351 = getelementptr inbounds [256 x i8], [256 x i8]* %25, i64 0, i64 %350
store i8 0, i8* %351
%352 = getelementptr inbounds [256 x i8], [256 x i8]* %25, i64 0, i64 0
%353 = call i32* @fopen(i8* %352, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.15, i64 0, i64 0))
store i32* %353, i32** %26
%354 = load i32*, i32** %26
%355 = icmp ne i32* %354, null
br i1 %355, label %356, label %447
356: ; preds = %346
%357 = load i32*, i32** %26
%358 = call i32 @fclose(i32* %357)
%359 = load i32*, i32** @stdout
%360 = getelementptr inbounds [256 x i8], [256 x i8]* %25, i64 0, i64 0
%361 = call i32 (i32*, i8*, ...) @fprintf(i32* %359, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.16, i64 0, i64 0), i8* %360)
%362 = load i32, i32* @stdin
%363 = call i32 @getc(i32 %362)
store i32 %363, i32* %24
%364 = load i32, i32* %24
%365 = icmp eq i32 %364, 89
br i1 %365, label %369, label %366
366: ; preds = %356
%367 = load i32, i32* %24
%368 = icmp eq i32 %367, 121
br i1 %368, label %369, label %446
369: ; preds = %366, %356
br label %370
370: ; preds = %380, %369
%371 = load i32, i32* @stdin
%372 = call i32 @getc(i32 %371)
store i32 %372, i32* %24
%373 = icmp ne i32 %372, 10
br i1 %373, label %374, label %378
374: ; preds = %370
%375 = load i32, i32* %24
%376 = load i32, i32* @EOF
%377 = icmp ne i32 %375, %376
br label %378
378: ; preds = %374, %370
%379 = phi i1 [ false, %370 ], [ %377, %374 ]
br i1 %379, label %380, label %381
380: ; preds = %378
br label %370
381: ; preds = %378
%382 = getelementptr inbounds [256 x i8], [256 x i8]* %25, i64 0, i64 0
%383 = call i32* @fopen(i8* %382, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.17, i64 0, i64 0))
store i32* %383, i32** %27
%384 = load i32*, i32** %27
%385 = load i8*, i8** %13
%386 = call i32 (i32*, i8*, ...) @fprintf(i32* %384, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %385)
store i8 0, i8* %19
br label %387
387: ; preds = %402, %381
%388 = load i8, i8* %19
%389 = sext i8 %388 to i32
%390 = load i8, i8* %11
%391 = sext i8 %390 to i32
%392 = icmp slt i32 %389, %391
br i1 %392, label %393, label %405
393: ; preds = %387
%394 = load i32*, i32** %27
%395 = load i8*, i8** %14
%396 = load i8, i8* %19
%397 = sext i8 %396 to i64
%398 = getelementptr inbounds i8, i8* %395, i64 %397
%399 = load i8, i8* %398
%400 = sext i8 %399 to i32
%401 = call i32 (i32*, i8*, ...) @fprintf(i32* %394, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.18, i64 0, i64 0), i32 %400)
br label %402
402: ; preds = %393
%403 = load i8, i8* %19
%404 = add i8 %403, 1
store i8 %404, i8* %19
br label %387
405: ; preds = %387
store i8 0, i8* %19
br label %406
406: ; preds = %421, %405
%407 = load i8, i8* %19
%408 = sext i8 %407 to i32
%409 = load i8, i8* %12
%410 = sext i8 %409 to i32
%411 = icmp slt i32 %408, %410
br i1 %411, label %412, label %424
412: ; preds = %406
%413 = load i32*, i32** %27
%414 = load i8*, i8** %15
%415 = load i8, i8* %19
%416 = sext i8 %415 to i64
%417 = getelementptr inbounds i8, i8* %414, i64 %416
%418 = load i8, i8* %417
%419 = sext i8 %418 to i32
%420 = call i32 (i32*, i8*, ...) @fprintf(i32* %413, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.18, i64 0, i64 0), i32 %419)
br label %421
421: ; preds = %412
%422 = load i8, i8* %19
%423 = add i8 %422, 1
store i8 %423, i8* %19
br label %406
424: ; preds = %406
store i8 0, i8* %19
br label %425
425: ; preds = %440, %424
%426 = load i8, i8* %19
%427 = sext i8 %426 to i32
%428 = load i8, i8* %12
%429 = sext i8 %428 to i32
%430 = icmp slt i32 %427, %429
br i1 %430, label %431, label %443
431: ; preds = %425
%432 = load i32*, i32** %27
%433 = load i8*, i8** %16
%434 = load i8, i8* %19
%435 = sext i8 %434 to i64
%436 = getelementptr inbounds i8, i8* %433, i64 %435
%437 = load i8, i8* %436
%438 = sext i8 %437 to i32
%439 = call i32 (i32*, i8*, ...) @fprintf(i32* %432, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.18, i64 0, i64 0), i32 %438)
br label %440
440: ; preds = %431
%441 = load i8, i8* %19
%442 = add i8 %441, 1
store i8 %442, i8* %19
br label %425
443: ; preds = %425
%444 = load i32*, i32** %27
%445 = call i32 @fclose(i32* %444)
br label %446
446: ; preds = %443, %366
br label %512
447: ; preds = %346
%448 = getelementptr inbounds [256 x i8], [256 x i8]* %25, i64 0, i64 0
%449 = call i32* @fopen(i8* %448, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.17, i64 0, i64 0))
store i32* %449, i32** %28
%450 = load i32*, i32** %28
%451 = load i8*, i8** %13
%452 = call i32 (i32*, i8*, ...) @fprintf(i32* %450, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %451)
store i8 0, i8* %19
br label %453
453: ; preds = %468, %447
%454 = load i8, i8* %19
%455 = sext i8 %454 to i32
%456 = load i8, i8* %11
%457 = sext i8 %456 to i32
%458 = icmp slt i32 %455, %457
br i1 %458, label %459, label %471
459: ; preds = %453
%460 = load i32*, i32** %28
%461 = load i8*, i8** %14
%462 = load i8, i8* %19
%463 = sext i8 %462 to i64
%464 = getelementptr inbounds i8, i8* %461, i64 %463
%465 = load i8, i8* %464
%466 = sext i8 %465 to i32
%467 = call i32 (i32*, i8*, ...) @fprintf(i32* %460, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.18, i64 0, i64 0), i32 %466)
br label %468
468: ; preds = %459
%469 = load i8, i8* %19
%470 = add i8 %469, 1
store i8 %470, i8* %19
br label %453
471: ; preds = %453
store i8 0, i8* %19
br label %472
472: ; preds = %487, %471
%473 = load i8, i8* %19
%474 = sext i8 %473 to i32
%475 = load i8, i8* %12
%476 = sext i8 %475 to i32
%477 = icmp slt i32 %474, %476
br i1 %477, label %478, label %490
478: ; preds = %472
%479 = load i32*, i32** %28
%480 = load i8*, i8** %15
%481 = load i8, i8* %19
%482 = sext i8 %481 to i64
%483 = getelementptr inbounds i8, i8* %480, i64 %482
%484 = load i8, i8* %483
%485 = sext i8 %484 to i32
%486 = call i32 (i32*, i8*, ...) @fprintf(i32* %479, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.18, i64 0, i64 0), i32 %485)
br label %487
487: ; preds = %478
%488 = load i8, i8* %19
%489 = add i8 %488, 1
store i8 %489, i8* %19
br label %472
490: ; preds = %472
store i8 0, i8* %19
br label %491
491: ; preds = %506, %490
%492 = load i8, i8* %19
%493 = sext i8 %492 to i32
%494 = load i8, i8* %12
%495 = sext i8 %494 to i32
%496 = icmp slt i32 %493, %495
br i1 %496, label %497, label %509
497: ; preds = %491
%498 = load i32*, i32** %28
%499 = load i8*, i8** %16
%500 = load i8, i8* %19
%501 = sext i8 %500 to i64
%502 = getelementptr inbounds i8, i8* %499, i64 %501
%503 = load i8, i8* %502
%504 = sext i8 %503 to i32
%505 = call i32 (i32*, i8*, ...) @fprintf(i32* %498, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.18, i64 0, i64 0), i32 %504)
br label %506
506: ; preds = %497
%507 = load i8, i8* %19
%508 = add i8 %507, 1
store i8 %508, i8* %19
br label %491
509: ; preds = %491
%510 = load i32*, i32** %28
%511 = call i32 @fclose(i32* %510)
br label %512
512: ; preds = %509, %446
br label %513
513: ; preds = %512, %321
ret void
}

LLVM IR (-O2):
%struct.js_event = type { i32, i8, i32 }
@stdout = global i32* null
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [67 x i8] c"Press the button on the joystick to init the configuration wizard!\00"
@JS_EVENT_INIT = global i32 0
@EXIT_FAILURE = global i32 0
@.str.2 = [39 x i8] c"Error while reading from the joystick.\00"
@.str.3 = [61 x i8] c"Press all of the %d buttons! Do NOT press any button again.\0A\00"
@.str.4 = [27 x i8] c"Error in read() function.\0A\00"
@JS_EVENT_BUTTON = global i32 0
@stderr = global i32 0
@.str.5 = [33 x i8] c"This button was pressed already!\00"
@.str.6 = [7 x i8] c"%s %d\0A\00"
@.str.7 = [21 x i8] c"Pressed button code:\00"
@.str.8 = [141 x i8] c"Move all of the %d axes! Do NOT move any axis again. Try to move the analogs perfectly straight. Move them right and up, not left and down.\0A\00"
@JS_EVENT_AXIS = global i32 0
@.str.9 = [29 x i8] c"This axis was moved already!\00"
@.str.10 = [17 x i8] c"Moved axis code:\00"
@.str.11 = [19 x i8] c"Known as reversed.\00"
@.str.12 = [105 x i8] c"Configuration is finished! Would you like to save the configuration in a file for future usage? [Yy/Nn] \00"
@stdin = global i32 0
@EOF = global i32 0
@.str.13 = [50 x i8] c"Under the name of (no more than 255 characters): \00"
@.str.14 = [35 x i8] c"Failed to get the filename string.\00"
@.str.15 = [2 x i8] c"r\00"
@.str.16 = [48 x i8] c"Are you sure you want to overwrite %s? [Yy/Nn] \00"
@.str.17 = [2 x i8] c"w\00"
@.str.18 = [4 x i8] c"%d\0A\00"
define void @map_buttons_axes(i32 %0, %struct.js_event* nocapture %1, i8 signext %2, i8 signext %3, i8* %4, i8* nocapture %5, i8* nocapture %6, i8* nocapture %7) {
%9 = alloca [256 x i8]
%10 = load i32*, i32** @stdout
%11 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %10, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str.1, i64 0, i64 0))
%12 = getelementptr inbounds %struct.js_event, %struct.js_event* %1, i64 0, i32 0
br label %13
13: ; preds = %16, %8
%14 = tail call i32 @read(i32 %0, %struct.js_event* %1, i32 12)
%15 = icmp sgt i32 %14, -1
br i1 %15, label %16, label %21
16: ; preds = %13
%17 = load i32, i32* %12
%18 = load i32, i32* @JS_EVENT_INIT
%19 = and i32 %18, %17
%20 = icmp eq i32 %19, 0
br i1 %20, label %24, label %13
21: ; preds = %13
%22 = load i32, i32* @EXIT_FAILURE
%23 = tail call i32 @ewc(i32 %22, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0))
br label %24
24: ; preds = %16, %21
%25 = tail call i32 @read(i32 %0, %struct.js_event* %1, i32 12)
%26 = icmp slt i32 %25, 0
br i1 %26, label %27, label %30
27: ; preds = %24
%28 = load i32, i32* @EXIT_FAILURE
%29 = tail call i32 @ewc(i32 %28, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0))
br label %30
30: ; preds = %27, %24
%31 = icmp sgt i8 %2, 0
br i1 %31, label %32, label %34
32: ; preds = %30
%33 = zext i8 %2 to i64
br label %34
34: ; preds = %32, %30
%35 = sext i8 %2 to i32
%36 = icmp sgt i8 %3, 0
br i1 %36, label %37, label %138
37: ; preds = %34
%38 = zext i8 %3 to i64
%39 = icmp ult i8 %3, 8
br i1 %39, label %106, label %40
40: ; preds = %37
%41 = getelementptr i8, i8* %6, i64 %38
%42 = getelementptr i8, i8* %7, i64 %38
%43 = icmp ugt i8* %42, %6
%44 = icmp ugt i8* %41, %7
%45 = and i1 %43, %44
br i1 %45, label %106, label %46
46: ; preds = %40
%47 = icmp ult i8 %3, 16
br i1 %47, label %93, label %48
48: ; preds = %46
%49 = and i64 %38, 240
%50 = bitcast i8* %6 to <16 x i8>*
store <16 x i8> <i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1>, <16 x i8>* %50
%51 = bitcast i8* %7 to <16 x i8>*
store <16 x i8> <i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1>, <16 x i8>* %51
%52 = icmp eq i64 %49, 16
br i1 %52, label %88, label %53
53: ; preds = %48
%54 = getelementptr inbounds i8, i8* %6, i64 16
%55 = bitcast i8* %54 to <16 x i8>*
store <16 x i8> <i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1>, <16 x i8>* %55
%56 = getelementptr inbounds i8, i8* %7, i64 16
%57 = bitcast i8* %56 to <16 x i8>*
store <16 x i8> <i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1>, <16 x i8>* %57
%58 = icmp eq i64 %49, 32
br i1 %58, label %88, label %59
59: ; preds = %53
%60 = getelementptr inbounds i8, i8* %6, i64 32
%61 = bitcast i8* %60 to <16 x i8>*
store <16 x i8> <i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1>, <16 x i8>* %61
%62 = getelementptr inbounds i8, i8* %7, i64 32
%63 = bitcast i8* %62 to <16 x i8>*
store <16 x i8> <i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1>, <16 x i8>* %63
%64 = icmp eq i64 %49, 48
br i1 %64, label %88, label %65
65: ; preds = %59
%66 = getelementptr inbounds i8, i8* %6, i64 48
%67 = bitcast i8* %66 to <16 x i8>*
store <16 x i8> <i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1>, <16 x i8>* %67
%68 = getelementptr inbounds i8, i8* %7, i64 48
%69 = bitcast i8* %68 to <16 x i8>*
store <16 x i8> <i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1>, <16 x i8>* %69
%70 = icmp eq i64 %49, 64
br i1 %70, label %88, label %71
71: ; preds = %65
%72 = getelementptr inbounds i8, i8* %6, i64 64
%73 = bitcast i8* %72 to <16 x i8>*
store <16 x i8> <i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1>, <16 x i8>* %73
%74 = getelementptr inbounds i8, i8* %7, i64 64
%75 = bitcast i8* %74 to <16 x i8>*
store <16 x i8> <i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1>, <16 x i8>* %75
%76 = icmp eq i64 %49, 80
br i1 %76, label %88, label %77
77: ; preds = %71
%78 = getelementptr inbounds i8, i8* %6, i64 80
%79 = bitcast i8* %78 to <16 x i8>*
store <16 x i8> <i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1>, <16 x i8>* %79
%80 = getelementptr inbounds i8, i8* %7, i64 80
%81 = bitcast i8* %80 to <16 x i8>*
store <16 x i8> <i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1>, <16 x i8>* %81
%82 = icmp eq i64 %49, 96
br i1 %82, label %88, label %83
83: ; preds = %77
%84 = getelementptr inbounds i8, i8* %6, i64 96
%85 = bitcast i8* %84 to <16 x i8>*
store <16 x i8> <i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1>, <16 x i8>* %85
%86 = getelementptr inbounds i8, i8* %7, i64 96
%87 = bitcast i8* %86 to <16 x i8>*
store <16 x i8> <i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1>, <16 x i8>* %87
br label %88
88: ; preds = %83, %77, %71, %65, %59, %53, %48
%89 = icmp eq i64 %49, %38
br i1 %89, label %138, label %90
90: ; preds = %88
%91 = and i64 %38, 8
%92 = icmp eq i64 %91, 0
br i1 %92, label %106, label %93
93: ; preds = %46, %90
%94 = phi i64 [ %49, %90 ], [ 0, %46 ]
%95 = and i64 %38, 248
br label %96
96: ; preds = %96, %93
%97 = phi i64 [ %94, %93 ], [ %102, %96 ]
%98 = getelementptr inbounds i8, i8* %6, i64 %97
%99 = bitcast i8* %98 to <8 x i8>*
store <8 x i8> <i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1>, <8 x i8>* %99
%100 = getelementptr inbounds i8, i8* %7, i64 %97
%101 = bitcast i8* %100 to <8 x i8>*
store <8 x i8> <i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1>, <8 x i8>* %101
%102 = add nuw i64 %97, 8
%103 = icmp eq i64 %102, %95
br i1 %103, label %104, label %96
104: ; preds = %96
%105 = icmp eq i64 %95, %38
br i1 %105, label %138, label %106
106: ; preds = %40, %37, %90, %104
%107 = phi i64 [ 0, %37 ], [ 0, %40 ], [ %49, %90 ], [ %95, %104 ]
%108 = xor i64 %107, -1
%109 = add nsw i64 %108, %38
%110 = and i64 %38, 3
%111 = icmp eq i64 %110, 0
br i1 %111, label %120, label %112
112: ; preds = %106, %112
%113 = phi i64 [ %117, %112 ], [ %107, %106 ]
%114 = phi i64 [ %118, %112 ], [ 0, %106 ]
%115 = getelementptr inbounds i8, i8* %6, i64 %113
store i8 -1, i8* %115
%116 = getelementptr inbounds i8, i8* %7, i64 %113
store i8 1, i8* %116
%117 = add nuw nsw i64 %113, 1
%118 = add i64 %114, 1
%119 = icmp eq i64 %118, %110
br i1 %119, label %120, label %112
120: ; preds = %112, %106
%121 = phi i64 [ %107, %106 ], [ %117, %112 ]
%122 = icmp ult i64 %109, 3
br i1 %122, label %138, label %123
123: ; preds = %120, %123
%124 = phi i64 [ %136, %123 ], [ %121, %120 ]
%125 = getelementptr inbounds i8, i8* %6, i64 %124
store i8 -1, i8* %125
%126 = getelementptr inbounds i8, i8* %7, i64 %124
store i8 1, i8* %126
%127 = add nuw nsw i64 %124, 1
%128 = getelementptr inbounds i8, i8* %6, i64 %127
store i8 -1, i8* %128
%129 = getelementptr inbounds i8, i8* %7, i64 %127
store i8 1, i8* %129
%130 = add nuw nsw i64 %124, 2
%131 = getelementptr inbounds i8, i8* %6, i64 %130
store i8 -1, i8* %131
%132 = getelementptr inbounds i8, i8* %7, i64 %130
store i8 1, i8* %132
%133 = add nuw nsw i64 %124, 3
%134 = getelementptr inbounds i8, i8* %6, i64 %133
store i8 -1, i8* %134
%135 = getelementptr inbounds i8, i8* %7, i64 %133
store i8 1, i8* %135
%136 = add nuw nsw i64 %124, 4
%137 = icmp eq i64 %136, %38
br i1 %137, label %138, label %123
138: ; preds = %120, %123, %88, %104, %34
%139 = sext i8 %3 to i32
%140 = load i32*, i32** @stdout
%141 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %140, i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.3, i64 0, i64 0), i32 %35)
br i1 %31, label %142, label %208
142: ; preds = %138
%143 = getelementptr inbounds %struct.js_event, %struct.js_event* %1, i64 0, i32 1
%144 = getelementptr inbounds %struct.js_event, %struct.js_event* %1, i64 0, i32 2
%145 = zext i8 %2 to i64
br label %146
146: ; preds = %142, %205
%147 = phi i8 [ 0, %142 ], [ %206, %205 ]
br label %148
148: ; preds = %146, %154
%149 = tail call i32 @read(i32 %0, %struct.js_event* %1, i32 12)
%150 = icmp slt i32 %149, 0
br i1 %150, label %151, label %154
151: ; preds = %148
%152 = load i32, i32* @EXIT_FAILURE
%153 = tail call i32 @ewc(i32 %152, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0))
br label %154
154: ; preds = %151, %148
%155 = load i32, i32* %12
%156 = load i32, i32* @JS_EVENT_BUTTON
%157 = icmp eq i32 %155, %156
br i1 %157, label %158, label %148
158: ; preds = %154, %170
%159 = phi i64 [ %175, %170 ], [ 0, %154 ]
%160 = phi i1 [ false, %170 ], [ true, %154 ]
%161 = load i8, i8* %143
br label %162
162: ; preds = %158, %167
%163 = phi i64 [ %168, %167 ], [ %159, %158 ]
%164 = getelementptr inbounds i8, i8* %5, i64 %163
%165 = load i8, i8* %164
%166 = icmp eq i8 %165, %161
br i1 %166, label %170, label %167
167: ; preds = %162
%168 = add nuw nsw i64 %163, 1
%169 = icmp eq i64 %168, %145
br i1 %169, label %177, label %162
170: ; preds = %162
%171 = load i32, i32* @stderr
%172 = sext i32 %171 to i64
%173 = inttoptr i64 %172 to i32*
%174 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %173, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.5, i64 0, i64 0))
%175 = add nuw nsw i64 %163, 1
%176 = icmp eq i64 %175, %145
br i1 %176, label %205, label %158
177: ; preds = %167
br i1 %160, label %178, label %205
178: ; preds = %177
%179 = load i32, i32* %144
%180 = icmp eq i32 %179, 1
br i1 %180, label %183, label %181
181: ; preds = %178
%182 = sext i8 %147 to i64
br label %191
183: ; preds = %178
%184 = load i8, i8* %143
%185 = sext i8 %147 to i64
%186 = getelementptr inbounds i8, i8* %5, i64 %185
store i8 %184, i8* %186
%187 = load i32*, i32** @stdout
%188 = load i8, i8* %143
%189 = sext i8 %188 to i32
%190 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %187, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.7, i64 0, i64 0), i32 %189)
br label %191
191: ; preds = %181, %183
%192 = phi i64 [ %182, %181 ], [ %185, %183 ]
%193 = getelementptr inbounds i8, i8* %5, i64 %192
br label %194
194: ; preds = %201, %191
%195 = load i8, i8* %143
%196 = load i8, i8* %193
%197 = icmp eq i8 %195, %196
br i1 %197, label %198, label %201
198: ; preds = %194
%199 = load i32, i32* %144
%200 = icmp eq i32 %199, 0
br i1 %200, label %203, label %201
201: ; preds = %194, %198
%202 = tail call i32 @read(i32 %0, %struct.js_event* %1, i32 12)
br label %194
203: ; preds = %198
%204 = add i8 %147, 1
br label %205
205: ; preds = %170, %177, %203
%206 = phi i8 [ %204, %203 ], [ %147, %177 ], [ %147, %170 ]
%207 = icmp slt i8 %206, %2
br i1 %207, label %146, label %208
208: ; preds = %205, %138
%209 = load i32*, i32** @stdout
%210 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %209, i8* getelementptr inbounds ([141 x i8], [141 x i8]* @.str.8, i64 0, i64 0), i32 %139)
br i1 %36, label %211, label %283
211: ; preds = %208
%212 = getelementptr inbounds %struct.js_event, %struct.js_event* %1, i64 0, i32 1
%213 = getelementptr inbounds %struct.js_event, %struct.js_event* %1, i64 0, i32 2
%214 = zext i8 %3 to i64
br label %215
215: ; preds = %211, %280
%216 = phi i8 [ 0, %211 ], [ %281, %280 ]
br label %217
217: ; preds = %215, %223
%218 = tail call i32 @read(i32 %0, %struct.js_event* %1, i32 12)
%219 = icmp slt i32 %218, 0
br i1 %219, label %220, label %223
220: ; preds = %217
%221 = load i32, i32* @EXIT_FAILURE
%222 = tail call i32 @ewc(i32 %221, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0))
br label %223
223: ; preds = %220, %217
%224 = load i32, i32* %12
%225 = load i32, i32* @JS_EVENT_AXIS
%226 = icmp eq i32 %224, %225
br i1 %226, label %227, label %217
227: ; preds = %223, %239
%228 = phi i64 [ %244, %239 ], [ 0, %223 ]
%229 = phi i1 [ false, %239 ], [ true, %223 ]
%230 = load i8, i8* %212
br label %231
231: ; preds = %227, %236
%232 = phi i64 [ %237, %236 ], [ %228, %227 ]
%233 = getelementptr inbounds i8, i8* %6, i64 %232
%234 = load i8, i8* %233
%235 = icmp eq i8 %234, %230
br i1 %235, label %239, label %236
236: ; preds = %231
%237 = add nuw nsw i64 %232, 1
%238 = icmp eq i64 %237, %214
br i1 %238, label %246, label %231
239: ; preds = %231
%240 = load i32, i32* @stderr
%241 = sext i32 %240 to i64
%242 = inttoptr i64 %241 to i32*
%243 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %242, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.9, i64 0, i64 0))
%244 = add nuw nsw i64 %232, 1
%245 = icmp eq i64 %244, %214
br i1 %245, label %280, label %227
246: ; preds = %236
br i1 %229, label %247, label %280
247: ; preds = %246
%248 = load i32, i32* %213
%249 = icmp eq i32 %248, 0
br i1 %249, label %250, label %252
250: ; preds = %247
%251 = sext i8 %216 to i64
br label %266
252: ; preds = %247
%253 = load i8, i8* %212
%254 = sext i8 %216 to i64
%255 = getelementptr inbounds i8, i8* %6, i64 %254
store i8 %253, i8* %255
%256 = load i32*, i32** @stdout
%257 = load i8, i8* %212
%258 = sext i8 %257 to i32
%259 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %256, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.10, i64 0, i64 0), i32 %258)
%260 = load i32, i32* %213
%261 = icmp slt i32 %260, 0
br i1 %261, label %262, label %266
262: ; preds = %252
%263 = getelementptr inbounds i8, i8* %7, i64 %254
store i8 -1, i8* %263
%264 = load i32*, i32** @stdout
%265 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %264, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.11, i64 0, i64 0))
br label %266
266: ; preds = %250, %252, %262
%267 = phi i64 [ %251, %250 ], [ %254, %252 ], [ %254, %262 ]
%268 = getelementptr inbounds i8, i8* %6, i64 %267
br label %269
269: ; preds = %276, %266
%270 = load i8, i8* %212
%271 = load i8, i8* %268
%272 = icmp eq i8 %270, %271
br i1 %272, label %273, label %276
273: ; preds = %269
%274 = load i32, i32* %213
%275 = icmp eq i32 %274, 0
br i1 %275, label %278, label %276
276: ; preds = %269, %273
%277 = tail call i32 @read(i32 %0, %struct.js_event* %1, i32 12)
br label %269
278: ; preds = %273
%279 = add i8 %216, 1
br label %280
280: ; preds = %239, %246, %278
%281 = phi i8 [ %279, %278 ], [ %216, %246 ], [ %216, %239 ]
%282 = icmp slt i8 %281, %3
br i1 %282, label %215, label %283
283: ; preds = %280, %208
%284 = load i32*, i32** @stdout
%285 = tail call i64 @fwrite(i8* getelementptr inbounds ([105 x i8], [105 x i8]* @.str.12, i64 0, i64 0), i64 104, i64 1, i32* %284)
%286 = load i32, i32* @stdin
%287 = tail call i32 @getc(i32 %286)
%288 = and i32 %287, -33
%289 = icmp eq i32 %288, 89
br i1 %289, label %290, label %403
290: ; preds = %283, %290
%291 = load i32, i32* @stdin
%292 = tail call i32 @getc(i32 %291)
%293 = icmp ne i32 %292, 10
%294 = load i32, i32* @EOF
%295 = icmp ne i32 %292, %294
%296 = select i1 %293, i1 %295, i1 false
br i1 %296, label %290, label %297
297: ; preds = %290
%298 = load i32*, i32** @stdout
%299 = tail call i64 @fwrite(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.13, i64 0, i64 0), i64 49, i64 1, i32* %298)
%300 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 0
%301 = load i32, i32* @stdin
%302 = call i32* @fgets(i8* %300, i32 256, i32 %301)
%303 = icmp eq i32* %302, null
br i1 %303, label %304, label %307
304: ; preds = %297
%305 = load i32, i32* @EXIT_FAILURE
%306 = call i32 @ewc(i32 %305, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.14, i64 0, i64 0))
br label %307
307: ; preds = %304, %297
%308 = call i32 @strlen(i8* %300)
%309 = add nsw i32 %308, -1
%310 = sext i32 %309 to i64
%311 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 %310
store i8 0, i8* %311
%312 = call i32* @fopen(i8* %300, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.15, i64 0, i64 0))
%313 = icmp eq i32* %312, null
br i1 %313, label %364, label %314
314: ; preds = %307
%315 = call i32 @fclose(i32* %312)
%316 = load i32*, i32** @stdout
%317 = call i32 (i32*, i8*, ...) @fprintf(i32* %316, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.16, i64 0, i64 0), i8* %300)
%318 = load i32, i32* @stdin
%319 = call i32 @getc(i32 %318)
%320 = and i32 %319, -33
%321 = icmp eq i32 %320, 89
br i1 %321, label %322, label %402
322: ; preds = %314, %322
%323 = load i32, i32* @stdin
%324 = call i32 @getc(i32 %323)
%325 = icmp ne i32 %324, 10
%326 = load i32, i32* @EOF
%327 = icmp ne i32 %324, %326
%328 = select i1 %325, i1 %327, i1 false
br i1 %328, label %322, label %329
329: ; preds = %322
%330 = call i32* @fopen(i8* %300, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.17, i64 0, i64 0))
%331 = call i32 (i32*, i8*, ...) @fprintf(i32* %330, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %4)
br i1 %31, label %332, label %334
332: ; preds = %329
%333 = zext i8 %2 to i64
br label %337
334: ; preds = %337, %329
br i1 %36, label %335, label %399
335: ; preds = %334
%336 = zext i8 %3 to i64
br label %348
337: ; preds = %332, %337
%338 = phi i64 [ 0, %332 ], [ %343, %337 ]
%339 = getelementptr inbounds i8, i8* %5, i64 %338
%340 = load i8, i8* %339
%341 = sext i8 %340 to i32
%342 = call i32 (i32*, i8*, ...) @fprintf(i32* %330, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.18, i64 0, i64 0), i32 %341)
%343 = add nuw nsw i64 %338, 1
%344 = icmp eq i64 %343, %333
br i1 %344, label %334, label %337
345: ; preds = %348
br i1 %36, label %346, label %399
346: ; preds = %345
%347 = zext i8 %3 to i64
br label %356
348: ; preds = %335, %348
%349 = phi i64 [ 0, %335 ], [ %354, %348 ]
%350 = getelementptr inbounds i8, i8* %6, i64 %349
%351 = load i8, i8* %350
%352 = sext i8 %351 to i32
%353 = call i32 (i32*, i8*, ...) @fprintf(i32* %330, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.18, i64 0, i64 0), i32 %352)
%354 = add nuw nsw i64 %349, 1
%355 = icmp eq i64 %354, %336
br i1 %355, label %345, label %348
356: ; preds = %346, %356
%357 = phi i64 [ 0, %346 ], [ %362, %356 ]
%358 = getelementptr inbounds i8, i8* %7, i64 %357
%359 = load i8, i8* %358
%360 = sext i8 %359 to i32
%361 = call i32 (i32*, i8*, ...) @fprintf(i32* %330, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.18, i64 0, i64 0), i32 %360)
%362 = add nuw nsw i64 %357, 1
%363 = icmp eq i64 %362, %347
br i1 %363, label %399, label %356
364: ; preds = %307
%365 = call i32* @fopen(i8* %300, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.17, i64 0, i64 0))
%366 = call i32 (i32*, i8*, ...) @fprintf(i32* %365, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %4)
br i1 %31, label %367, label %369
367: ; preds = %364
%368 = zext i8 %2 to i64
br label %372
369: ; preds = %372, %364
br i1 %36, label %370, label %399
370: ; preds = %369
%371 = zext i8 %3 to i64
br label %383
372: ; preds = %367, %372
%373 = phi i64 [ 0, %367 ], [ %378, %372 ]
%374 = getelementptr inbounds i8, i8* %5, i64 %373
%375 = load i8, i8* %374
%376 = sext i8 %375 to i32
%377 = call i32 (i32*, i8*, ...) @fprintf(i32* %365, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.18, i64 0, i64 0), i32 %376)
%378 = add nuw nsw i64 %373, 1
%379 = icmp eq i64 %378, %368
br i1 %379, label %369, label %372
380: ; preds = %383
br i1 %36, label %381, label %399
381: ; preds = %380
%382 = zext i8 %3 to i64
br label %391
383: ; preds = %370, %383
%384 = phi i64 [ 0, %370 ], [ %389, %383 ]
%385 = getelementptr inbounds i8, i8* %6, i64 %384
%386 = load i8, i8* %385
%387 = sext i8 %386 to i32
%388 = call i32 (i32*, i8*, ...) @fprintf(i32* %365, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.18, i64 0, i64 0), i32 %387)
%389 = add nuw nsw i64 %384, 1
%390 = icmp eq i64 %389, %371
br i1 %390, label %380, label %383
391: ; preds = %381, %391
%392 = phi i64 [ 0, %381 ], [ %397, %391 ]
%393 = getelementptr inbounds i8, i8* %7, i64 %392
%394 = load i8, i8* %393
%395 = sext i8 %394 to i32
%396 = call i32 (i32*, i8*, ...) @fprintf(i32* %365, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.18, i64 0, i64 0), i32 %395)
%397 = add nuw nsw i64 %392, 1
%398 = icmp eq i64 %397, %382
br i1 %398, label %399, label %391
399: ; preds = %356, %391, %380, %369, %345, %334
%400 = phi i32* [ %330, %334 ], [ %330, %345 ], [ %365, %369 ], [ %365, %380 ], [ %365, %391 ], [ %330, %356 ]
%401 = call i32 @fclose(i32* %400)
br label %402
402: ; preds = %399, %314
br label %403
403: ; preds = %283, %402
ret void
}