#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 */
struct output {
  int dummy;
};

/* Variables and functions */
scalar_t__ do_exec(char **, int, struct output *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ no_route_and_arp(char *, char *, char *, struct output *);
int /*<<< orphan*/ write_output(int, struct output *);
void slip_down(char *dev, char *remote_addr, char *netmask,
               struct output *output) {
  char *down_argv[] = {"ifconfig", dev, "0.0.0.0", "down", NULL};
  if (remote_addr != NULL)
    no_route_and_arp(dev, remote_addr, netmask, output);
  if (do_exec(down_argv, 1, output)) {
    write_output(1, output);
    exit(1);
  }
}


x86 assembly (clang, -O0):
<slip_down>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
lea    0xea1(%rip),%rax
mov    %rax,-0x50(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x48(%rbp)
lea    0xe97(%rip),%rax
mov    %rax,-0x40(%rbp)
lea    0xe94(%rip),%rax
mov    %rax,-0x38(%rbp)
movq   $0x0,-0x30(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     11a9 <slip_down+0x69>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
call   1050 <no_route_and_arp@plt>
lea    -0x50(%rbp),%rdi
mov    -0x20(%rbp),%rdx
mov    $0x1,%esi
call   1040 <do_exec@plt>
cmp    $0x0,%rax
je     11dd <slip_down+0x9d>
mov    -0x20(%rbp),%rsi
mov    $0x1,%edi
call   1030 <write_output@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<slip_down>:
push   %rbx
sub    $0x30,%rsp
mov    %rcx,%rbx
lea    0xeb1(%rip),%rax
mov    %rax,(%rsp)
mov    %rdi,0x8(%rsp)
lea    0xeaa(%rip),%rax
mov    %rax,0x10(%rsp)
lea    0xea6(%rip),%rax
mov    %rax,0x18(%rsp)
movq   $0x0,0x20(%rsp)
test   %rsi,%rsi
je     1186 <slip_down+0x46>
mov    %rbx,%rcx
call   1050 <no_route_and_arp@plt>
mov    %rsp,%rdi
mov    $0x1,%esi
mov    %rbx,%rdx
call   1040 <do_exec@plt>
test   %rax,%rax
jne    11a1 <slip_down+0x61>
add    $0x30,%rsp
pop    %rbx
ret
mov    $0x1,%edi
mov    %rbx,%rsi
call   1030 <write_output@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
%struct.output = type { i32 }
@.str = [9 x i8] c"ifconfig\00"
@.str.1 = [8 x i8] c"0.0.0.0\00"
@.str.2 = [5 x i8] c"down\00"
define void @slip_down(i8* %0, i8* %1, i8* %2, %struct.output* %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca %struct.output*
%9 = alloca [5 x i8*]
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store %struct.output* %3, %struct.output** %8
%10 = getelementptr inbounds [5 x i8*], [5 x i8*]* %9, i64 0, i64 0
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8** %10
%11 = getelementptr inbounds i8*, i8** %10, i64 1
%12 = load i8*, i8** %5
store i8* %12, i8** %11
%13 = getelementptr inbounds i8*, i8** %11, i64 1
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8** %13
%14 = getelementptr inbounds i8*, i8** %13, i64 1
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8** %14
%15 = getelementptr inbounds i8*, i8** %14, i64 1
store i8* null, i8** %15
%16 = load i8*, i8** %6
%17 = icmp ne i8* %16, null
br i1 %17, label %18, label %24
18: ; preds = %4
%19 = load i8*, i8** %5
%20 = load i8*, i8** %6
%21 = load i8*, i8** %7
%22 = load %struct.output*, %struct.output** %8
%23 = call i32 @no_route_and_arp(i8* %19, i8* %20, i8* %21, %struct.output* %22)
br label %24
24: ; preds = %18, %4
%25 = getelementptr inbounds [5 x i8*], [5 x i8*]* %9, i64 0, i64 0
%26 = load %struct.output*, %struct.output** %8
%27 = call i64 @do_exec(i8** %25, i32 1, %struct.output* %26)
%28 = icmp ne i64 %27, 0
br i1 %28, label %29, label %33
29: ; preds = %24
%30 = load %struct.output*, %struct.output** %8
%31 = call i32 @write_output(i32 1, %struct.output* %30)
%32 = call i32 @exit(i32 1)
unreachable
33: ; preds = %24
ret void
}

LLVM IR (-O2):
%struct.output = type { i32 }
@.str = [9 x i8] c"ifconfig\00"
@.str.1 = [8 x i8] c"0.0.0.0\00"
@.str.2 = [5 x i8] c"down\00"
define void @slip_down(i8* %0, i8* %1, i8* %2, %struct.output* %3) {
%5 = alloca [5 x i8*]
%6 = bitcast [5 x i8*]* %5 to i8*
%7 = getelementptr inbounds [5 x i8*], [5 x i8*]* %5, i64 0, i64 0
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8** %7
%8 = getelementptr inbounds [5 x i8*], [5 x i8*]* %5, i64 0, i64 1
store i8* %0, i8** %8
%9 = getelementptr inbounds [5 x i8*], [5 x i8*]* %5, i64 0, i64 2
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8** %9
%10 = getelementptr inbounds [5 x i8*], [5 x i8*]* %5, i64 0, i64 3
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8** %10
%11 = getelementptr inbounds [5 x i8*], [5 x i8*]* %5, i64 0, i64 4
store i8* null, i8** %11
%12 = icmp eq i8* %1, null
br i1 %12, label %15, label %13
13: ; preds = %4
%14 = tail call i32 @no_route_and_arp(i8* %0, i8* %1, i8* %2, %struct.output* %3)
br label %15
15: ; preds = %13, %4
%16 = call i64 @do_exec(i8** %7, i32 1, %struct.output* %3)
%17 = icmp eq i64 %16, 0
br i1 %17, label %21, label %18
18: ; preds = %15
%19 = call i32 @write_output(i32 1, %struct.output* %3)
%20 = call i32 @exit(i32 1)
unreachable
21: ; preds = %15
ret void
}