#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 eeprom_table {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ wait_key_and_grab(int, struct eeprom_table *, char *);
void second_stage(int device_fd, struct eeprom_table *new_e2prom_tab_p,
                  int dump_mode) {
  printf("\nStage-2: \"panel_data_dump_mode\" enabled. one-to-one keys...\n");
  wait_key_and_grab(device_fd, new_e2prom_tab_p, "OFF");
  wait_key_and_grab(device_fd, new_e2prom_tab_p, "0");
  wait_key_and_grab(device_fd, new_e2prom_tab_p, "1");
  wait_key_and_grab(device_fd, new_e2prom_tab_p, "2");
  wait_key_and_grab(device_fd, new_e2prom_tab_p, "3");
  wait_key_and_grab(device_fd, new_e2prom_tab_p, "4");
  wait_key_and_grab(device_fd, new_e2prom_tab_p, "5");
  wait_key_and_grab(device_fd, new_e2prom_tab_p, "6");
  wait_key_and_grab(device_fd, new_e2prom_tab_p, "7");
  wait_key_and_grab(device_fd, new_e2prom_tab_p, "8");
  wait_key_and_grab(device_fd, new_e2prom_tab_p, "9");
  wait_key_and_grab(device_fd, new_e2prom_tab_p, "VOL_UP");
  wait_key_and_grab(device_fd, new_e2prom_tab_p, "VOL_DOWN");
  wait_key_and_grab(device_fd, new_e2prom_tab_p, "MUTE");
  wait_key_and_grab(device_fd, new_e2prom_tab_p, "MENU");
  wait_key_and_grab(device_fd, new_e2prom_tab_p, "PROG_UP");
  wait_key_and_grab(device_fd, new_e2prom_tab_p, "PROG_DOWN");
  wait_key_and_grab(device_fd, new_e2prom_tab_p, "BACKWARD");
  wait_key_and_grab(device_fd, new_e2prom_tab_p, "FORWARD");
  wait_key_and_grab(device_fd, new_e2prom_tab_p, "OK");
  return;
}


x86 assembly (clang, -O0):
<second_stage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
lea    0xec7(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xef2(%rip),%rdx
call   1040 <wait_key_and_grab@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xee3(%rip),%rdx
call   1040 <wait_key_and_grab@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xed2(%rip),%rdx
call   1040 <wait_key_and_grab@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xec1(%rip),%rdx
call   1040 <wait_key_and_grab@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xeb0(%rip),%rdx
call   1040 <wait_key_and_grab@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe9f(%rip),%rdx
call   1040 <wait_key_and_grab@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe8e(%rip),%rdx
call   1040 <wait_key_and_grab@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe7d(%rip),%rdx
call   1040 <wait_key_and_grab@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe6c(%rip),%rdx
call   1040 <wait_key_and_grab@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe5b(%rip),%rdx
call   1040 <wait_key_and_grab@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe4a(%rip),%rdx
call   1040 <wait_key_and_grab@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe39(%rip),%rdx
call   1040 <wait_key_and_grab@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe2d(%rip),%rdx
call   1040 <wait_key_and_grab@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe23(%rip),%rdx
call   1040 <wait_key_and_grab@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe15(%rip),%rdx
call   1040 <wait_key_and_grab@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe07(%rip),%rdx
call   1040 <wait_key_and_grab@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xdfc(%rip),%rdx
call   1040 <wait_key_and_grab@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xdf3(%rip),%rdx
call   1040 <wait_key_and_grab@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xde9(%rip),%rdx
call   1040 <wait_key_and_grab@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xdde(%rip),%rdx
call   1040 <wait_key_and_grab@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<second_stage>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0xf29(%rip),%rdi
call   1030 <puts@plt>
lea    0xec5(%rip),%rdx
mov    %ebp,%edi
mov    %rbx,%rsi
call   1040 <wait_key_and_grab@plt>
lea    0xeb8(%rip),%rdx
mov    %ebp,%edi
mov    %rbx,%rsi
call   1040 <wait_key_and_grab@plt>
lea    0xea9(%rip),%rdx
mov    %ebp,%edi
mov    %rbx,%rsi
call   1040 <wait_key_and_grab@plt>
lea    0xe9a(%rip),%rdx
mov    %ebp,%edi
mov    %rbx,%rsi
call   1040 <wait_key_and_grab@plt>
lea    0xe8b(%rip),%rdx
mov    %ebp,%edi
mov    %rbx,%rsi
call   1040 <wait_key_and_grab@plt>
lea    0xe7c(%rip),%rdx
mov    %ebp,%edi
mov    %rbx,%rsi
call   1040 <wait_key_and_grab@plt>
lea    0xe6d(%rip),%rdx
mov    %ebp,%edi
mov    %rbx,%rsi
call   1040 <wait_key_and_grab@plt>
lea    0xe5e(%rip),%rdx
mov    %ebp,%edi
mov    %rbx,%rsi
call   1040 <wait_key_and_grab@plt>
lea    0xe4f(%rip),%rdx
mov    %ebp,%edi
mov    %rbx,%rsi
call   1040 <wait_key_and_grab@plt>
lea    0xe40(%rip),%rdx
mov    %ebp,%edi
mov    %rbx,%rsi
call   1040 <wait_key_and_grab@plt>
lea    0xe31(%rip),%rdx
mov    %ebp,%edi
mov    %rbx,%rsi
call   1040 <wait_key_and_grab@plt>
lea    0xe22(%rip),%rdx
mov    %ebp,%edi
mov    %rbx,%rsi
call   1040 <wait_key_and_grab@plt>
lea    0xe18(%rip),%rdx
mov    %ebp,%edi
mov    %rbx,%rsi
call   1040 <wait_key_and_grab@plt>
lea    0xe10(%rip),%rdx
mov    %ebp,%edi
mov    %rbx,%rsi
call   1040 <wait_key_and_grab@plt>
lea    0xe04(%rip),%rdx
mov    %ebp,%edi
mov    %rbx,%rsi
call   1040 <wait_key_and_grab@plt>
lea    0xdf8(%rip),%rdx
mov    %ebp,%edi
mov    %rbx,%rsi
call   1040 <wait_key_and_grab@plt>
lea    0xdef(%rip),%rdx
mov    %ebp,%edi
mov    %rbx,%rsi
call   1040 <wait_key_and_grab@plt>
lea    0xde8(%rip),%rdx
mov    %ebp,%edi
mov    %rbx,%rsi
call   1040 <wait_key_and_grab@plt>
lea    0xde0(%rip),%rdx
mov    %ebp,%edi
mov    %rbx,%rsi
call   1040 <wait_key_and_grab@plt>
lea    0xdd7(%rip),%rdx
mov    %ebp,%edi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <wait_key_and_grab@plt>

LLVM IR (-O0):
%struct.eeprom_table = type { i32 }
@.str = [62 x i8] c"\0AStage-2: \22panel_data_dump_mode\22 enabled. one-to-one keys...\0A\00"
@.str.1 = [4 x i8] c"OFF\00"
@.str.2 = [2 x i8] c"0\00"
@.str.3 = [2 x i8] c"1\00"
@.str.4 = [2 x i8] c"2\00"
@.str.5 = [2 x i8] c"3\00"
@.str.6 = [2 x i8] c"4\00"
@.str.7 = [2 x i8] c"5\00"
@.str.8 = [2 x i8] c"6\00"
@.str.9 = [2 x i8] c"7\00"
@.str.10 = [2 x i8] c"8\00"
@.str.11 = [2 x i8] c"9\00"
@.str.12 = [7 x i8] c"VOL_UP\00"
@.str.13 = [9 x i8] c"VOL_DOWN\00"
@.str.14 = [5 x i8] c"MUTE\00"
@.str.15 = [5 x i8] c"MENU\00"
@.str.16 = [8 x i8] c"PROG_UP\00"
@.str.17 = [10 x i8] c"PROG_DOWN\00"
@.str.18 = [9 x i8] c"BACKWARD\00"
@.str.19 = [8 x i8] c"FORWARD\00"
@.str.20 = [3 x i8] c"OK\00"
define void @second_stage(i32 %0, %struct.eeprom_table* %1, i32 %2) {
%4 = alloca i32
%5 = alloca %struct.eeprom_table*
%6 = alloca i32
store i32 %0, i32* %4
store %struct.eeprom_table* %1, %struct.eeprom_table** %5
store i32 %2, i32* %6
%7 = call i32 @printf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str, i64 0, i64 0))
%8 = load i32, i32* %4
%9 = load %struct.eeprom_table*, %struct.eeprom_table** %5
%10 = call i32 @wait_key_and_grab(i32 %8, %struct.eeprom_table* %9, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%11 = load i32, i32* %4
%12 = load %struct.eeprom_table*, %struct.eeprom_table** %5
%13 = call i32 @wait_key_and_grab(i32 %11, %struct.eeprom_table* %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%14 = load i32, i32* %4
%15 = load %struct.eeprom_table*, %struct.eeprom_table** %5
%16 = call i32 @wait_key_and_grab(i32 %14, %struct.eeprom_table* %15, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%17 = load i32, i32* %4
%18 = load %struct.eeprom_table*, %struct.eeprom_table** %5
%19 = call i32 @wait_key_and_grab(i32 %17, %struct.eeprom_table* %18, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%20 = load i32, i32* %4
%21 = load %struct.eeprom_table*, %struct.eeprom_table** %5
%22 = call i32 @wait_key_and_grab(i32 %20, %struct.eeprom_table* %21, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%23 = load i32, i32* %4
%24 = load %struct.eeprom_table*, %struct.eeprom_table** %5
%25 = call i32 @wait_key_and_grab(i32 %23, %struct.eeprom_table* %24, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%26 = load i32, i32* %4
%27 = load %struct.eeprom_table*, %struct.eeprom_table** %5
%28 = call i32 @wait_key_and_grab(i32 %26, %struct.eeprom_table* %27, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%29 = load i32, i32* %4
%30 = load %struct.eeprom_table*, %struct.eeprom_table** %5
%31 = call i32 @wait_key_and_grab(i32 %29, %struct.eeprom_table* %30, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
%32 = load i32, i32* %4
%33 = load %struct.eeprom_table*, %struct.eeprom_table** %5
%34 = call i32 @wait_key_and_grab(i32 %32, %struct.eeprom_table* %33, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
%35 = load i32, i32* %4
%36 = load %struct.eeprom_table*, %struct.eeprom_table** %5
%37 = call i32 @wait_key_and_grab(i32 %35, %struct.eeprom_table* %36, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0))
%38 = load i32, i32* %4
%39 = load %struct.eeprom_table*, %struct.eeprom_table** %5
%40 = call i32 @wait_key_and_grab(i32 %38, %struct.eeprom_table* %39, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.11, i64 0, i64 0))
%41 = load i32, i32* %4
%42 = load %struct.eeprom_table*, %struct.eeprom_table** %5
%43 = call i32 @wait_key_and_grab(i32 %41, %struct.eeprom_table* %42, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.12, i64 0, i64 0))
%44 = load i32, i32* %4
%45 = load %struct.eeprom_table*, %struct.eeprom_table** %5
%46 = call i32 @wait_key_and_grab(i32 %44, %struct.eeprom_table* %45, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.13, i64 0, i64 0))
%47 = load i32, i32* %4
%48 = load %struct.eeprom_table*, %struct.eeprom_table** %5
%49 = call i32 @wait_key_and_grab(i32 %47, %struct.eeprom_table* %48, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.14, i64 0, i64 0))
%50 = load i32, i32* %4
%51 = load %struct.eeprom_table*, %struct.eeprom_table** %5
%52 = call i32 @wait_key_and_grab(i32 %50, %struct.eeprom_table* %51, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.15, i64 0, i64 0))
%53 = load i32, i32* %4
%54 = load %struct.eeprom_table*, %struct.eeprom_table** %5
%55 = call i32 @wait_key_and_grab(i32 %53, %struct.eeprom_table* %54, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.16, i64 0, i64 0))
%56 = load i32, i32* %4
%57 = load %struct.eeprom_table*, %struct.eeprom_table** %5
%58 = call i32 @wait_key_and_grab(i32 %56, %struct.eeprom_table* %57, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.17, i64 0, i64 0))
%59 = load i32, i32* %4
%60 = load %struct.eeprom_table*, %struct.eeprom_table** %5
%61 = call i32 @wait_key_and_grab(i32 %59, %struct.eeprom_table* %60, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.18, i64 0, i64 0))
%62 = load i32, i32* %4
%63 = load %struct.eeprom_table*, %struct.eeprom_table** %5
%64 = call i32 @wait_key_and_grab(i32 %62, %struct.eeprom_table* %63, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.19, i64 0, i64 0))
%65 = load i32, i32* %4
%66 = load %struct.eeprom_table*, %struct.eeprom_table** %5
%67 = call i32 @wait_key_and_grab(i32 %65, %struct.eeprom_table* %66, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.20, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
%struct.eeprom_table = type { i32 }
@.str.1 = [4 x i8] c"OFF\00"
@.str.2 = [2 x i8] c"0\00"
@.str.3 = [2 x i8] c"1\00"
@.str.4 = [2 x i8] c"2\00"
@.str.5 = [2 x i8] c"3\00"
@.str.6 = [2 x i8] c"4\00"
@.str.7 = [2 x i8] c"5\00"
@.str.8 = [2 x i8] c"6\00"
@.str.9 = [2 x i8] c"7\00"
@.str.10 = [2 x i8] c"8\00"
@.str.11 = [2 x i8] c"9\00"
@.str.12 = [7 x i8] c"VOL_UP\00"
@.str.13 = [9 x i8] c"VOL_DOWN\00"
@.str.14 = [5 x i8] c"MUTE\00"
@.str.15 = [5 x i8] c"MENU\00"
@.str.16 = [8 x i8] c"PROG_UP\00"
@.str.17 = [10 x i8] c"PROG_DOWN\00"
@.str.18 = [9 x i8] c"BACKWARD\00"
@.str.19 = [8 x i8] c"FORWARD\00"
@.str.20 = [3 x i8] c"OK\00"
@str = [61 x i8] c"\0AStage-2: \22panel_data_dump_mode\22 enabled. one-to-one keys...\00"
define void @second_stage(i32 %0, %struct.eeprom_table* %1, i32 %2) {
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 x i8]* @str, i64 0, i64 0))
%5 = tail call i32 @wait_key_and_grab(i32 %0, %struct.eeprom_table* %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%6 = tail call i32 @wait_key_and_grab(i32 %0, %struct.eeprom_table* %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%7 = tail call i32 @wait_key_and_grab(i32 %0, %struct.eeprom_table* %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%8 = tail call i32 @wait_key_and_grab(i32 %0, %struct.eeprom_table* %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%9 = tail call i32 @wait_key_and_grab(i32 %0, %struct.eeprom_table* %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%10 = tail call i32 @wait_key_and_grab(i32 %0, %struct.eeprom_table* %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%11 = tail call i32 @wait_key_and_grab(i32 %0, %struct.eeprom_table* %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%12 = tail call i32 @wait_key_and_grab(i32 %0, %struct.eeprom_table* %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
%13 = tail call i32 @wait_key_and_grab(i32 %0, %struct.eeprom_table* %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
%14 = tail call i32 @wait_key_and_grab(i32 %0, %struct.eeprom_table* %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0))
%15 = tail call i32 @wait_key_and_grab(i32 %0, %struct.eeprom_table* %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.11, i64 0, i64 0))
%16 = tail call i32 @wait_key_and_grab(i32 %0, %struct.eeprom_table* %1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.12, i64 0, i64 0))
%17 = tail call i32 @wait_key_and_grab(i32 %0, %struct.eeprom_table* %1, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.13, i64 0, i64 0))
%18 = tail call i32 @wait_key_and_grab(i32 %0, %struct.eeprom_table* %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.14, i64 0, i64 0))
%19 = tail call i32 @wait_key_and_grab(i32 %0, %struct.eeprom_table* %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.15, i64 0, i64 0))
%20 = tail call i32 @wait_key_and_grab(i32 %0, %struct.eeprom_table* %1, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.16, i64 0, i64 0))
%21 = tail call i32 @wait_key_and_grab(i32 %0, %struct.eeprom_table* %1, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.17, i64 0, i64 0))
%22 = tail call i32 @wait_key_and_grab(i32 %0, %struct.eeprom_table* %1, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.18, i64 0, i64 0))
%23 = tail call i32 @wait_key_and_grab(i32 %0, %struct.eeprom_table* %1, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.19, i64 0, i64 0))
%24 = tail call i32 @wait_key_and_grab(i32 %0, %struct.eeprom_table* %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.20, i64 0, i64 0))
ret void
}