#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*/ F_OK;
int access(char *, int /*<<< orphan*/);
int /*<<< orphan*/ system(char *);
void generate_data() {
  if (access("output.txt", F_OK) != -1)
    system("rm -r output.txt");
  system("hostname >> output.txt");
  system("w | head -1 >> output.txt");
  system("ifconfig | grep \"inet6 addr\">> output.txt");
  system("ifconfig | grep \"inet addr\">> output.txt");
  system("df -kh >> output.txt");
}


x86 assembly (clang, -O0):
<generate_data>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ead(%rip),%rax
mov    (%rax),%esi
lea    0xf03(%rip),%rdi
call   1040 <access@plt>
cmp    $0xffffffff,%eax
je     114e <generate_data+0x2e>
lea    0xeb7(%rip),%rdi
call   1030 <system@plt>
lea    0xebc(%rip),%rdi
call   1030 <system@plt>
lea    0xec7(%rip),%rdi
call   1030 <system@plt>
lea    0xed5(%rip),%rdi
call   1030 <system@plt>
lea    0xef3(%rip),%rdi
call   1030 <system@plt>
lea    0xf10(%rip),%rdi
call   1030 <system@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<generate_data>:
push   %rax
mov    0x2eb0(%rip),%rax
mov    (%rax),%esi
lea    0xf06(%rip),%rdi
call   1040 <access@plt>
cmp    $0xffffffff,%eax
je     1147 <generate_data+0x27>
lea    0xebe(%rip),%rdi
call   1030 <system@plt>
lea    0xec3(%rip),%rdi
call   1030 <system@plt>
lea    0xece(%rip),%rdi
call   1030 <system@plt>
lea    0xedc(%rip),%rdi
call   1030 <system@plt>
lea    0xefa(%rip),%rdi
call   1030 <system@plt>
lea    0xf17(%rip),%rdi
pop    %rax
jmp    1030 <system@plt>

LLVM IR (-O0):
@.str = [11 x i8] c"output.txt\00"
@F_OK = global i32 0
@.str.1 = [17 x i8] c"rm -r output.txt\00"
@.str.2 = [23 x i8] c"hostname >> output.txt\00"
@.str.3 = [26 x i8] c"w | head -1 >> output.txt\00"
@.str.4 = [42 x i8] c"ifconfig | grep \22inet6 addr\22>> output.txt\00"
@.str.5 = [41 x i8] c"ifconfig | grep \22inet addr\22>> output.txt\00"
@.str.6 = [21 x i8] c"df -kh >> output.txt\00"
define void @generate_data() {
%1 = load i32, i32* @F_OK
%2 = call i32 @access(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = icmp ne i32 %2, -1
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = call i32 @system(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
br label %6
6: ; preds = %4, %0
%7 = call i32 @system(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 @system(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
%9 = call i32 @system(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.4, i64 0, i64 0))
%10 = call i32 @system(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.5, i64 0, i64 0))
%11 = call i32 @system(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.6, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"output.txt\00"
@F_OK = global i32 0
@.str.1 = [17 x i8] c"rm -r output.txt\00"
@.str.2 = [23 x i8] c"hostname >> output.txt\00"
@.str.3 = [26 x i8] c"w | head -1 >> output.txt\00"
@.str.4 = [42 x i8] c"ifconfig | grep \22inet6 addr\22>> output.txt\00"
@.str.5 = [41 x i8] c"ifconfig | grep \22inet addr\22>> output.txt\00"
@.str.6 = [21 x i8] c"df -kh >> output.txt\00"
define void @generate_data() {
%1 = load i32, i32* @F_OK
%2 = tail call i32 @access(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = icmp eq i32 %2, -1
br i1 %3, label %6, label %4
4: ; preds = %0
%5 = tail call i32 @system(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
br label %6
6: ; preds = %4, %0
%7 = tail call i32 @system(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0))
%8 = tail call i32 @system(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
%9 = tail call i32 @system(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.4, i64 0, i64 0))
%10 = tail call i32 @system(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.5, i64 0, i64 0))
%11 = tail call i32 @system(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.6, i64 0, i64 0))
ret void
}