#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 */
typedef int /*<<< orphan*/ command;

/* Variables and functions */
int /*<<< orphan*/ get_di_camera_app_window_id();
int /*<<< orphan*/ input_inject(char *);
scalar_t__ is_new_nx_model();
int /*<<< orphan*/ snprintf(char *, int, char *, int /*<<< orphan*/);
void input_inject_keep_alive(void) {
  char command[256];
  if (is_new_nx_model()) {
    snprintf(command, sizeof(command), "key --window %lu XF86AudioRaiseVolume",
             get_di_camera_app_window_id());
  } else {
    snprintf(command, sizeof(command), "key --window %lu XF86Reload",
             get_di_camera_app_window_id());
  }
  input_inject(command);
}


x86 assembly (clang, -O0):
<input_inject_keep_alive>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
mov    $0x0,%al
call   1060 <is_new_nx_model@plt>
cmp    $0x0,%rax
je     1190 <input_inject_keep_alive+0x50>
lea    -0x100(%rbp),%rax
mov    %rax,-0x108(%rbp)
mov    $0x0,%al
call   1050 <get_di_camera_app_window_id@plt>
mov    -0x108(%rbp),%rdi
mov    %eax,%ecx
mov    $0x100,%esi
lea    0xe7a(%rip),%rdx
call   1040 <snprintf@plt>
jmp    11bf <input_inject_keep_alive+0x7f>
lea    -0x100(%rbp),%rax
mov    %rax,-0x110(%rbp)
mov    $0x0,%al
call   1050 <get_di_camera_app_window_id@plt>
mov    -0x110(%rbp),%rdi
mov    %eax,%ecx
mov    $0x100,%esi
lea    0xe6c(%rip),%rdx
call   1040 <snprintf@plt>
lea    -0x100(%rbp),%rdi
call   1030 <input_inject@plt>
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<input_inject_keep_alive>:
push   %rbx
sub    $0x100,%rsp
xor    %eax,%eax
call   1060 <is_new_nx_model@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1050 <get_di_camera_app_window_id@plt>
test   %rbx,%rbx
lea    0xec3(%rip),%rcx
lea    0xe96(%rip),%rdx
cmove  %rcx,%rdx
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x100,%esi
mov    %eax,%ecx
call   1040 <snprintf@plt>
mov    %rbx,%rdi
call   1030 <input_inject@plt>
add    $0x100,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [38 x i8] c"key --window %lu XF86AudioRaiseVolume\00"
@.str.1 = [28 x i8] c"key --window %lu XF86Reload\00"
define void @input_inject_keep_alive() {
%1 = alloca [256 x i8]
%2 = call i64 (...) @is_new_nx_model()
%3 = icmp ne i64 %2, 0
br i1 %3, label %4, label %8
4: ; preds = %0
%5 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%6 = call i32 (...) @get_di_camera_app_window_id()
%7 = call i32 @snprintf(i8* %5, i32 256, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i32 %6)
br label %12
8: ; preds = %0
%9 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%10 = call i32 (...) @get_di_camera_app_window_id()
%11 = call i32 @snprintf(i8* %9, i32 256, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i32 %10)
br label %12
12: ; preds = %8, %4
%13 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%14 = call i32 @input_inject(i8* %13)
ret void
}

LLVM IR (-O2):
@.str = [38 x i8] c"key --window %lu XF86AudioRaiseVolume\00"
@.str.1 = [28 x i8] c"key --window %lu XF86Reload\00"
define void @input_inject_keep_alive() {
%1 = alloca [256 x i8]
%2 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%3 = tail call i64 (...) @is_new_nx_model()
%4 = icmp eq i64 %3, 0
%5 = tail call i32 (...) @get_di_camera_app_window_id()
%6 = select i1 %4, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0)
%7 = call i32 @snprintf(i8* %2, i32 256, i8* %6, i32 %5)
%8 = call i32 @input_inject(i8* %2)
ret void
}