#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 flowmon_init();
int /*<<< orphan*/ pna_cleanup();
int /*<<< orphan*/ pna_dtrie_init();
int /*<<< orphan*/ printf(char *);
scalar_t__ rtmon_init();
int pna_init(void) {
  int i;
  int ret = 0;
  if ((ret = flowmon_init()) < 0)
    return ret;
  pna_dtrie_init();
  if (rtmon_init() < 0) {
    pna_cleanup();
    return -1;
  }
  printf("pna: capturing is available\n");
  return ret;
}


x86 assembly (clang, -O0):
<pna_init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0xc(%rbp)
mov    $0x0,%al
call   1030 <flowmon_init@plt>
mov    %eax,-0xc(%rbp)
cmp    $0x0,%eax
jge    117d <pna_init+0x2d>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11ba <pna_init+0x6a>
mov    $0x0,%al
call   1070 <pna_dtrie_init@plt>
mov    $0x0,%al
call   1050 <rtmon_init@plt>
cmp    $0x0,%rax
jge    11a8 <pna_init+0x58>
mov    $0x0,%al
call   1060 <pna_cleanup@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    11ba <pna_init+0x6a>
lea    0xe51(%rip),%rdi
call   1040 <printf@plt>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pna_init>:
push   %rbx
xor    %eax,%eax
call   1040 <flowmon_init@plt>
mov    %eax,%ebx
test   %eax,%eax
js     118b <pna_init+0x3b>
xor    %eax,%eax
call   1070 <pna_dtrie_init@plt>
xor    %eax,%eax
call   1050 <rtmon_init@plt>
test   %rax,%rax
js     117f <pna_init+0x2f>
lea    0xe88(%rip),%rdi
call   1030 <puts@plt>
jmp    118b <pna_init+0x3b>
xor    %eax,%eax
call   1060 <pna_cleanup@plt>
mov    $0xffffffff,%ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [29 x i8] c"pna: capturing is available\0A\00"
define i32 @pna_init() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %3
%4 = call i32 (...) @flowmon_init()
store i32 %4, i32* %3
%5 = icmp slt i32 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = load i32, i32* %3
store i32 %7, i32* %1
br label %17
8: ; preds = %0
%9 = call i32 (...) @pna_dtrie_init()
%10 = call i64 (...) @rtmon_init()
%11 = icmp slt i64 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %8
%13 = call i32 (...) @pna_cleanup()
store i32 -1, i32* %1
br label %17
14: ; preds = %8
%15 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%16 = load i32, i32* %3
store i32 %16, i32* %1
br label %17
17: ; preds = %14, %12, %6
%18 = load i32, i32* %1
ret i32 %18
}

LLVM IR (-O2):
@str = [28 x i8] c"pna: capturing is available\00"
define i32 @pna_init() {
%1 = tail call i32 (...) @flowmon_init()
%2 = icmp slt i32 %1, 0
br i1 %2, label %11, label %3
3: ; preds = %0
%4 = tail call i32 (...) @pna_dtrie_init()
%5 = tail call i64 (...) @rtmon_init()
%6 = icmp slt i64 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %3
%8 = tail call i32 (...) @pna_cleanup()
br label %11
9: ; preds = %3
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str, i64 0, i64 0))
br label %11
11: ; preds = %0, %9, %7
%12 = phi i32 [ -1, %7 ], [ %1, %9 ], [ %1, %0 ]
ret i32 %12
}