int command_wait_timer_cb(const void *pointer, void *data,
                          int remaining_calls) {
  char **timer_args;
  int i;
  struct t_gui_buffer *ptr_buffer;
  (void)data;
  (void)remaining_calls;
  timer_args = (char **)pointer;
  if (!timer_args)
    return -1;
  if (timer_args[0] && timer_args[1]) {
    ptr_buffer = gui_buffer_search_by_full_name(timer_args[0]);
    if (!ptr_buffer)
      ptr_buffer = gui_buffer_search_main();
    if (ptr_buffer)
      (void)input_data(ptr_buffer, timer_args[1]);
  }
  for (i = 0; i < 2; i++) {
    if (timer_args[i])
      free(timer_args[i]);
  }
  free(timer_args);
  return 0;
}


x86 assembly (clang, -O0):
<command_wait_timer_cb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    1172 <command_wait_timer_cb+0x32>
movl   $0xffffffff,-0x4(%rbp)
jmp    1236 <command_wait_timer_cb+0xf6>
mov    -0x28(%rbp),%rax
cmpq   $0x0,(%rax)
je     11de <command_wait_timer_cb+0x9e>
mov    -0x28(%rbp),%rax
cmpq   $0x0,0x8(%rax)
je     11de <command_wait_timer_cb+0x9e>
mov    -0x28(%rbp),%rax
mov    (%rax),%rdi
mov    $0x0,%al
call   1040 <gui_buffer_search_by_full_name@plt>
cltq
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x38(%rbp)
jne    11bb <command_wait_timer_cb+0x7b>
mov    $0x0,%al
call   1060 <gui_buffer_search_main@plt>
cltq
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x38(%rbp)
je     11d9 <command_wait_timer_cb+0x99>
mov    -0x38(%rbp),%rdi
mov    -0x28(%rbp),%rax
mov    0x8(%rax),%rsi
mov    $0x0,%al
call   1050 <input_data@plt>
jmp    11de <command_wait_timer_cb+0x9e>
movl   $0x0,-0x2c(%rbp)
cmpl   $0x2,-0x2c(%rbp)
jge    1226 <command_wait_timer_cb+0xe6>
mov    -0x28(%rbp),%rax
movslq -0x2c(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     1213 <command_wait_timer_cb+0xd3>
mov    -0x28(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
jmp    1218 <command_wait_timer_cb+0xd8>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    11e5 <command_wait_timer_cb+0xa5>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<command_wait_timer_cb>:
test   %rdi,%rdi
je     11a3 <command_wait_timer_cb+0x63>
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%rdi
test   %rdi,%rdi
je     1189 <command_wait_timer_cb+0x49>
cmpq   $0x0,0x8(%rbx)
je     117c <command_wait_timer_cb+0x3c>
xor    %eax,%eax
call   1040 <gui_buffer_search_by_full_name@plt>
test   %eax,%eax
jne    116e <command_wait_timer_cb+0x2e>
xor    %eax,%eax
call   1060 <gui_buffer_search_main@plt>
test   %eax,%eax
je     117c <command_wait_timer_cb+0x3c>
movslq %eax,%rdi
mov    0x8(%rbx),%rsi
xor    %eax,%eax
call   1050 <input_data@plt>
mov    (%rbx),%rdi
test   %rdi,%rdi
je     1189 <command_wait_timer_cb+0x49>
call   1030 <free@plt>
mov    0x8(%rbx),%rdi
test   %rdi,%rdi
je     1197 <command_wait_timer_cb+0x57>
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
pop    %rbx
ret
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
%struct.t_gui_buffer = type opaque
define i32 @command_wait_timer_cb(i8* %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i8**
%9 = alloca i32
%10 = alloca %struct.t_gui_buffer*
store i8* %0, i8** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
%11 = load i8*, i8** %6
%12 = load i32, i32* %7
%13 = load i8*, i8** %5
%14 = bitcast i8* %13 to i8**
store i8** %14, i8*** %8
%15 = load i8**, i8*** %8
%16 = icmp ne i8** %15, null
br i1 %16, label %18, label %17
17: ; preds = %3
store i32 -1, i32* %4
br label %75
18: ; preds = %3
%19 = load i8**, i8*** %8
%20 = getelementptr inbounds i8*, i8** %19, i64 0
%21 = load i8*, i8** %20
%22 = icmp ne i8* %21, null
br i1 %22, label %23, label %51
23: ; preds = %18
%24 = load i8**, i8*** %8
%25 = getelementptr inbounds i8*, i8** %24, i64 1
%26 = load i8*, i8** %25
%27 = icmp ne i8* %26, null
br i1 %27, label %28, label %51
28: ; preds = %23
%29 = load i8**, i8*** %8
%30 = getelementptr inbounds i8*, i8** %29, i64 0
%31 = load i8*, i8** %30
%32 = call i32 (i8*, ...) bitcast (i32 (...)* @gui_buffer_search_by_full_name to i32 (i8*, ...)*)(i8* %31)
%33 = sext i32 %32 to i64
%34 = inttoptr i64 %33 to %struct.t_gui_buffer*
store %struct.t_gui_buffer* %34, %struct.t_gui_buffer** %10
%35 = load %struct.t_gui_buffer*, %struct.t_gui_buffer** %10
%36 = icmp ne %struct.t_gui_buffer* %35, null
br i1 %36, label %41, label %37
37: ; preds = %28
%38 = call i32 (...) @gui_buffer_search_main()
%39 = sext i32 %38 to i64
%40 = inttoptr i64 %39 to %struct.t_gui_buffer*
store %struct.t_gui_buffer* %40, %struct.t_gui_buffer** %10
br label %41
41: ; preds = %37, %28
%42 = load %struct.t_gui_buffer*, %struct.t_gui_buffer** %10
%43 = icmp ne %struct.t_gui_buffer* %42, null
br i1 %43, label %44, label %50
44: ; preds = %41
%45 = load %struct.t_gui_buffer*, %struct.t_gui_buffer** %10
%46 = load i8**, i8*** %8
%47 = getelementptr inbounds i8*, i8** %46, i64 1
%48 = load i8*, i8** %47
%49 = call i32 (%struct.t_gui_buffer*, i8*, ...) bitcast (i32 (...)* @input_data to i32 (%struct.t_gui_buffer*, i8*, ...)*)(%struct.t_gui_buffer* %45, i8* %48)
br label %50
50: ; preds = %44, %41
br label %51
51: ; preds = %50, %23, %18
store i32 0, i32* %9
br label %52
52: ; preds = %69, %51
%53 = load i32, i32* %9
%54 = icmp slt i32 %53, 2
br i1 %54, label %55, label %72
55: ; preds = %52
%56 = load i8**, i8*** %8
%57 = load i32, i32* %9
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds i8*, i8** %56, i64 %58
%60 = load i8*, i8** %59
%61 = icmp ne i8* %60, null
br i1 %61, label %62, label %68
62: ; preds = %55
%63 = load i8**, i8*** %8
%64 = load i32, i32* %9
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds i8*, i8** %63, i64 %65
%67 = load i8*, i8** %66
br label %68
68: ; preds = %62, %55
br label %69
69: ; preds = %68
%70 = load i32, i32* %9
%71 = add nsw i32 %70, 1
store i32 %71, i32* %9
br label %52
72: ; preds = %52
%73 = load i8**, i8*** %8
%74 = bitcast i8** %73 to i8*
store i32 0, i32* %4
br label %75
75: ; preds = %72, %17
%76 = load i32, i32* %4
ret i32 %76
}

LLVM IR (-O2):
%struct.t_gui_buffer = type opaque
define i32 @command_wait_timer_cb(i8* %0, i8* nocapture readnone %1, i32 %2) {
%4 = bitcast i8* %0 to i8**
%5 = icmp eq i8* %0, null
br i1 %5, label %37, label %6
6: ; preds = %3
%7 = load i8*, i8** %4
%8 = icmp eq i8* %7, null
br i1 %8, label %30, label %9
9: ; preds = %6
%10 = getelementptr inbounds i8, i8* %0, i64 8
%11 = bitcast i8* %10 to i8**
%12 = load i8*, i8** %11
%13 = icmp eq i8* %12, null
br i1 %13, label %26, label %14
14: ; preds = %9
%15 = tail call i32 (i8*, ...) bitcast (i32 (...)* @gui_buffer_search_by_full_name to i32 (i8*, ...)*)(i8* %7)
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %20
17: ; preds = %14
%18 = tail call i32 (...) @gui_buffer_search_main()
%19 = icmp eq i32 %18, 0
br i1 %19, label %26, label %20
20: ; preds = %14, %17
%21 = phi i32 [ %18, %17 ], [ %15, %14 ]
%22 = sext i32 %21 to i64
%23 = inttoptr i64 %22 to %struct.t_gui_buffer*
%24 = load i8*, i8** %11
%25 = tail call i32 (%struct.t_gui_buffer*, i8*, ...) bitcast (i32 (...)* @input_data to i32 (%struct.t_gui_buffer*, i8*, ...)*)(%struct.t_gui_buffer* %23, i8* %24)
br label %26
26: ; preds = %17, %20, %9
%27 = load i8*, i8** %4
%28 = icmp eq i8* %27, null
br i1 %28, label %30, label %29
29: ; preds = %26
tail call void @free(i8* %27)
br label %30
30: ; preds = %6, %26, %29
%31 = getelementptr inbounds i8, i8* %0, i64 8
%32 = bitcast i8* %31 to i8**
%33 = load i8*, i8** %32
%34 = icmp eq i8* %33, null
br i1 %34, label %36, label %35
35: ; preds = %30
tail call void @free(i8* %33)
br label %36
36: ; preds = %35, %30
tail call void @free(i8* %0)
br label %37
37: ; preds = %3, %36
%38 = phi i32 [ 0, %36 ], [ -1, %3 ]
ret i32 %38
}