#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 depmod {
  int dummy;
};

/* Variables and functions */
int depmod_calculate_dependencies(struct depmod *);
int depmod_load_dependencies(struct depmod *);
int depmod_load_symbols(struct depmod *);
int depmod_load(struct depmod *depmod) {
  int err;
  err = depmod_load_symbols(depmod);
  if (err < 0)
    return err;
  err = depmod_load_dependencies(depmod);
  if (err < 0)
    return err;
  err = depmod_calculate_dependencies(depmod);
  if (err < 0)
    return err;
  return 0;
}


x86 assembly (clang, -O0):
<depmod_load>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <depmod_load_symbols@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    115d <depmod_load+0x2d>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11a6 <depmod_load+0x76>
mov    -0x10(%rbp),%rdi
call   1030 <depmod_load_dependencies@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    117e <depmod_load+0x4e>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11a6 <depmod_load+0x76>
mov    -0x10(%rbp),%rdi
call   1050 <depmod_calculate_dependencies@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    119f <depmod_load+0x6f>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11a6 <depmod_load+0x76>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<depmod_load>:
push   %rbx
mov    %rdi,%rbx
call   1040 <depmod_load_symbols@plt>
test   %eax,%eax
js     1158 <depmod_load+0x28>
mov    %rbx,%rdi
call   1030 <depmod_load_dependencies@plt>
test   %eax,%eax
js     1158 <depmod_load+0x28>
mov    %rbx,%rdi
call   1050 <depmod_calculate_dependencies@plt>
mov    %eax,%ecx
sar    $0x1f,%eax
and    %ecx,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.depmod = type { i32 }
define i32 @depmod_load(%struct.depmod* %0) {
%2 = alloca i32
%3 = alloca %struct.depmod*
%4 = alloca i32
store %struct.depmod* %0, %struct.depmod** %3
%5 = load %struct.depmod*, %struct.depmod** %3
%6 = call i32 @depmod_load_symbols(%struct.depmod* %5)
store i32 %6, i32* %4
%7 = load i32, i32* %4
%8 = icmp slt i32 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %1
%10 = load i32, i32* %4
store i32 %10, i32* %2
br label %26
11: ; preds = %1
%12 = load %struct.depmod*, %struct.depmod** %3
%13 = call i32 @depmod_load_dependencies(%struct.depmod* %12)
store i32 %13, i32* %4
%14 = load i32, i32* %4
%15 = icmp slt i32 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %11
%17 = load i32, i32* %4
store i32 %17, i32* %2
br label %26
18: ; preds = %11
%19 = load %struct.depmod*, %struct.depmod** %3
%20 = call i32 @depmod_calculate_dependencies(%struct.depmod* %19)
store i32 %20, i32* %4
%21 = load i32, i32* %4
%22 = icmp slt i32 %21, 0
br i1 %22, label %23, label %25
23: ; preds = %18
%24 = load i32, i32* %4
store i32 %24, i32* %2
br label %26
25: ; preds = %18
store i32 0, i32* %2
br label %26
26: ; preds = %25, %23, %16, %9
%27 = load i32, i32* %2
ret i32 %27
}

LLVM IR (-O2):
%struct.depmod = type { i32 }
define i32 @depmod_load(%struct.depmod* %0) {
%2 = tail call i32 @depmod_load_symbols(%struct.depmod* %0)
%3 = icmp slt i32 %2, 0
br i1 %3, label %11, label %4
4: ; preds = %1
%5 = tail call i32 @depmod_load_dependencies(%struct.depmod* %0)
%6 = icmp slt i32 %5, 0
br i1 %6, label %11, label %7
7: ; preds = %4
%8 = tail call i32 @depmod_calculate_dependencies(%struct.depmod* %0)
%9 = icmp slt i32 %8, 0
%10 = select i1 %9, i32 %8, i32 0
br label %11
11: ; preds = %7, %4, %1
%12 = phi i32 [ %2, %1 ], [ %5, %4 ], [ %10, %7 ]
ret i32 %12
}