#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 */
typedef int /*<<< orphan*/ cmd;

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ snprintf(char *, int, char *, char const *, char const *,
                            char const *);
scalar_t__ system(char *);
void ifconfig(const char *ifname, const char *src_addr, const char *dst_addr) {
  char cmd[1024];
  snprintf(cmd, sizeof(cmd),
           "ifconfig %s %s netmask 255.255.255.255 pointopoint %s", ifname,
           src_addr, dst_addr);
  if (0 > system(cmd)) {
    perror(cmd);
    exit(-1);
  }
}


x86 assembly (clang, -O0):
<ifconfig>:
push   %rbp
mov    %rsp,%rbp
sub    $0x420,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
lea    -0x420(%rbp),%rdi
mov    -0x8(%rbp),%rcx
mov    -0x10(%rbp),%r8
mov    -0x18(%rbp),%r9
mov    $0x400,%esi
lea    0xe8a(%rip),%rdx
call   1040 <snprintf@plt>
lea    -0x420(%rbp),%rdi
call   1030 <system@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
jle    11ab <ifconfig+0x6b>
lea    -0x420(%rbp),%rdi
call   1050 <perror@plt>
mov    $0xffffffff,%edi
call   1060 <exit@plt>
add    $0x420,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ifconfig>:
push   %rbx
sub    $0x400,%rsp
mov    %rdx,%r9
mov    %rsi,%r8
mov    %rdi,%rcx
lea    0xea8(%rip),%rdx
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x400,%esi
call   1040 <snprintf@plt>
mov    %rbx,%rdi
call   1030 <system@plt>
test   %rax,%rax
js     117e <ifconfig+0x3e>
add    $0x400,%rsp
pop    %rbx
ret
mov    %rsp,%rdi
call   1050 <perror@plt>
mov    $0xffffffff,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [54 x i8] c"ifconfig %s %s netmask 255.255.255.255 pointopoint %s\00"
define void @ifconfig(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca [1024 x i8]
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%8 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%9 = load i8*, i8** %4
%10 = load i8*, i8** %5
%11 = load i8*, i8** %6
%12 = call i32 @snprintf(i8* %8, i32 1024, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0), i8* %9, i8* %10, i8* %11)
%13 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%14 = call i64 @system(i8* %13)
%15 = icmp sgt i64 0, %14
br i1 %15, label %16, label %20
16: ; preds = %3
%17 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%18 = call i32 @perror(i8* %17)
%19 = call i32 @exit(i32 -1)
unreachable
20: ; preds = %3
ret void
}

LLVM IR (-O2):
@.str = [54 x i8] c"ifconfig %s %s netmask 255.255.255.255 pointopoint %s\00"
define void @ifconfig(i8* %0, i8* %1, i8* %2) {
%4 = alloca [1024 x i8]
%5 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%6 = call i32 @snprintf(i8* %5, i32 1024, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1, i8* %2)
%7 = call i64 @system(i8* %5)
%8 = icmp slt i64 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %3
%10 = call i32 @perror(i8* %5)
%11 = call i32 @exit(i32 -1)
unreachable
12: ; preds = %3
ret void
}