#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*/ log_error(char *, int);
int /*<<< orphan*/ metronome_stop_sound();
int /*<<< orphan*/ seq_engine_live_stop_all_notes(int);
int /*<<< orphan*/ seq_engine_track_stop_all_notes(int);
void seq_engine_stop_notes(int track) {
  if (track < 0 || track >= 6) {
    log_error("sesn - track invalid: %d", track);
    return;
  }
  seq_engine_track_stop_all_notes(track);
  seq_engine_live_stop_all_notes(track);
  if (track == 5) {
    metronome_stop_sound();
  }
}


x86 assembly (clang, -O0):
<seq_engine_stop_notes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jl     115f <seq_engine_stop_notes+0x1f>
cmpl   $0x6,-0x4(%rbp)
jl     1173 <seq_engine_stop_notes+0x33>
mov    -0x4(%rbp),%esi
lea    0xe97(%rip),%rdi
call   1030 <log_error@plt>
jmp    1194 <seq_engine_stop_notes+0x54>
mov    -0x4(%rbp),%edi
call   1060 <seq_engine_track_stop_all_notes@plt>
mov    -0x4(%rbp),%edi
call   1040 <seq_engine_live_stop_all_notes@plt>
cmpl   $0x5,-0x4(%rbp)
jne    1194 <seq_engine_stop_notes+0x54>
mov    $0x0,%al
call   1050 <metronome_stop_sound@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<seq_engine_stop_notes>:
push   %rbx
mov    %edi,%ebx
cmp    $0x6,%edi
jb     1157 <seq_engine_stop_notes+0x17>
lea    0xeb1(%rip),%rdi
mov    %ebx,%esi
pop    %rbx
jmp    1030 <log_error@plt>
mov    %ebx,%edi
call   1060 <seq_engine_track_stop_all_notes@plt>
mov    %ebx,%edi
call   1040 <seq_engine_live_stop_all_notes@plt>
cmp    $0x5,%ebx
jne    1172 <seq_engine_stop_notes+0x32>
xor    %eax,%eax
pop    %rbx
jmp    1050 <metronome_stop_sound@plt>
pop    %rbx
ret

LLVM IR (-O0):
@.str = [25 x i8] c"sesn - track invalid: %d\00"
define void @seq_engine_stop_notes(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp slt i32 %3, 0
br i1 %4, label %8, label %5
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp sge i32 %6, 6
br i1 %7, label %8, label %11
8: ; preds = %5, %1
%9 = load i32, i32* %2
%10 = call i32 @log_error(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %9)
br label %20
11: ; preds = %5
%12 = load i32, i32* %2
%13 = call i32 @seq_engine_track_stop_all_notes(i32 %12)
%14 = load i32, i32* %2
%15 = call i32 @seq_engine_live_stop_all_notes(i32 %14)
%16 = load i32, i32* %2
%17 = icmp eq i32 %16, 5
br i1 %17, label %18, label %20
18: ; preds = %11
%19 = call i32 (...) @metronome_stop_sound()
br label %20
20: ; preds = %8, %18, %11
ret void
}

LLVM IR (-O2):
@.str = [25 x i8] c"sesn - track invalid: %d\00"
define void @seq_engine_stop_notes(i32 %0) {
%2 = icmp ugt i32 %0, 5
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 @log_error(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %0)
br label %11
5: ; preds = %1
%6 = tail call i32 @seq_engine_track_stop_all_notes(i32 %0)
%7 = tail call i32 @seq_engine_live_stop_all_notes(i32 %0)
%8 = icmp eq i32 %0, 5
br i1 %8, label %9, label %11
9: ; preds = %5
%10 = tail call i32 (...) @metronome_stop_sound()
br label %11
11: ; preds = %3, %9, %5
ret void
}