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

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ cvproc_set_bend_range(int /*<<< orphan*/);
int /*<<< orphan*/ cvproc_set_cvcal(int, int /*<<< orphan*/);
int /*<<< orphan*/ cvproc_set_cvoffset(int, int /*<<< orphan*/);
int /*<<< orphan*/ cvproc_set_output_scaling(int, int /*<<< orphan*/);
int /*<<< orphan*/ cvproc_set_pair_mode(int, int /*<<< orphan*/);
int /*<<< orphan*/ cvproc_set_pairs(int /*<<< orphan*/);
int /*<<< orphan*/ metronome_mode_changed(int /*<<< orphan*/);
int /*<<< orphan*/ metronome_sound_len_changed(int /*<<< orphan*/);
int /*<<< orphan*/ midi_clock_is_ext_synced();
int /*<<< orphan*/ midi_clock_set_swing(int /*<<< orphan*/);
int /*<<< orphan*/ midi_clock_set_tempo(int /*<<< orphan*/);
int /*<<< orphan*/ seq_utils_remap_step_len_102(int /*<<< orphan*/);
int /*<<< orphan*/ song_get_arp_speed(int, int);
int /*<<< orphan*/ song_get_cv_bend_range();
int /*<<< orphan*/ song_get_cv_output_scaling(int);
int /*<<< orphan*/ song_get_cvcal(int);
int /*<<< orphan*/ song_get_cvgate_pair_mode(int);
int /*<<< orphan*/ song_get_cvgate_pairs();
int /*<<< orphan*/ song_get_cvoffset(int);
int /*<<< orphan*/ song_get_metronome_mode();
int /*<<< orphan*/ song_get_metronome_sound_len();
int song_get_song_version();
int /*<<< orphan*/ song_get_step_length(int, int);
int /*<<< orphan*/ song_get_swing();
int /*<<< orphan*/ song_get_tempo();
int /*<<< orphan*/ song_set_arp_speed(int, int, int /*<<< orphan*/);
int /*<<< orphan*/ song_set_cvoffset(int, int /*<<< orphan*/);
int /*<<< orphan*/ song_set_magic_chance(int);
int /*<<< orphan*/ song_set_magic_range(int);
int /*<<< orphan*/ song_set_metronome_sound_len(int);
int /*<<< orphan*/ song_set_midi_autolive(int /*<<< orphan*/);
int /*<<< orphan*/ song_set_midi_clock_source(int);
int /*<<< orphan*/ song_set_scene_sync(int /*<<< orphan*/);
int /*<<< orphan*/ song_set_step_length(int, int, int /*<<< orphan*/);
int /*<<< orphan*/ song_set_version_to_current();
void seq_ctrl_refresh_modules(void) {
  int i, scene, track;
  int song_ver = song_get_song_version();
  if (song_ver <= 0x00010002) {
    song_set_metronome_sound_len(100);
    for (scene = 0; scene < 6; scene++) {
      for (track = 0; track < 6; track++) {
        song_set_step_length(
            scene, track,
            seq_utils_remap_step_len_102(song_get_step_length(scene, track)));
        song_set_arp_speed(
            scene, track,
            seq_utils_remap_step_len_102(song_get_arp_speed(scene, track)));
      }
    }
  }
  if (song_ver <= 0x00010007) {
    song_set_midi_clock_source(-1);
  }
  if (song_ver <= 0x0001000b) {
    song_set_cvoffset(0, 0);
    song_set_cvoffset(1, 0);
    song_set_cvoffset(2, 0);
    song_set_cvoffset(3, 0);
    song_set_midi_autolive(0);
  }
  if (song_ver <= 0x0001000d) {
    song_set_scene_sync(0);
    song_set_magic_range(12);
    song_set_magic_chance(100);
  }
  if (song_ver != ((1 << 16) | 14)) {
    song_set_version_to_current();
  }
  if (!midi_clock_is_ext_synced()) {
    midi_clock_set_tempo(song_get_tempo());
  }
  midi_clock_set_swing(song_get_swing());
  metronome_mode_changed(song_get_metronome_mode());
  metronome_sound_len_changed(song_get_metronome_sound_len());
  cvproc_set_bend_range(song_get_cv_bend_range());
  cvproc_set_pairs(song_get_cvgate_pairs());
  for (i = 0; i < 4; i++) {
    cvproc_set_pair_mode(i, song_get_cvgate_pair_mode(i));
    cvproc_set_output_scaling(i, song_get_cv_output_scaling(i));
  }
  for (i = 0; i < 4; i++) {
    cvproc_set_cvcal(i, song_get_cvcal(i));
    cvproc_set_cvoffset(i, song_get_cvoffset(i));
  }
}


x86 assembly (clang, -O0):
<seq_ctrl_refresh_modules>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    $0x0,%al
call   1230 <song_get_song_version@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0x10002,-0x10(%rbp)
jg     13f7 <seq_ctrl_refresh_modules+0xc7>
mov    $0x64,%edi
call   1160 <song_set_metronome_sound_len@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x6,-0x8(%rbp)
jge    13f2 <seq_ctrl_refresh_modules+0xc2>
movl   $0x0,-0xc(%rbp)
cmpl   $0x6,-0xc(%rbp)
jge    13df <seq_ctrl_refresh_modules+0xaf>
mov    -0x8(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1130 <song_get_step_length@plt>
mov    %eax,%edi
call   1120 <seq_utils_remap_step_len_102@plt>
mov    -0x20(%rbp),%edi
mov    -0x1c(%rbp),%esi
mov    %eax,%edx
call   10d0 <song_set_step_length@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1210 <song_get_arp_speed@plt>
mov    %eax,%edi
call   1120 <seq_utils_remap_step_len_102@plt>
mov    -0x18(%rbp),%edi
mov    -0x14(%rbp),%esi
mov    %eax,%edx
call   1110 <song_set_arp_speed@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1371 <seq_ctrl_refresh_modules+0x41>
jmp    13e4 <seq_ctrl_refresh_modules+0xb4>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1360 <seq_ctrl_refresh_modules+0x30>
jmp    13f7 <seq_ctrl_refresh_modules+0xc7>
cmpl   $0x10007,-0x10(%rbp)
jg     140e <seq_ctrl_refresh_modules+0xde>
mov    $0xffffffff,%edi
call   1250 <song_set_midi_clock_source@plt>
cmpl   $0x1000b,-0x10(%rbp)
jg     144f <seq_ctrl_refresh_modules+0x11f>
xor    %esi,%esi
mov    %esi,%edi
call   10f0 <song_set_cvoffset@plt>
mov    $0x1,%edi
xor    %esi,%esi
call   10f0 <song_set_cvoffset@plt>
mov    $0x2,%edi
xor    %esi,%esi
call   10f0 <song_set_cvoffset@plt>
mov    $0x3,%edi
xor    %esi,%esi
call   10f0 <song_set_cvoffset@plt>
xor    %edi,%edi
call   11d0 <song_set_midi_autolive@plt>
cmpl   $0x1000d,-0x10(%rbp)
jg     1477 <seq_ctrl_refresh_modules+0x147>
xor    %edi,%edi
call   1200 <song_set_scene_sync@plt>
mov    $0xc,%edi
call   1080 <song_set_magic_range@plt>
mov    $0x64,%edi
call   10b0 <song_set_magic_chance@plt>
cmpl   $0x1000e,-0x10(%rbp)
je     148b <seq_ctrl_refresh_modules+0x15b>
mov    $0x0,%al
call   1180 <song_set_version_to_current@plt>
mov    $0x0,%al
call   1140 <midi_clock_is_ext_synced@plt>
cmp    $0x0,%eax
jne    14a9 <seq_ctrl_refresh_modules+0x179>
mov    $0x0,%al
call   1060 <song_get_tempo@plt>
mov    %eax,%edi
call   1030 <midi_clock_set_tempo@plt>
mov    $0x0,%al
call   1090 <song_get_swing@plt>
mov    %eax,%edi
call   11e0 <midi_clock_set_swing@plt>
mov    $0x0,%al
call   1100 <song_get_metronome_mode@plt>
mov    %eax,%edi
call   1220 <metronome_mode_changed@plt>
mov    $0x0,%al
call   1190 <song_get_metronome_sound_len@plt>
mov    %eax,%edi
call   10a0 <metronome_sound_len_changed@plt>
mov    $0x0,%al
call   1240 <song_get_cv_bend_range@plt>
mov    %eax,%edi
call   1150 <cvproc_set_bend_range@plt>
mov    $0x0,%al
call   10c0 <song_get_cvgate_pairs@plt>
mov    %eax,%edi
call   11f0 <cvproc_set_pairs@plt>
movl   $0x0,-0x4(%rbp)
cmpl   $0x4,-0x4(%rbp)
jge    153e <seq_ctrl_refresh_modules+0x20e>
mov    -0x4(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x4(%rbp),%edi
call   1070 <song_get_cvgate_pair_mode@plt>
mov    -0x28(%rbp),%edi
mov    %eax,%esi
call   11b0 <cvproc_set_pair_mode@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x4(%rbp),%edi
call   11c0 <song_get_cv_output_scaling@plt>
mov    -0x24(%rbp),%edi
mov    %eax,%esi
call   11a0 <cvproc_set_output_scaling@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    14f6 <seq_ctrl_refresh_modules+0x1c6>
movl   $0x0,-0x4(%rbp)
cmpl   $0x4,-0x4(%rbp)
jge    158d <seq_ctrl_refresh_modules+0x25d>
mov    -0x4(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    -0x4(%rbp),%edi
call   1170 <song_get_cvcal@plt>
mov    -0x30(%rbp),%edi
mov    %eax,%esi
call   10e0 <cvproc_set_cvcal@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x4(%rbp),%edi
call   1050 <song_get_cvoffset@plt>
mov    -0x2c(%rbp),%edi
mov    %eax,%esi
call   1040 <cvproc_set_cvoffset@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1545 <seq_ctrl_refresh_modules+0x215>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<seq_ctrl_refresh_modules>:
push   %rbp
push   %rbx
push   %rax
xor    %ebp,%ebp
xor    %eax,%eax
call   1230 <song_get_song_version@plt>
mov    %eax,%ebx
cmp    $0x10002,%eax
jg     14ec <seq_ctrl_refresh_modules+0x1bc>
mov    $0x64,%edi
call   1160 <song_set_metronome_sound_len@plt>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %ebp,%edi
xor    %esi,%esi
call   1130 <song_get_step_length@plt>
mov    %eax,%edi
call   1120 <seq_utils_remap_step_len_102@plt>
mov    %ebp,%edi
xor    %esi,%esi
mov    %eax,%edx
call   10d0 <song_set_step_length@plt>
mov    %ebp,%edi
xor    %esi,%esi
call   1210 <song_get_arp_speed@plt>
mov    %eax,%edi
call   1120 <seq_utils_remap_step_len_102@plt>
mov    %ebp,%edi
xor    %esi,%esi
mov    %eax,%edx
call   1110 <song_set_arp_speed@plt>
mov    %ebp,%edi
mov    $0x1,%esi
call   1130 <song_get_step_length@plt>
mov    %eax,%edi
call   1120 <seq_utils_remap_step_len_102@plt>
mov    %ebp,%edi
mov    $0x1,%esi
mov    %eax,%edx
call   10d0 <song_set_step_length@plt>
mov    %ebp,%edi
mov    $0x1,%esi
call   1210 <song_get_arp_speed@plt>
mov    %eax,%edi
call   1120 <seq_utils_remap_step_len_102@plt>
mov    %ebp,%edi
mov    $0x1,%esi
mov    %eax,%edx
call   1110 <song_set_arp_speed@plt>
mov    %ebp,%edi
mov    $0x2,%esi
call   1130 <song_get_step_length@plt>
mov    %eax,%edi
call   1120 <seq_utils_remap_step_len_102@plt>
mov    %ebp,%edi
mov    $0x2,%esi
mov    %eax,%edx
call   10d0 <song_set_step_length@plt>
mov    %ebp,%edi
mov    $0x2,%esi
call   1210 <song_get_arp_speed@plt>
mov    %eax,%edi
call   1120 <seq_utils_remap_step_len_102@plt>
mov    %ebp,%edi
mov    $0x2,%esi
mov    %eax,%edx
call   1110 <song_set_arp_speed@plt>
mov    %ebp,%edi
mov    $0x3,%esi
call   1130 <song_get_step_length@plt>
mov    %eax,%edi
call   1120 <seq_utils_remap_step_len_102@plt>
mov    %ebp,%edi
mov    $0x3,%esi
mov    %eax,%edx
call   10d0 <song_set_step_length@plt>
mov    %ebp,%edi
mov    $0x3,%esi
call   1210 <song_get_arp_speed@plt>
mov    %eax,%edi
call   1120 <seq_utils_remap_step_len_102@plt>
mov    %ebp,%edi
mov    $0x3,%esi
mov    %eax,%edx
call   1110 <song_set_arp_speed@plt>
mov    %ebp,%edi
mov    $0x4,%esi
call   1130 <song_get_step_length@plt>
mov    %eax,%edi
call   1120 <seq_utils_remap_step_len_102@plt>
mov    %ebp,%edi
mov    $0x4,%esi
mov    %eax,%edx
call   10d0 <song_set_step_length@plt>
mov    %ebp,%edi
mov    $0x4,%esi
call   1210 <song_get_arp_speed@plt>
mov    %eax,%edi
call   1120 <seq_utils_remap_step_len_102@plt>
mov    %ebp,%edi
mov    $0x4,%esi
mov    %eax,%edx
call   1110 <song_set_arp_speed@plt>
mov    %ebp,%edi
mov    $0x5,%esi
call   1130 <song_get_step_length@plt>
mov    %eax,%edi
call   1120 <seq_utils_remap_step_len_102@plt>
mov    %ebp,%edi
mov    $0x5,%esi
mov    %eax,%edx
call   10d0 <song_set_step_length@plt>
mov    %ebp,%edi
mov    $0x5,%esi
call   1210 <song_get_arp_speed@plt>
mov    %eax,%edi
call   1120 <seq_utils_remap_step_len_102@plt>
mov    %ebp,%edi
mov    $0x5,%esi
mov    %eax,%edx
call   1110 <song_set_arp_speed@plt>
add    $0x1,%ebp
cmp    $0x6,%ebp
jne    1360 <seq_ctrl_refresh_modules+0x30>
cmp    $0x10007,%ebx
jg     1500 <seq_ctrl_refresh_modules+0x1d0>
mov    $0xffffffff,%edi
call   1250 <song_set_midi_clock_source@plt>
jmp    150c <seq_ctrl_refresh_modules+0x1dc>
cmp    $0x1000b,%ebx
ja     170f <seq_ctrl_refresh_modules+0x3df>
xor    %edi,%edi
xor    %esi,%esi
call   10f0 <song_set_cvoffset@plt>
mov    $0x1,%edi
xor    %esi,%esi
call   10f0 <song_set_cvoffset@plt>
mov    $0x2,%edi
xor    %esi,%esi
call   10f0 <song_set_cvoffset@plt>
mov    $0x3,%edi
xor    %esi,%esi
call   10f0 <song_set_cvoffset@plt>
xor    %edi,%edi
call   11d0 <song_set_midi_autolive@plt>
xor    %edi,%edi
call   1200 <song_set_scene_sync@plt>
mov    $0xc,%edi
call   1080 <song_set_magic_range@plt>
mov    $0x64,%edi
call   10b0 <song_set_magic_chance@plt>
xor    %eax,%eax
call   1180 <song_set_version_to_current@plt>
xor    %eax,%eax
call   1140 <midi_clock_is_ext_synced@plt>
test   %eax,%eax
jne    157b <seq_ctrl_refresh_modules+0x24b>
xor    %eax,%eax
call   1060 <song_get_tempo@plt>
mov    %eax,%edi
call   1030 <midi_clock_set_tempo@plt>
xor    %eax,%eax
call   1090 <song_get_swing@plt>
mov    %eax,%edi
call   11e0 <midi_clock_set_swing@plt>
xor    %eax,%eax
call   1100 <song_get_metronome_mode@plt>
mov    %eax,%edi
call   1220 <metronome_mode_changed@plt>
xor    %eax,%eax
call   1190 <song_get_metronome_sound_len@plt>
mov    %eax,%edi
call   10a0 <metronome_sound_len_changed@plt>
xor    %eax,%eax
call   1240 <song_get_cv_bend_range@plt>
mov    %eax,%edi
call   1150 <cvproc_set_bend_range@plt>
xor    %eax,%eax
call   10c0 <song_get_cvgate_pairs@plt>
mov    %eax,%edi
call   11f0 <cvproc_set_pairs@plt>
xor    %edi,%edi
call   1070 <song_get_cvgate_pair_mode@plt>
xor    %edi,%edi
mov    %eax,%esi
call   11b0 <cvproc_set_pair_mode@plt>
xor    %edi,%edi
call   11c0 <song_get_cv_output_scaling@plt>
xor    %edi,%edi
mov    %eax,%esi
call   11a0 <cvproc_set_output_scaling@plt>
mov    $0x1,%edi
call   1070 <song_get_cvgate_pair_mode@plt>
mov    $0x1,%edi
mov    %eax,%esi
call   11b0 <cvproc_set_pair_mode@plt>
mov    $0x1,%edi
call   11c0 <song_get_cv_output_scaling@plt>
mov    $0x1,%edi
mov    %eax,%esi
call   11a0 <cvproc_set_output_scaling@plt>
mov    $0x2,%edi
call   1070 <song_get_cvgate_pair_mode@plt>
mov    $0x2,%edi
mov    %eax,%esi
call   11b0 <cvproc_set_pair_mode@plt>
mov    $0x2,%edi
call   11c0 <song_get_cv_output_scaling@plt>
mov    $0x2,%edi
mov    %eax,%esi
call   11a0 <cvproc_set_output_scaling@plt>
mov    $0x3,%edi
call   1070 <song_get_cvgate_pair_mode@plt>
mov    $0x3,%edi
mov    %eax,%esi
call   11b0 <cvproc_set_pair_mode@plt>
mov    $0x3,%edi
call   11c0 <song_get_cv_output_scaling@plt>
mov    $0x3,%edi
mov    %eax,%esi
call   11a0 <cvproc_set_output_scaling@plt>
xor    %edi,%edi
call   1170 <song_get_cvcal@plt>
xor    %edi,%edi
mov    %eax,%esi
call   10e0 <cvproc_set_cvcal@plt>
xor    %edi,%edi
call   1050 <song_get_cvoffset@plt>
xor    %edi,%edi
mov    %eax,%esi
call   1040 <cvproc_set_cvoffset@plt>
mov    $0x1,%edi
call   1170 <song_get_cvcal@plt>
mov    $0x1,%edi
mov    %eax,%esi
call   10e0 <cvproc_set_cvcal@plt>
mov    $0x1,%edi
call   1050 <song_get_cvoffset@plt>
mov    $0x1,%edi
mov    %eax,%esi
call   1040 <cvproc_set_cvoffset@plt>
mov    $0x2,%edi
call   1170 <song_get_cvcal@plt>
mov    $0x2,%edi
mov    %eax,%esi
call   10e0 <cvproc_set_cvcal@plt>
mov    $0x2,%edi
call   1050 <song_get_cvoffset@plt>
mov    $0x2,%edi
mov    %eax,%esi
call   1040 <cvproc_set_cvoffset@plt>
mov    $0x3,%edi
call   1170 <song_get_cvcal@plt>
mov    $0x3,%edi
mov    %eax,%esi
call   10e0 <cvproc_set_cvcal@plt>
mov    $0x3,%edi
call   1050 <song_get_cvoffset@plt>
mov    $0x3,%edi
mov    %eax,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <cvproc_set_cvoffset@plt>
cmp    $0x1000d,%ebx
jbe    1540 <seq_ctrl_refresh_modules+0x210>
cmp    $0x1000e,%ebx
jne    155b <seq_ctrl_refresh_modules+0x22b>
jmp    1562 <seq_ctrl_refresh_modules+0x232>

LLVM IR (-O0):
define void @seq_ctrl_refresh_modules() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = call i32 (...) @song_get_song_version()
store i32 %5, i32* %4
%6 = load i32, i32* %4
%7 = icmp sle i32 %6, 65538
br i1 %7, label %8, label %40
8: ; preds = %0
%9 = call i32 @song_set_metronome_sound_len(i32 100)
store i32 0, i32* %2
br label %10
10: ; preds = %36, %8
%11 = load i32, i32* %2
%12 = icmp slt i32 %11, 6
br i1 %12, label %13, label %39
13: ; preds = %10
store i32 0, i32* %3
br label %14
14: ; preds = %32, %13
%15 = load i32, i32* %3
%16 = icmp slt i32 %15, 6
br i1 %16, label %17, label %35
17: ; preds = %14
%18 = load i32, i32* %2
%19 = load i32, i32* %3
%20 = load i32, i32* %2
%21 = load i32, i32* %3
%22 = call i32 @song_get_step_length(i32 %20, i32 %21)
%23 = call i32 @seq_utils_remap_step_len_102(i32 %22)
%24 = call i32 @song_set_step_length(i32 %18, i32 %19, i32 %23)
%25 = load i32, i32* %2
%26 = load i32, i32* %3
%27 = load i32, i32* %2
%28 = load i32, i32* %3
%29 = call i32 @song_get_arp_speed(i32 %27, i32 %28)
%30 = call i32 @seq_utils_remap_step_len_102(i32 %29)
%31 = call i32 @song_set_arp_speed(i32 %25, i32 %26, i32 %30)
br label %32
32: ; preds = %17
%33 = load i32, i32* %3
%34 = add nsw i32 %33, 1
store i32 %34, i32* %3
br label %14
35: ; preds = %14
br label %36
36: ; preds = %35
%37 = load i32, i32* %2
%38 = add nsw i32 %37, 1
store i32 %38, i32* %2
br label %10
39: ; preds = %10
br label %40
40: ; preds = %39, %0
%41 = load i32, i32* %4
%42 = icmp sle i32 %41, 65543
br i1 %42, label %43, label %45
43: ; preds = %40
%44 = call i32 @song_set_midi_clock_source(i32 -1)
br label %45
45: ; preds = %43, %40
%46 = load i32, i32* %4
%47 = icmp sle i32 %46, 65547
br i1 %47, label %48, label %54
48: ; preds = %45
%49 = call i32 @song_set_cvoffset(i32 0, i32 0)
%50 = call i32 @song_set_cvoffset(i32 1, i32 0)
%51 = call i32 @song_set_cvoffset(i32 2, i32 0)
%52 = call i32 @song_set_cvoffset(i32 3, i32 0)
%53 = call i32 @song_set_midi_autolive(i32 0)
br label %54
54: ; preds = %48, %45
%55 = load i32, i32* %4
%56 = icmp sle i32 %55, 65549
br i1 %56, label %57, label %61
57: ; preds = %54
%58 = call i32 @song_set_scene_sync(i32 0)
%59 = call i32 @song_set_magic_range(i32 12)
%60 = call i32 @song_set_magic_chance(i32 100)
br label %61
61: ; preds = %57, %54
%62 = load i32, i32* %4
%63 = icmp ne i32 %62, 65550
br i1 %63, label %64, label %66
64: ; preds = %61
%65 = call i32 (...) @song_set_version_to_current()
br label %66
66: ; preds = %64, %61
%67 = call i32 (...) @midi_clock_is_ext_synced()
%68 = icmp ne i32 %67, 0
br i1 %68, label %72, label %69
69: ; preds = %66
%70 = call i32 (...) @song_get_tempo()
%71 = call i32 @midi_clock_set_tempo(i32 %70)
br label %72
72: ; preds = %69, %66
%73 = call i32 (...) @song_get_swing()
%74 = call i32 @midi_clock_set_swing(i32 %73)
%75 = call i32 (...) @song_get_metronome_mode()
%76 = call i32 @metronome_mode_changed(i32 %75)
%77 = call i32 (...) @song_get_metronome_sound_len()
%78 = call i32 @metronome_sound_len_changed(i32 %77)
%79 = call i32 (...) @song_get_cv_bend_range()
%80 = call i32 @cvproc_set_bend_range(i32 %79)
%81 = call i32 (...) @song_get_cvgate_pairs()
%82 = call i32 @cvproc_set_pairs(i32 %81)
store i32 0, i32* %1
br label %83
83: ; preds = %95, %72
%84 = load i32, i32* %1
%85 = icmp slt i32 %84, 4
br i1 %85, label %86, label %98
86: ; preds = %83
%87 = load i32, i32* %1
%88 = load i32, i32* %1
%89 = call i32 @song_get_cvgate_pair_mode(i32 %88)
%90 = call i32 @cvproc_set_pair_mode(i32 %87, i32 %89)
%91 = load i32, i32* %1
%92 = load i32, i32* %1
%93 = call i32 @song_get_cv_output_scaling(i32 %92)
%94 = call i32 @cvproc_set_output_scaling(i32 %91, i32 %93)
br label %95
95: ; preds = %86
%96 = load i32, i32* %1
%97 = add nsw i32 %96, 1
store i32 %97, i32* %1
br label %83
98: ; preds = %83
store i32 0, i32* %1
br label %99
99: ; preds = %111, %98
%100 = load i32, i32* %1
%101 = icmp slt i32 %100, 4
br i1 %101, label %102, label %114
102: ; preds = %99
%103 = load i32, i32* %1
%104 = load i32, i32* %1
%105 = call i32 @song_get_cvcal(i32 %104)
%106 = call i32 @cvproc_set_cvcal(i32 %103, i32 %105)
%107 = load i32, i32* %1
%108 = load i32, i32* %1
%109 = call i32 @song_get_cvoffset(i32 %108)
%110 = call i32 @cvproc_set_cvoffset(i32 %107, i32 %109)
br label %111
111: ; preds = %102
%112 = load i32, i32* %1
%113 = add nsw i32 %112, 1
store i32 %113, i32* %1
br label %99
114: ; preds = %99
ret void
}

LLVM IR (-O2):
define void @seq_ctrl_refresh_modules() {
%1 = tail call i32 (...) @song_get_song_version()
%2 = icmp slt i32 %1, 65539
br i1 %2, label %3, label %45
3: ; preds = %0
%4 = tail call i32 @song_set_metronome_sound_len(i32 100)
br label %5
5: ; preds = %3, %5
%6 = phi i32 [ 0, %3 ], [ %43, %5 ]
%7 = tail call i32 @song_get_step_length(i32 %6, i32 0)
%8 = tail call i32 @seq_utils_remap_step_len_102(i32 %7)
%9 = tail call i32 @song_set_step_length(i32 %6, i32 0, i32 %8)
%10 = tail call i32 @song_get_arp_speed(i32 %6, i32 0)
%11 = tail call i32 @seq_utils_remap_step_len_102(i32 %10)
%12 = tail call i32 @song_set_arp_speed(i32 %6, i32 0, i32 %11)
%13 = tail call i32 @song_get_step_length(i32 %6, i32 1)
%14 = tail call i32 @seq_utils_remap_step_len_102(i32 %13)
%15 = tail call i32 @song_set_step_length(i32 %6, i32 1, i32 %14)
%16 = tail call i32 @song_get_arp_speed(i32 %6, i32 1)
%17 = tail call i32 @seq_utils_remap_step_len_102(i32 %16)
%18 = tail call i32 @song_set_arp_speed(i32 %6, i32 1, i32 %17)
%19 = tail call i32 @song_get_step_length(i32 %6, i32 2)
%20 = tail call i32 @seq_utils_remap_step_len_102(i32 %19)
%21 = tail call i32 @song_set_step_length(i32 %6, i32 2, i32 %20)
%22 = tail call i32 @song_get_arp_speed(i32 %6, i32 2)
%23 = tail call i32 @seq_utils_remap_step_len_102(i32 %22)
%24 = tail call i32 @song_set_arp_speed(i32 %6, i32 2, i32 %23)
%25 = tail call i32 @song_get_step_length(i32 %6, i32 3)
%26 = tail call i32 @seq_utils_remap_step_len_102(i32 %25)
%27 = tail call i32 @song_set_step_length(i32 %6, i32 3, i32 %26)
%28 = tail call i32 @song_get_arp_speed(i32 %6, i32 3)
%29 = tail call i32 @seq_utils_remap_step_len_102(i32 %28)
%30 = tail call i32 @song_set_arp_speed(i32 %6, i32 3, i32 %29)
%31 = tail call i32 @song_get_step_length(i32 %6, i32 4)
%32 = tail call i32 @seq_utils_remap_step_len_102(i32 %31)
%33 = tail call i32 @song_set_step_length(i32 %6, i32 4, i32 %32)
%34 = tail call i32 @song_get_arp_speed(i32 %6, i32 4)
%35 = tail call i32 @seq_utils_remap_step_len_102(i32 %34)
%36 = tail call i32 @song_set_arp_speed(i32 %6, i32 4, i32 %35)
%37 = tail call i32 @song_get_step_length(i32 %6, i32 5)
%38 = tail call i32 @seq_utils_remap_step_len_102(i32 %37)
%39 = tail call i32 @song_set_step_length(i32 %6, i32 5, i32 %38)
%40 = tail call i32 @song_get_arp_speed(i32 %6, i32 5)
%41 = tail call i32 @seq_utils_remap_step_len_102(i32 %40)
%42 = tail call i32 @song_set_arp_speed(i32 %6, i32 5, i32 %41)
%43 = add nuw nsw i32 %6, 1
%44 = icmp eq i32 %43, 6
br i1 %44, label %45, label %5
45: ; preds = %5, %0
%46 = icmp slt i32 %1, 65544
br i1 %46, label %47, label %49
47: ; preds = %45
%48 = tail call i32 @song_set_midi_clock_source(i32 -1)
br label %51
49: ; preds = %45
%50 = icmp ult i32 %1, 65548
br i1 %50, label %51, label %57
51: ; preds = %49, %47
%52 = tail call i32 @song_set_cvoffset(i32 0, i32 0)
%53 = tail call i32 @song_set_cvoffset(i32 1, i32 0)
%54 = tail call i32 @song_set_cvoffset(i32 2, i32 0)
%55 = tail call i32 @song_set_cvoffset(i32 3, i32 0)
%56 = tail call i32 @song_set_midi_autolive(i32 0)
br label %59
57: ; preds = %49
%58 = icmp ult i32 %1, 65550
br i1 %58, label %59, label %63
59: ; preds = %57, %51
%60 = tail call i32 @song_set_scene_sync(i32 0)
%61 = tail call i32 @song_set_magic_range(i32 12)
%62 = tail call i32 @song_set_magic_chance(i32 100)
br label %65
63: ; preds = %57
%64 = icmp eq i32 %1, 65550
br i1 %64, label %67, label %65
65: ; preds = %59, %63
%66 = tail call i32 (...) @song_set_version_to_current()
br label %67
67: ; preds = %65, %63
%68 = tail call i32 (...) @midi_clock_is_ext_synced()
%69 = icmp eq i32 %68, 0
br i1 %69, label %70, label %73
70: ; preds = %67
%71 = tail call i32 (...) @song_get_tempo()
%72 = tail call i32 @midi_clock_set_tempo(i32 %71)
br label %73
73: ; preds = %70, %67
%74 = tail call i32 (...) @song_get_swing()
%75 = tail call i32 @midi_clock_set_swing(i32 %74)
%76 = tail call i32 (...) @song_get_metronome_mode()
%77 = tail call i32 @metronome_mode_changed(i32 %76)
%78 = tail call i32 (...) @song_get_metronome_sound_len()
%79 = tail call i32 @metronome_sound_len_changed(i32 %78)
%80 = tail call i32 (...) @song_get_cv_bend_range()
%81 = tail call i32 @cvproc_set_bend_range(i32 %80)
%82 = tail call i32 (...) @song_get_cvgate_pairs()
%83 = tail call i32 @cvproc_set_pairs(i32 %82)
%84 = tail call i32 @song_get_cvgate_pair_mode(i32 0)
%85 = tail call i32 @cvproc_set_pair_mode(i32 0, i32 %84)
%86 = tail call i32 @song_get_cv_output_scaling(i32 0)
%87 = tail call i32 @cvproc_set_output_scaling(i32 0, i32 %86)
%88 = tail call i32 @song_get_cvgate_pair_mode(i32 1)
%89 = tail call i32 @cvproc_set_pair_mode(i32 1, i32 %88)
%90 = tail call i32 @song_get_cv_output_scaling(i32 1)
%91 = tail call i32 @cvproc_set_output_scaling(i32 1, i32 %90)
%92 = tail call i32 @song_get_cvgate_pair_mode(i32 2)
%93 = tail call i32 @cvproc_set_pair_mode(i32 2, i32 %92)
%94 = tail call i32 @song_get_cv_output_scaling(i32 2)
%95 = tail call i32 @cvproc_set_output_scaling(i32 2, i32 %94)
%96 = tail call i32 @song_get_cvgate_pair_mode(i32 3)
%97 = tail call i32 @cvproc_set_pair_mode(i32 3, i32 %96)
%98 = tail call i32 @song_get_cv_output_scaling(i32 3)
%99 = tail call i32 @cvproc_set_output_scaling(i32 3, i32 %98)
%100 = tail call i32 @song_get_cvcal(i32 0)
%101 = tail call i32 @cvproc_set_cvcal(i32 0, i32 %100)
%102 = tail call i32 @song_get_cvoffset(i32 0)
%103 = tail call i32 @cvproc_set_cvoffset(i32 0, i32 %102)
%104 = tail call i32 @song_get_cvcal(i32 1)
%105 = tail call i32 @cvproc_set_cvcal(i32 1, i32 %104)
%106 = tail call i32 @song_get_cvoffset(i32 1)
%107 = tail call i32 @cvproc_set_cvoffset(i32 1, i32 %106)
%108 = tail call i32 @song_get_cvcal(i32 2)
%109 = tail call i32 @cvproc_set_cvcal(i32 2, i32 %108)
%110 = tail call i32 @song_get_cvoffset(i32 2)
%111 = tail call i32 @cvproc_set_cvoffset(i32 2, i32 %110)
%112 = tail call i32 @song_get_cvcal(i32 3)
%113 = tail call i32 @cvproc_set_cvcal(i32 3, i32 %112)
%114 = tail call i32 @song_get_cvoffset(i32 3)
%115 = tail call i32 @cvproc_set_cvoffset(i32 3, i32 %114)
ret void
}