int command_wait_timer_cb(void *data, int remaining_calls) {
  char **timer_args;
  int i;
  struct t_gui_buffer *ptr_buffer;
  (void)remaining_calls;
  timer_args = (char **)data;
  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    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    116e <command_wait_timer_cb+0x2e>
movl   $0xffffffff,-0x4(%rbp)
jmp    1232 <command_wait_timer_cb+0xf2>
mov    -0x20(%rbp),%rax
cmpq   $0x0,(%rax)
je     11da <command_wait_timer_cb+0x9a>
mov    -0x20(%rbp),%rax
cmpq   $0x0,0x8(%rax)
je     11da <command_wait_timer_cb+0x9a>
mov    -0x20(%rbp),%rax
mov    (%rax),%rdi
mov    $0x0,%al
call   1040 <gui_buffer_search_by_full_name@plt>
cltq
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    11b7 <command_wait_timer_cb+0x77>
mov    $0x0,%al
call   1060 <gui_buffer_search_main@plt>
cltq
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
je     11d5 <command_wait_timer_cb+0x95>
mov    -0x30(%rbp),%rdi
mov    -0x20(%rbp),%rax
mov    0x8(%rax),%rsi
mov    $0x0,%al
call   1050 <input_data@plt>
jmp    11da <command_wait_timer_cb+0x9a>
movl   $0x0,-0x24(%rbp)
cmpl   $0x2,-0x24(%rbp)
jge    1222 <command_wait_timer_cb+0xe2>
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     120f <command_wait_timer_cb+0xcf>
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
jmp    1214 <command_wait_timer_cb+0xd4>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11e1 <command_wait_timer_cb+0xa1>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%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, i32 %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8**
%7 = alloca i32
%8 = alloca %struct.t_gui_buffer*
store i8* %0, i8** %4
store i32 %1, i32* %5
%9 = load i32, i32* %5
%10 = load i8*, i8** %4
%11 = bitcast i8* %10 to i8**
store i8** %11, i8*** %6
%12 = load i8**, i8*** %6
%13 = icmp ne i8** %12, null
br i1 %13, label %15, label %14
14: ; preds = %2
store i32 -1, i32* %3
br label %72
15: ; preds = %2
%16 = load i8**, i8*** %6
%17 = getelementptr inbounds i8*, i8** %16, i64 0
%18 = load i8*, i8** %17
%19 = icmp ne i8* %18, null
br i1 %19, label %20, label %48
20: ; preds = %15
%21 = load i8**, i8*** %6
%22 = getelementptr inbounds i8*, i8** %21, i64 1
%23 = load i8*, i8** %22
%24 = icmp ne i8* %23, null
br i1 %24, label %25, label %48
25: ; preds = %20
%26 = load i8**, i8*** %6
%27 = getelementptr inbounds i8*, i8** %26, i64 0
%28 = load i8*, i8** %27
%29 = call i32 (i8*, ...) bitcast (i32 (...)* @gui_buffer_search_by_full_name to i32 (i8*, ...)*)(i8* %28)
%30 = sext i32 %29 to i64
%31 = inttoptr i64 %30 to %struct.t_gui_buffer*
store %struct.t_gui_buffer* %31, %struct.t_gui_buffer** %8
%32 = load %struct.t_gui_buffer*, %struct.t_gui_buffer** %8
%33 = icmp ne %struct.t_gui_buffer* %32, null
br i1 %33, label %38, label %34
34: ; preds = %25
%35 = call i32 (...) @gui_buffer_search_main()
%36 = sext i32 %35 to i64
%37 = inttoptr i64 %36 to %struct.t_gui_buffer*
store %struct.t_gui_buffer* %37, %struct.t_gui_buffer** %8
br label %38
38: ; preds = %34, %25
%39 = load %struct.t_gui_buffer*, %struct.t_gui_buffer** %8
%40 = icmp ne %struct.t_gui_buffer* %39, null
br i1 %40, label %41, label %47
41: ; preds = %38
%42 = load %struct.t_gui_buffer*, %struct.t_gui_buffer** %8
%43 = load i8**, i8*** %6
%44 = getelementptr inbounds i8*, i8** %43, i64 1
%45 = load i8*, i8** %44
%46 = call i32 (%struct.t_gui_buffer*, i8*, ...) bitcast (i32 (...)* @input_data to i32 (%struct.t_gui_buffer*, i8*, ...)*)(%struct.t_gui_buffer* %42, i8* %45)
br label %47
47: ; preds = %41, %38
br label %48
48: ; preds = %47, %20, %15
store i32 0, i32* %7
br label %49
49: ; preds = %66, %48
%50 = load i32, i32* %7
%51 = icmp slt i32 %50, 2
br i1 %51, label %52, label %69
52: ; preds = %49
%53 = load i8**, i8*** %6
%54 = load i32, i32* %7
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds i8*, i8** %53, i64 %55
%57 = load i8*, i8** %56
%58 = icmp ne i8* %57, null
br i1 %58, label %59, label %65
59: ; preds = %52
%60 = load i8**, i8*** %6
%61 = load i32, i32* %7
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds i8*, i8** %60, i64 %62
%64 = load i8*, i8** %63
br label %65
65: ; preds = %59, %52
br label %66
66: ; preds = %65
%67 = load i32, i32* %7
%68 = add nsw i32 %67, 1
store i32 %68, i32* %7
br label %49
69: ; preds = %49
%70 = load i8**, i8*** %6
%71 = bitcast i8** %70 to i8*
store i32 0, i32* %3
br label %72
72: ; preds = %69, %14
%73 = load i32, i32* %3
ret i32 %73
}

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