#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*/ kattach_sysexec(char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sprintf(char *, char *, char *, char *);
void kattach_net_loop(void) {
  char lcmd[255];
  printf("\n [*] Enabling lo network interface \n");
  sprintf(lcmd, "%s%s link set lo up", "/kaos/core/busybox/bin/", "ip");
  kattach_sysexec(lcmd);
  sprintf(lcmd, "%s%s addr add 127.0.0.1/8 dev lo", "/kaos/core/busybox/bin/",
          "ip");
  kattach_sysexec(lcmd);
  return;
}


x86 assembly (clang, -O0):
<kattach_net_loop>:
push   %rbp
mov    %rsp,%rbp
sub    $0x100,%rsp
lea    0xebe(%rip),%rdi
call   1030 <printf@plt>
lea    -0x100(%rbp),%rdi
lea    0xed1(%rip),%rsi
lea    0xede(%rip),%rdx
lea    0xeef(%rip),%rcx
call   1050 <sprintf@plt>
lea    -0x100(%rbp),%rdi
call   1040 <kattach_sysexec@plt>
lea    -0x100(%rbp),%rdi
lea    0xed3(%rip),%rsi
lea    0xeb1(%rip),%rdx
lea    0xec2(%rip),%rcx
call   1050 <sprintf@plt>
lea    -0x100(%rbp),%rdi
call   1040 <kattach_sysexec@plt>
add    $0x100,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<kattach_net_loop>:
push   %r15
push   %r14
push   %rbx
sub    $0x100,%rsp
lea    0xf0d(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb1(%rip),%rsi
lea    0xebe(%rip),%r15
lea    0xecf(%rip),%r14
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    %r15,%rdx
mov    %r14,%rcx
call   1050 <sprintf@plt>
mov    %rbx,%rdi
call   1040 <kattach_sysexec@plt>
lea    0xeb2(%rip),%rsi
mov    %rbx,%rdi
mov    %r15,%rdx
mov    %r14,%rcx
call   1050 <sprintf@plt>
mov    %rbx,%rdi
call   1040 <kattach_sysexec@plt>
add    $0x100,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [38 x i8] c"\0A [*] Enabling lo network interface \0A\00"
@.str.1 = [20 x i8] c"%s%s link set lo up\00"
@.str.2 = [24 x i8] c"/kaos/core/busybox/bin/\00"
@.str.3 = [3 x i8] c"ip\00"
@.str.4 = [33 x i8] c"%s%s addr add 127.0.0.1/8 dev lo\00"
define void @kattach_net_loop() {
%1 = alloca [255 x i8]
%2 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%3 = getelementptr inbounds [255 x i8], [255 x i8]* %1, i64 0, i64 0
%4 = call i32 @sprintf(i8* %3, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%5 = getelementptr inbounds [255 x i8], [255 x i8]* %1, i64 0, i64 0
%6 = call i32 @kattach_sysexec(i8* %5)
%7 = getelementptr inbounds [255 x i8], [255 x i8]* %1, i64 0, i64 0
%8 = call i32 @sprintf(i8* %7, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%9 = getelementptr inbounds [255 x i8], [255 x i8]* %1, i64 0, i64 0
%10 = call i32 @kattach_sysexec(i8* %9)
ret void
}

LLVM IR (-O2):
@.str.1 = [20 x i8] c"%s%s link set lo up\00"
@.str.2 = [24 x i8] c"/kaos/core/busybox/bin/\00"
@.str.3 = [3 x i8] c"ip\00"
@.str.4 = [33 x i8] c"%s%s addr add 127.0.0.1/8 dev lo\00"
@str = [37 x i8] c"\0A [*] Enabling lo network interface \00"
define void @kattach_net_loop() {
%1 = alloca [255 x i8]
%2 = getelementptr inbounds [255 x i8], [255 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str, i64 0, i64 0))
%4 = call i32 @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%5 = call i32 @kattach_sysexec(i8* %2)
%6 = call i32 @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%7 = call i32 @kattach_sysexec(i8* %2)
ret void
}