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] && timer_args[2]) {
    ptr_buffer = gui_buffer_search_by_name(timer_args[0], timer_args[1]);
    if (!ptr_buffer)
      ptr_buffer = gui_buffer_search_main();
    if (ptr_buffer)
      input_data(ptr_buffer, timer_args[2]);
  }
  for (i = 0; i < 3; 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    1249 <command_wait_timer_cb+0x109>
mov    -0x20(%rbp),%rax
cmpq   $0x0,(%rax)
je     11f1 <command_wait_timer_cb+0xb1>
mov    -0x20(%rbp),%rax
cmpq   $0x0,0x8(%rax)
je     11f1 <command_wait_timer_cb+0xb1>
mov    -0x20(%rbp),%rax
cmpq   $0x0,0x10(%rax)
je     11f1 <command_wait_timer_cb+0xb1>
mov    -0x20(%rbp),%rax
mov    (%rax),%rdi
mov    -0x20(%rbp),%rax
mov    0x8(%rax),%rsi
mov    $0x0,%al
call   1040 <gui_buffer_search_by_name@plt>
cltq
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    11ce <command_wait_timer_cb+0x8e>
mov    $0x0,%al
call   1060 <gui_buffer_search_main@plt>
cltq
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
je     11ec <command_wait_timer_cb+0xac>
mov    -0x30(%rbp),%rdi
mov    -0x20(%rbp),%rax
mov    0x10(%rax),%rsi
mov    $0x0,%al
call   1050 <input_data@plt>
jmp    11f1 <command_wait_timer_cb+0xb1>
movl   $0x0,-0x24(%rbp)
cmpl   $0x3,-0x24(%rbp)
jge    1239 <command_wait_timer_cb+0xf9>
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     1226 <command_wait_timer_cb+0xe6>
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
jmp    122b <command_wait_timer_cb+0xeb>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11f8 <command_wait_timer_cb+0xb8>
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     11ba <command_wait_timer_cb+0x7a>
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%rdi
test   %rdi,%rdi
je     1192 <command_wait_timer_cb+0x52>
mov    0x8(%rbx),%rsi
test   %rsi,%rsi
je     1185 <command_wait_timer_cb+0x45>
cmpq   $0x0,0x10(%rbx)
je     1185 <command_wait_timer_cb+0x45>
xor    %eax,%eax
call   1040 <gui_buffer_search_by_name@plt>
test   %eax,%eax
jne    1177 <command_wait_timer_cb+0x37>
xor    %eax,%eax
call   1060 <gui_buffer_search_main@plt>
test   %eax,%eax
je     1185 <command_wait_timer_cb+0x45>
movslq %eax,%rdi
mov    0x10(%rbx),%rsi
xor    %eax,%eax
call   1050 <input_data@plt>
mov    (%rbx),%rdi
test   %rdi,%rdi
je     1192 <command_wait_timer_cb+0x52>
call   1030 <free@plt>
mov    0x8(%rbx),%rdi
test   %rdi,%rdi
je     11a0 <command_wait_timer_cb+0x60>
call   1030 <free@plt>
mov    0x10(%rbx),%rdi
test   %rdi,%rdi
je     11ae <command_wait_timer_cb+0x6e>
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 %80
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 %56
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 %56
25: ; preds = %20
%26 = load i8**, i8*** %6
%27 = getelementptr inbounds i8*, i8** %26, i64 2
%28 = load i8*, i8** %27
%29 = icmp ne i8* %28, null
br i1 %29, label %30, label %56
30: ; preds = %25
%31 = load i8**, i8*** %6
%32 = getelementptr inbounds i8*, i8** %31, i64 0
%33 = load i8*, i8** %32
%34 = load i8**, i8*** %6
%35 = getelementptr inbounds i8*, i8** %34, i64 1
%36 = load i8*, i8** %35
%37 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @gui_buffer_search_by_name to i32 (i8*, i8*, ...)*)(i8* %33, i8* %36)
%38 = sext i32 %37 to i64
%39 = inttoptr i64 %38 to %struct.t_gui_buffer*
store %struct.t_gui_buffer* %39, %struct.t_gui_buffer** %8
%40 = load %struct.t_gui_buffer*, %struct.t_gui_buffer** %8
%41 = icmp ne %struct.t_gui_buffer* %40, null
br i1 %41, label %46, label %42
42: ; preds = %30
%43 = call i32 (...) @gui_buffer_search_main()
%44 = sext i32 %43 to i64
%45 = inttoptr i64 %44 to %struct.t_gui_buffer*
store %struct.t_gui_buffer* %45, %struct.t_gui_buffer** %8
br label %46
46: ; preds = %42, %30
%47 = load %struct.t_gui_buffer*, %struct.t_gui_buffer** %8
%48 = icmp ne %struct.t_gui_buffer* %47, null
br i1 %48, label %49, label %55
49: ; preds = %46
%50 = load %struct.t_gui_buffer*, %struct.t_gui_buffer** %8
%51 = load i8**, i8*** %6
%52 = getelementptr inbounds i8*, i8** %51, i64 2
%53 = load i8*, i8** %52
%54 = call i32 (%struct.t_gui_buffer*, i8*, ...) bitcast (i32 (...)* @input_data to i32 (%struct.t_gui_buffer*, i8*, ...)*)(%struct.t_gui_buffer* %50, i8* %53)
br label %55
55: ; preds = %49, %46
br label %56
56: ; preds = %55, %25, %20, %15
store i32 0, i32* %7
br label %57
57: ; preds = %74, %56
%58 = load i32, i32* %7
%59 = icmp slt i32 %58, 3
br i1 %59, label %60, label %77
60: ; preds = %57
%61 = load i8**, i8*** %6
%62 = load i32, i32* %7
%63 = sext i32 %62 to i64
%64 = getelementptr inbounds i8*, i8** %61, i64 %63
%65 = load i8*, i8** %64
%66 = icmp ne i8* %65, null
br i1 %66, label %67, label %73
67: ; preds = %60
%68 = load i8**, i8*** %6
%69 = load i32, i32* %7
%70 = sext i32 %69 to i64
%71 = getelementptr inbounds i8*, i8** %68, i64 %70
%72 = load i8*, i8** %71
br label %73
73: ; preds = %67, %60
br label %74
74: ; preds = %73
%75 = load i32, i32* %7
%76 = add nsw i32 %75, 1
store i32 %76, i32* %7
br label %57
77: ; preds = %57
%78 = load i8**, i8*** %6
%79 = bitcast i8** %78 to i8*
store i32 0, i32* %3
br label %80
80: ; preds = %77, %14
%81 = load i32, i32* %3
ret i32 %81
}

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 %47, label %5
5: ; preds = %2
%6 = load i8*, i8** %3
%7 = icmp eq i8* %6, null
br i1 %7, label %34, 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 %30, label %13
13: ; preds = %8
%14 = getelementptr inbounds i8, i8* %0, i64 16
%15 = bitcast i8* %14 to i8**
%16 = load i8*, i8** %15
%17 = icmp eq i8* %16, null
br i1 %17, label %30, label %18
18: ; preds = %13
%19 = tail call i32 (i8*, i8*, ...) bitcast (i32 (...)* @gui_buffer_search_by_name to i32 (i8*, i8*, ...)*)(i8* %6, i8* %11)
%20 = icmp eq i32 %19, 0
br i1 %20, label %21, label %24
21: ; preds = %18
%22 = tail call i32 (...) @gui_buffer_search_main()
%23 = icmp eq i32 %22, 0
br i1 %23, label %30, label %24
24: ; preds = %18, %21
%25 = phi i32 [ %22, %21 ], [ %19, %18 ]
%26 = sext i32 %25 to i64
%27 = inttoptr i64 %26 to %struct.t_gui_buffer*
%28 = load i8*, i8** %15
%29 = tail call i32 (%struct.t_gui_buffer*, i8*, ...) bitcast (i32 (...)* @input_data to i32 (%struct.t_gui_buffer*, i8*, ...)*)(%struct.t_gui_buffer* %27, i8* %28)
br label %30
30: ; preds = %21, %24, %13, %8
%31 = load i8*, i8** %3
%32 = icmp eq i8* %31, null
br i1 %32, label %34, label %33
33: ; preds = %30
tail call void @free(i8* %31)
br label %34
34: ; preds = %5, %30, %33
%35 = getelementptr inbounds i8, i8* %0, i64 8
%36 = bitcast i8* %35 to i8**
%37 = load i8*, i8** %36
%38 = icmp eq i8* %37, null
br i1 %38, label %40, label %39
39: ; preds = %34
tail call void @free(i8* %37)
br label %40
40: ; preds = %39, %34
%41 = getelementptr inbounds i8, i8* %0, i64 16
%42 = bitcast i8* %41 to i8**
%43 = load i8*, i8** %42
%44 = icmp eq i8* %43, null
br i1 %44, label %46, label %45
45: ; preds = %40
tail call void @free(i8* %43)
br label %46
46: ; preds = %45, %40
tail call void @free(i8* %0)
br label %47
47: ; preds = %2, %46
%48 = phi i32 [ 0, %46 ], [ -1, %2 ]
ret i32 %48
}