#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 */

/* Variables and functions */
int sol_http_client_init();
int sol_http_server_init();
int sol_netctl_init();
int sol_network_init();
int /*<<< orphan*/ sol_network_shutdown();
int sol_comms_init(void) {
  int ret;
  ret = sol_network_init();
  if (ret != 0)
    return -1;
  ret = sol_http_client_init();
  if (ret != 0)
    goto http_client_error;
  ret = sol_http_server_init();
  if (ret != 0)
    goto http_server_error;
  ret = sol_netctl_init();
  if (ret != 0)
    goto netctl_error;
  return 0;
netctl_error:
http_server_error:
  sol_http_client_init();
http_client_error:
  sol_network_shutdown();
  return -1;
}


x86 assembly (clang, -O0):
<sol_comms_init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1070 <sol_network_init@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1178 <sol_comms_init+0x28>
movl   $0xffffffff,-0x4(%rbp)
jmp    11e9 <sol_comms_init+0x99>
mov    $0x0,%al
call   1040 <sol_http_client_init@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1191 <sol_comms_init+0x41>
jmp    11db <sol_comms_init+0x8b>
mov    $0x0,%al
call   1030 <sol_http_server_init@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     11aa <sol_comms_init+0x5a>
jmp    11d4 <sol_comms_init+0x84>
mov    $0x0,%al
call   1060 <sol_netctl_init@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     11c3 <sol_comms_init+0x73>
jmp    11cf <sol_comms_init+0x7f>
movl   $0x0,-0x4(%rbp)
jmp    11e9 <sol_comms_init+0x99>
jmp    11d4 <sol_comms_init+0x84>
mov    $0x0,%al
call   1040 <sol_http_client_init@plt>
mov    $0x0,%al
call   1050 <sol_network_shutdown@plt>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sol_comms_init>:
push   %rbx
xor    %eax,%eax
call   1070 <sol_network_init@plt>
mov    $0xffffffff,%ebx
test   %eax,%eax
jne    1197 <sol_comms_init+0x47>
xor    %eax,%eax
call   1040 <sol_http_client_init@plt>
test   %eax,%eax
jne    118b <sol_comms_init+0x3b>
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <sol_http_server_init@plt>
test   %eax,%eax
jne    1184 <sol_comms_init+0x34>
xor    %eax,%eax
call   1060 <sol_netctl_init@plt>
test   %eax,%eax
je     1197 <sol_comms_init+0x47>
xor    %eax,%eax
call   1040 <sol_http_client_init@plt>
xor    %eax,%eax
call   1050 <sol_network_shutdown@plt>
mov    $0xffffffff,%ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @sol_comms_init() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 (...) @sol_network_init()
store i32 %3, i32* %2
%4 = load i32, i32* %2
%5 = icmp ne i32 %4, 0
br i1 %5, label %6, label %7
6: ; preds = %0
store i32 -1, i32* %1
br label %28
7: ; preds = %0
%8 = call i32 (...) @sol_http_client_init()
store i32 %8, i32* %2
%9 = load i32, i32* %2
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %7
br label %26
12: ; preds = %7
%13 = call i32 (...) @sol_http_server_init()
store i32 %13, i32* %2
%14 = load i32, i32* %2
%15 = icmp ne i32 %14, 0
br i1 %15, label %16, label %17
16: ; preds = %12
br label %24
17: ; preds = %12
%18 = call i32 (...) @sol_netctl_init()
store i32 %18, i32* %2
%19 = load i32, i32* %2
%20 = icmp ne i32 %19, 0
br i1 %20, label %21, label %22
21: ; preds = %17
br label %23
22: ; preds = %17
store i32 0, i32* %1
br label %28
23: ; preds = %21
br label %24
24: ; preds = %23, %16
%25 = call i32 (...) @sol_http_client_init()
br label %26
26: ; preds = %24, %11
%27 = call i32 (...) @sol_network_shutdown()
store i32 -1, i32* %1
br label %28
28: ; preds = %26, %22, %6
%29 = load i32, i32* %1
ret i32 %29
}

LLVM IR (-O2):
define i32 @sol_comms_init() {
%1 = tail call i32 (...) @sol_network_init()
%2 = icmp eq i32 %1, 0
br i1 %2, label %3, label %16
3: ; preds = %0
%4 = tail call i32 (...) @sol_http_client_init()
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %14
6: ; preds = %3
%7 = tail call i32 (...) @sol_http_server_init()
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %6
%10 = tail call i32 (...) @sol_netctl_init()
%11 = icmp eq i32 %10, 0
br i1 %11, label %16, label %12
12: ; preds = %9, %6
%13 = tail call i32 (...) @sol_http_client_init()
br label %14
14: ; preds = %3, %12
%15 = tail call i32 (...) @sol_network_shutdown()
br label %16
16: ; preds = %9, %0, %14
%17 = phi i32 [ -1, %14 ], [ -1, %0 ], [ 0, %9 ]
ret i32 %17
}