#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 /*<<< orphan*/ _init_snmp();
int /*<<< orphan*/ ds_set_string(int /*<<< orphan*/, int, char const *);
int /*<<< orphan*/ init_callbacks();
int /*<<< orphan*/ init_mib();
int /*<<< orphan*/ init_snmp_alarm();
int /*<<< orphan*/ init_snmp_logging();
int /*<<< orphan*/ read_configs();
int /*<<< orphan*/ read_premib_configs();
int /*<<< orphan*/ register_default_handlers();
int /*<<< orphan*/ register_mib_handlers();
int /*<<< orphan*/ snmp_debug_init();
int /*<<< orphan*/ snmp_init_statistics();
void init_snmp(const char *type) {
  static int done_init = 0;
  if (done_init) {
    return;
  }
  done_init = 1;
  _init_snmp();
  snmp_debug_init();
  if (type != 0)
    ds_set_string(0, 6, type);
  init_callbacks();
  init_snmp_logging();
  snmp_init_statistics();
  register_mib_handlers();
  register_default_handlers();
  init_snmp_alarm();
  read_premib_configs();
  init_mib();
  read_configs();
}


x86 assembly (clang, -O0):
<init_snmp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpl   $0x0,0x2eb1(%rip)
je     11de <init_snmp+0x1e>
jmp    1250 <init_snmp+0x90>
movl   $0x1,0x2e9c(%rip)
mov    $0x0,%al
call   1040 <_init_snmp@plt>
mov    $0x0,%al
call   1050 <snmp_debug_init@plt>
cmpq   $0x0,-0x8(%rbp)
je     1211 <init_snmp+0x51>
mov    -0x8(%rbp),%rdx
xor    %edi,%edi
mov    $0x6,%esi
call   10b0 <ds_set_string@plt>
mov    $0x0,%al
call   1030 <init_callbacks@plt>
mov    $0x0,%al
call   10e0 <init_snmp_logging@plt>
mov    $0x0,%al
call   10c0 <snmp_init_statistics@plt>
mov    $0x0,%al
call   10d0 <register_mib_handlers@plt>
mov    $0x0,%al
call   1070 <register_default_handlers@plt>
mov    $0x0,%al
call   10a0 <init_snmp_alarm@plt>
mov    $0x0,%al
call   1060 <read_premib_configs@plt>
mov    $0x0,%al
call   1080 <init_mib@plt>
mov    $0x0,%al
call   1090 <read_configs@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_snmp>:
push   %rbx
cmpb   $0x0,0x2ebc(%rip)
je     11cc <init_snmp+0xc>
pop    %rbx
ret
mov    %rdi,%rbx
movb   $0x1,0x2eae(%rip)
xor    %eax,%eax
call   1040 <_init_snmp@plt>
xor    %eax,%eax
call   1050 <snmp_debug_init@plt>
test   %rbx,%rbx
je     11f8 <init_snmp+0x38>
xor    %edi,%edi
mov    $0x6,%esi
mov    %rbx,%rdx
call   10b0 <ds_set_string@plt>
xor    %eax,%eax
call   1030 <init_callbacks@plt>
xor    %eax,%eax
call   10e0 <init_snmp_logging@plt>
xor    %eax,%eax
call   10c0 <snmp_init_statistics@plt>
xor    %eax,%eax
call   10d0 <register_mib_handlers@plt>
xor    %eax,%eax
call   1070 <register_default_handlers@plt>
xor    %eax,%eax
call   10a0 <init_snmp_alarm@plt>
xor    %eax,%eax
call   1060 <read_premib_configs@plt>
xor    %eax,%eax
call   1080 <init_mib@plt>
xor    %eax,%eax
pop    %rbx
jmp    1090 <read_configs@plt>

LLVM IR (-O0):
@init_snmp.done_init = internal global i32 0
define void @init_snmp(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @init_snmp.done_init
%4 = icmp ne i32 %3, 0
br i1 %4, label %5, label %6
5: ; preds = %1
br label %24
6: ; preds = %1
store i32 1, i32* @init_snmp.done_init
%7 = call i32 (...) @_init_snmp()
%8 = call i32 (...) @snmp_debug_init()
%9 = load i8*, i8** %2
%10 = icmp ne i8* %9, null
br i1 %10, label %11, label %14
11: ; preds = %6
%12 = load i8*, i8** %2
%13 = call i32 @ds_set_string(i32 0, i32 6, i8* %12)
br label %14
14: ; preds = %11, %6
%15 = call i32 (...) @init_callbacks()
%16 = call i32 (...) @init_snmp_logging()
%17 = call i32 (...) @snmp_init_statistics()
%18 = call i32 (...) @register_mib_handlers()
%19 = call i32 (...) @register_default_handlers()
%20 = call i32 (...) @init_snmp_alarm()
%21 = call i32 (...) @read_premib_configs()
%22 = call i32 (...) @init_mib()
%23 = call i32 (...) @read_configs()
br label %24
24: ; preds = %14, %5
ret void
}

LLVM IR (-O2):
@init_snmp.done_init = internal unnamed_addr global i1 false
define void @init_snmp(i8* %0) {
%2 = load i1, i1* @init_snmp.done_init
br i1 %2, label %19, label %3
3: ; preds = %1
store i1 true, i1* @init_snmp.done_init
%4 = tail call i32 (...) @_init_snmp()
%5 = tail call i32 (...) @snmp_debug_init()
%6 = icmp eq i8* %0, null
br i1 %6, label %9, label %7
7: ; preds = %3
%8 = tail call i32 @ds_set_string(i32 0, i32 6, i8* %0)
br label %9
9: ; preds = %7, %3
%10 = tail call i32 (...) @init_callbacks()
%11 = tail call i32 (...) @init_snmp_logging()
%12 = tail call i32 (...) @snmp_init_statistics()
%13 = tail call i32 (...) @register_mib_handlers()
%14 = tail call i32 (...) @register_default_handlers()
%15 = tail call i32 (...) @init_snmp_alarm()
%16 = tail call i32 (...) @read_premib_configs()
%17 = tail call i32 (...) @init_mib()
%18 = tail call i32 (...) @read_configs()
br label %19
19: ; preds = %1, %9
ret void
}