#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*/ TIPC_CMD_GET_NETID;
int /*<<< orphan*/ TIPC_CMD_SET_NETID;
int do_get_unsigned(int /*<<< orphan*/);
int /*<<< orphan*/ do_set_unsigned(char *, int /*<<< orphan*/, char *, char *);
char *for_dest();
int /*<<< orphan*/ printf(char *, char *, int);
void set_netid(char *args) {
  if (!*args)
    printf("current network id%s: %u\n", for_dest(),
           do_get_unsigned(TIPC_CMD_GET_NETID));
  else
    do_set_unsigned(args, TIPC_CMD_SET_NETID, "network identity",
                    " (this will reset all links)");
}


x86 assembly (clang, -O0):
<set_netid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
jne    1189 <set_netid+0x49>
mov    $0x0,%al
call   1040 <for_dest@plt>
mov    %rax,-0x10(%rbp)
mov    0x2e8d(%rip),%rax
mov    (%rax),%edi
call   1060 <do_get_unsigned@plt>
mov    -0x10(%rbp),%rsi
mov    %eax,%edx
lea    0xe81(%rip),%rdi
call   1030 <printf@plt>
jmp    11a9 <set_netid+0x69>
mov    -0x8(%rbp),%rdi
mov    0x2e44(%rip),%rax
mov    (%rax),%esi
lea    0xe7d(%rip),%rdx
lea    0xe87(%rip),%rcx
call   1050 <do_set_unsigned@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_netid>:
push   %rbx
cmpb   $0x0,(%rdi)
je     1163 <set_netid+0x23>
mov    0x2e8b(%rip),%rax
mov    (%rax),%esi
lea    0xec4(%rip),%rdx
lea    0xece(%rip),%rcx
pop    %rbx
jmp    1050 <do_set_unsigned@plt>
xor    %eax,%eax
call   1040 <for_dest@plt>
mov    %rax,%rbx
mov    0x2e84(%rip),%rax
mov    (%rax),%edi
call   1060 <do_get_unsigned@plt>
lea    0xe7e(%rip),%rdi
mov    %rbx,%rsi
mov    %eax,%edx
pop    %rbx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [26 x i8] c"current network id%s: %u\0A\00"
@TIPC_CMD_GET_NETID = global i32 0
@TIPC_CMD_SET_NETID = global i32 0
@.str.1 = [17 x i8] c"network identity\00"
@.str.2 = [29 x i8] c" (this will reset all links)\00"
define void @set_netid(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8, i8* %3
%5 = icmp ne i8 %4, 0
br i1 %5, label %11, label %6
6: ; preds = %1
%7 = call i8* (...) @for_dest()
%8 = load i32, i32* @TIPC_CMD_GET_NETID
%9 = call i32 @do_get_unsigned(i32 %8)
%10 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* %7, i32 %9)
br label %15
11: ; preds = %1
%12 = load i8*, i8** %2
%13 = load i32, i32* @TIPC_CMD_SET_NETID
%14 = call i32 @do_set_unsigned(i8* %12, i32 %13, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
br label %15
15: ; preds = %11, %6
ret void
}

LLVM IR (-O2):
@.str = [26 x i8] c"current network id%s: %u\0A\00"
@TIPC_CMD_GET_NETID = global i32 0
@TIPC_CMD_SET_NETID = global i32 0
@.str.1 = [17 x i8] c"network identity\00"
@.str.2 = [29 x i8] c" (this will reset all links)\00"
define void @set_netid(i8* %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %4, label %9
4: ; preds = %1
%5 = tail call i8* (...) @for_dest()
%6 = load i32, i32* @TIPC_CMD_GET_NETID
%7 = tail call i32 @do_get_unsigned(i32 %6)
%8 = tail call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* %5, i32 %7)
br label %12
9: ; preds = %1
%10 = load i32, i32* @TIPC_CMD_SET_NETID
%11 = tail call i32 @do_set_unsigned(i8* %0, i32 %10, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
br label %12
12: ; preds = %9, %4
ret void
}