#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 list_item {
  int dummy;
};
struct list {
  int dummy;
};
struct graph_node {
  int dummy;
};
struct graph {
  int dummy;
};

/* Variables and functions */
struct list *graph_get_nodes(struct graph *);
struct graph_node *list_get_data(struct list_item *);
struct list_item *list_head(struct list *);
struct list_item *list_next(struct list_item *);
scalar_t__ update_file_info(struct graph_node *);
int update_all_files_info(struct graph *graph) {
  struct list *nodes = graph_get_nodes(graph);
  struct list_item *item = list_head(nodes);
  while (item != NULL) {
    struct graph_node *node = list_get_data(item);
    if (update_file_info(node)) {
      return (-1);
    }
    item = list_next(item);
  }
  return (0);
}


x86 assembly (clang, -O0):
<update_all_files_info>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1070 <graph_get_nodes@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1060 <list_head@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     11bf <update_all_files_info+0x6f>
mov    -0x20(%rbp),%rdi
call   1040 <list_get_data@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
call   1030 <update_file_info@plt>
cmp    $0x0,%rax
je     11ad <update_all_files_info+0x5d>
movl   $0xffffffff,-0x4(%rbp)
jmp    11c6 <update_all_files_info+0x76>
mov    -0x20(%rbp),%rdi
call   1050 <list_next@plt>
mov    %rax,-0x20(%rbp)
jmp    1176 <update_all_files_info+0x26>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<update_all_files_info>:
push   %rbp
push   %rbx
push   %rax
call   1070 <graph_get_nodes@plt>
mov    %rax,%rdi
call   1060 <list_head@plt>
xor    %ebp,%ebp
test   %rax,%rax
je     119c <update_all_files_info+0x4c>
mov    %rax,%rbx
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1040 <list_get_data@plt>
mov    %rax,%rdi
call   1030 <update_file_info@plt>
test   %rax,%rax
jne    1197 <update_all_files_info+0x47>
mov    %rbx,%rdi
call   1050 <list_next@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1170 <update_all_files_info+0x20>
jmp    119c <update_all_files_info+0x4c>
mov    $0xffffffff,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.graph = type { i32 }
%struct.list = type { i32 }
%struct.list_item = type { i32 }
%struct.graph_node = type { i32 }
define i32 @update_all_files_info(%struct.graph* %0) {
%2 = alloca i32
%3 = alloca %struct.graph*
%4 = alloca %struct.list*
%5 = alloca %struct.list_item*
%6 = alloca %struct.graph_node*
store %struct.graph* %0, %struct.graph** %3
%7 = load %struct.graph*, %struct.graph** %3
%8 = call %struct.list* @graph_get_nodes(%struct.graph* %7)
store %struct.list* %8, %struct.list** %4
%9 = load %struct.list*, %struct.list** %4
%10 = call %struct.list_item* @list_head(%struct.list* %9)
store %struct.list_item* %10, %struct.list_item** %5
br label %11
11: ; preds = %21, %1
%12 = load %struct.list_item*, %struct.list_item** %5
%13 = icmp ne %struct.list_item* %12, null
br i1 %13, label %14, label %24
14: ; preds = %11
%15 = load %struct.list_item*, %struct.list_item** %5
%16 = call %struct.graph_node* @list_get_data(%struct.list_item* %15)
store %struct.graph_node* %16, %struct.graph_node** %6
%17 = load %struct.graph_node*, %struct.graph_node** %6
%18 = call i64 @update_file_info(%struct.graph_node* %17)
%19 = icmp ne i64 %18, 0
br i1 %19, label %20, label %21
20: ; preds = %14
store i32 -1, i32* %2
br label %25
21: ; preds = %14
%22 = load %struct.list_item*, %struct.list_item** %5
%23 = call %struct.list_item* @list_next(%struct.list_item* %22)
store %struct.list_item* %23, %struct.list_item** %5
br label %11
24: ; preds = %11
store i32 0, i32* %2
br label %25
25: ; preds = %24, %20
%26 = load i32, i32* %2
ret i32 %26
}

LLVM IR (-O2):
%struct.graph = type { i32 }
%struct.list = type { i32 }
%struct.list_item = type { i32 }
%struct.graph_node = type { i32 }
define i32 @update_all_files_info(%struct.graph* %0) {
%2 = tail call %struct.list* @graph_get_nodes(%struct.graph* %0)
%3 = tail call %struct.list_item* @list_head(%struct.list* %2)
%4 = icmp eq %struct.list_item* %3, null
br i1 %4, label %13, label %5
5: ; preds = %1, %10
%6 = phi %struct.list_item* [ %11, %10 ], [ %3, %1 ]
%7 = tail call %struct.graph_node* @list_get_data(%struct.list_item* %6)
%8 = tail call i64 @update_file_info(%struct.graph_node* %7)
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %13
10: ; preds = %5
%11 = tail call %struct.list_item* @list_next(%struct.list_item* %6)
%12 = icmp eq %struct.list_item* %11, null
br i1 %12, label %13, label %5
13: ; preds = %10, %5, %1
%14 = phi i32 [ 0, %1 ], [ -1, %5 ], [ 0, %10 ]
ret i32 %14
}