#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);
scalar_t__ seq_ctrl_get_mute_select(int);
int /*<<< orphan*/ seq_ctrl_set_mute_select(int, int);
void panel_handle_mute_select(int track) {
  if (track < 0 || track >= 6) {
    log_error("phms - track invalid: %d", track);
    return;
  }
  if (seq_ctrl_get_mute_select(track)) {
    seq_ctrl_set_mute_select(track, 0);
  } else {
    seq_ctrl_set_mute_select(track, 1);
  }
}


x86 assembly (clang, -O0):
<panel_handle_mute_select>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jl     114f <panel_handle_mute_select+0x1f>
cmpl   $0x6,-0x4(%rbp)
jl     1163 <panel_handle_mute_select+0x33>
mov    -0x4(%rbp),%esi
lea    0xea7(%rip),%rdi
call   1030 <log_error@plt>
jmp    1191 <panel_handle_mute_select+0x61>
mov    -0x4(%rbp),%edi
call   1040 <seq_ctrl_get_mute_select@plt>
cmp    $0x0,%rax
je     1184 <panel_handle_mute_select+0x54>
mov    -0x4(%rbp),%edi
xor    %esi,%esi
call   1050 <seq_ctrl_set_mute_select@plt>
jmp    1191 <panel_handle_mute_select+0x61>
mov    -0x4(%rbp),%edi
mov    $0x1,%esi
call   1050 <seq_ctrl_set_mute_select@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<panel_handle_mute_select>:
push   %rbx
mov    %edi,%ebx
cmp    $0x6,%edi
jb     1147 <panel_handle_mute_select+0x17>
lea    0xec1(%rip),%rdi
mov    %ebx,%esi
pop    %rbx
jmp    1030 <log_error@plt>
mov    %ebx,%edi
call   1040 <seq_ctrl_get_mute_select@plt>
mov    %ebx,%edi
test   %rax,%rax
je     115d <panel_handle_mute_select+0x2d>
xor    %esi,%esi
pop    %rbx
jmp    1050 <seq_ctrl_set_mute_select@plt>
mov    $0x1,%esi
pop    %rbx
jmp    1050 <seq_ctrl_set_mute_select@plt>

LLVM IR (-O0):
@.str = [25 x i8] c"phms - track invalid: %d\00"
define void @panel_handle_mute_select(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 %21
11: ; preds = %5
%12 = load i32, i32* %2
%13 = call i64 @seq_ctrl_get_mute_select(i32 %12)
%14 = icmp ne i64 %13, 0
br i1 %14, label %15, label %18
15: ; preds = %11
%16 = load i32, i32* %2
%17 = call i32 @seq_ctrl_set_mute_select(i32 %16, i32 0)
br label %21
18: ; preds = %11
%19 = load i32, i32* %2
%20 = call i32 @seq_ctrl_set_mute_select(i32 %19, i32 1)
br label %21
21: ; preds = %8, %18, %15
ret void
}

LLVM IR (-O2):
@.str = [25 x i8] c"phms - track invalid: %d\00"
define void @panel_handle_mute_select(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 %12
5: ; preds = %1
%6 = tail call i64 @seq_ctrl_get_mute_select(i32 %0)
%7 = icmp eq i64 %6, 0
br i1 %7, label %10, label %8
8: ; preds = %5
%9 = tail call i32 @seq_ctrl_set_mute_select(i32 %0, i32 0)
br label %12
10: ; preds = %5
%11 = tail call i32 @seq_ctrl_set_mute_select(i32 %0, i32 1)
br label %12
12: ; preds = %3, %10, %8
ret void
}