#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 panel_get_edit_mode();
int /*<<< orphan*/ pattern_edit_set_enable(int /*<<< orphan*/);
int /*<<< orphan*/ song_edit_set_enable(int /*<<< orphan*/);
int /*<<< orphan*/ step_edit_set_enable(int /*<<< orphan*/);
void panel_cancel_edit_mode(void) {
  if (panel_get_edit_mode() == 1) {
    step_edit_set_enable(0);
  } else if (panel_get_edit_mode() == 2) {
    song_edit_set_enable(0);
  } else if (panel_get_edit_mode() == 3) {
    pattern_edit_set_enable(0);
  }
}


x86 assembly (clang, -O0):
<panel_cancel_edit_mode>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1060 <panel_get_edit_mode@plt>
cmp    $0x1,%eax
jne    1160 <panel_cancel_edit_mode+0x20>
xor    %edi,%edi
call   1050 <step_edit_set_enable@plt>
jmp    119d <panel_cancel_edit_mode+0x5d>
mov    $0x0,%al
call   1060 <panel_get_edit_mode@plt>
cmp    $0x2,%eax
jne    117c <panel_cancel_edit_mode+0x3c>
xor    %edi,%edi
call   1040 <song_edit_set_enable@plt>
jmp    1198 <panel_cancel_edit_mode+0x58>
mov    $0x0,%al
call   1060 <panel_get_edit_mode@plt>
cmp    $0x3,%eax
jne    1193 <panel_cancel_edit_mode+0x53>
xor    %edi,%edi
call   1030 <pattern_edit_set_enable@plt>
jmp    1198 <panel_cancel_edit_mode+0x58>
jmp    119d <panel_cancel_edit_mode+0x5d>
pop    %rbp
ret

x86 assembly (clang, -O2):
<panel_cancel_edit_mode>:
push   %rax
xor    %eax,%eax
call   1060 <panel_get_edit_mode@plt>
cmp    $0x1,%eax
jne    1155 <panel_cancel_edit_mode+0x15>
xor    %edi,%edi
pop    %rax
jmp    1050 <step_edit_set_enable@plt>
xor    %eax,%eax
call   1060 <panel_get_edit_mode@plt>
cmp    $0x2,%eax
jne    1169 <panel_cancel_edit_mode+0x29>
xor    %edi,%edi
pop    %rax
jmp    1040 <song_edit_set_enable@plt>
xor    %eax,%eax
call   1060 <panel_get_edit_mode@plt>
cmp    $0x3,%eax
jne    117d <panel_cancel_edit_mode+0x3d>
xor    %edi,%edi
pop    %rax
jmp    1030 <pattern_edit_set_enable@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @panel_cancel_edit_mode() {
%1 = call i32 (...) @panel_get_edit_mode()
%2 = icmp eq i32 %1, 1
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = call i32 @step_edit_set_enable(i32 0)
br label %17
5: ; preds = %0
%6 = call i32 (...) @panel_get_edit_mode()
%7 = icmp eq i32 %6, 2
br i1 %7, label %8, label %10
8: ; preds = %5
%9 = call i32 @song_edit_set_enable(i32 0)
br label %16
10: ; preds = %5
%11 = call i32 (...) @panel_get_edit_mode()
%12 = icmp eq i32 %11, 3
br i1 %12, label %13, label %15
13: ; preds = %10
%14 = call i32 @pattern_edit_set_enable(i32 0)
br label %15
15: ; preds = %13, %10
br label %16
16: ; preds = %15, %8
br label %17
17: ; preds = %16, %3
ret void
}

LLVM IR (-O2):
define void @panel_cancel_edit_mode() {
%1 = tail call i32 (...) @panel_get_edit_mode()
%2 = icmp eq i32 %1, 1
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 @step_edit_set_enable(i32 0)
br label %15
5: ; preds = %0
%6 = tail call i32 (...) @panel_get_edit_mode()
%7 = icmp eq i32 %6, 2
br i1 %7, label %8, label %10
8: ; preds = %5
%9 = tail call i32 @song_edit_set_enable(i32 0)
br label %15
10: ; preds = %5
%11 = tail call i32 (...) @panel_get_edit_mode()
%12 = icmp eq i32 %11, 3
br i1 %12, label %13, label %15
13: ; preds = %10
%14 = tail call i32 @pattern_edit_set_enable(i32 0)
br label %15
15: ; preds = %8, %13, %10, %3
ret void
}