#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*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ sprintf(char *, char *, char *, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ system(char *);
int main(int argc, char *argv[]) {
  char sed[1024];
  if (argc < 4) {
    fprintf(stderr, "\nError en el numero de argumentos.");
    exit(1);
  }
  sprintf(sed, "sed 's/%s/%s/g'< httpd.conf > httpd.cf", argv[1], argv[2]);
  system(sed);
  system("cp httpd.cf httpd.conf");
  sprintf(sed, "sed 's/%s/%s/g'< mrtg.cfg > mrtg.cf", argv[1], argv[2]);
  system(sed);
  sprintf(sed, "sed 's/%s/%s/g'< mrtg.cf > mrtg.cfg", argv[3], argv[4]);
  system(sed);
  sprintf(sed, "sed 's/%s/%s/g'< snmpd.conf > snmpd.cf", argv[1], argv[2]);
  system(sed);
  system("cp snmpd.cf snmpd.conf");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x410,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x4,-0x8(%rbp)
jge    1182 <main+0x42>
mov    0x2e76(%rip),%rax
mov    (%rax),%edi
lea    0xe8d(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
lea    -0x410(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rcx
lea    0xe83(%rip),%rsi
call   1050 <sprintf@plt>
lea    -0x410(%rbp),%rdi
call   1030 <system@plt>
lea    0xe92(%rip),%rdi
call   1030 <system@plt>
lea    -0x410(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rcx
lea    0xe86(%rip),%rsi
call   1050 <sprintf@plt>
lea    -0x410(%rbp),%rdi
call   1030 <system@plt>
lea    -0x410(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdx
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rcx
lea    0xe7b(%rip),%rsi
call   1050 <sprintf@plt>
lea    -0x410(%rbp),%rdi
call   1030 <system@plt>
lea    -0x410(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rcx
lea    0xe70(%rip),%rsi
call   1050 <sprintf@plt>
lea    -0x410(%rbp),%rdi
call   1030 <system@plt>
lea    0xe7f(%rip),%rdi
call   1030 <system@plt>
xor    %eax,%eax
add    $0x410,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x408,%rsp
cmp    $0x3,%edi
jle    11fa <main+0xba>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdx
mov    0x10(%rsi),%rcx
lea    0xebe(%rip),%rsi
mov    %rsp,%r14
mov    %r14,%rdi
call   1050 <sprintf@plt>
mov    %r14,%rdi
call   1030 <system@plt>
lea    0xecb(%rip),%rdi
call   1030 <system@plt>
mov    0x8(%rbx),%rdx
mov    0x10(%rbx),%rcx
lea    0xece(%rip),%rsi
mov    %r14,%rdi
call   1050 <sprintf@plt>
mov    %r14,%rdi
call   1030 <system@plt>
mov    0x18(%rbx),%rdx
mov    0x20(%rbx),%rcx
lea    0xed3(%rip),%rsi
mov    %r14,%rdi
call   1050 <sprintf@plt>
mov    %r14,%rdi
call   1030 <system@plt>
mov    0x8(%rbx),%rdx
mov    0x10(%rbx),%rcx
lea    0xed8(%rip),%rsi
mov    %r14,%rdi
call   1050 <sprintf@plt>
mov    %r14,%rdi
call   1030 <system@plt>
lea    0xee8(%rip),%rdi
call   1030 <system@plt>
xor    %eax,%eax
add    $0x408,%rsp
pop    %rbx
pop    %r14
ret
mov    0x2ddf(%rip),%rax
mov    (%rax),%edi
lea    0xdf6(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [35 x i8] c"\0AError en el numero de argumentos.\00"
@.str.1 = [39 x i8] c"sed 's/%s/%s/g'< httpd.conf > httpd.cf\00"
@.str.2 = [23 x i8] c"cp httpd.cf httpd.conf\00"
@.str.3 = [36 x i8] c"sed 's/%s/%s/g'< mrtg.cfg > mrtg.cf\00"
@.str.4 = [36 x i8] c"sed 's/%s/%s/g'< mrtg.cf > mrtg.cfg\00"
@.str.5 = [39 x i8] c"sed 's/%s/%s/g'< snmpd.conf > snmpd.cf\00"
@.str.6 = [23 x i8] c"cp snmpd.cf snmpd.conf\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [1024 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = icmp slt i32 %7, 4
br i1 %8, label %9, label %13
9: ; preds = %2
%10 = load i32, i32* @stderr
%11 = call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%12 = call i32 @exit(i32 1)
unreachable
13: ; preds = %2
%14 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 1
%17 = load i8*, i8** %16
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 2
%20 = load i8*, i8** %19
%21 = call i32 @sprintf(i8* %14, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0), i8* %17, i8* %20)
%22 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%23 = call i32 @system(i8* %22)
%24 = call i32 @system(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0))
%25 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%26 = load i8**, i8*** %5
%27 = getelementptr inbounds i8*, i8** %26, i64 1
%28 = load i8*, i8** %27
%29 = load i8**, i8*** %5
%30 = getelementptr inbounds i8*, i8** %29, i64 2
%31 = load i8*, i8** %30
%32 = call i32 @sprintf(i8* %25, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0), i8* %28, i8* %31)
%33 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%34 = call i32 @system(i8* %33)
%35 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%36 = load i8**, i8*** %5
%37 = getelementptr inbounds i8*, i8** %36, i64 3
%38 = load i8*, i8** %37
%39 = load i8**, i8*** %5
%40 = getelementptr inbounds i8*, i8** %39, i64 4
%41 = load i8*, i8** %40
%42 = call i32 @sprintf(i8* %35, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.4, i64 0, i64 0), i8* %38, i8* %41)
%43 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%44 = call i32 @system(i8* %43)
%45 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%46 = load i8**, i8*** %5
%47 = getelementptr inbounds i8*, i8** %46, i64 1
%48 = load i8*, i8** %47
%49 = load i8**, i8*** %5
%50 = getelementptr inbounds i8*, i8** %49, i64 2
%51 = load i8*, i8** %50
%52 = call i32 @sprintf(i8* %45, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.5, i64 0, i64 0), i8* %48, i8* %51)
%53 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%54 = call i32 @system(i8* %53)
%55 = call i32 @system(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [35 x i8] c"\0AError en el numero de argumentos.\00"
@.str.1 = [39 x i8] c"sed 's/%s/%s/g'< httpd.conf > httpd.cf\00"
@.str.2 = [23 x i8] c"cp httpd.cf httpd.conf\00"
@.str.3 = [36 x i8] c"sed 's/%s/%s/g'< mrtg.cfg > mrtg.cf\00"
@.str.4 = [36 x i8] c"sed 's/%s/%s/g'< mrtg.cf > mrtg.cfg\00"
@.str.5 = [39 x i8] c"sed 's/%s/%s/g'< snmpd.conf > snmpd.cf\00"
@.str.6 = [23 x i8] c"cp snmpd.cf snmpd.conf\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [1024 x i8]
%4 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%5 = icmp slt i32 %0, 4
br i1 %5, label %6, label %10
6: ; preds = %2
%7 = load i32, i32* @stderr
%8 = tail call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%9 = tail call i32 @exit(i32 1)
unreachable
10: ; preds = %2
%11 = getelementptr inbounds i8*, i8** %1, i64 1
%12 = load i8*, i8** %11
%13 = getelementptr inbounds i8*, i8** %1, i64 2
%14 = load i8*, i8** %13
%15 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0), i8* %12, i8* %14)
%16 = call i32 @system(i8* %4)
%17 = tail call i32 @system(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0))
%18 = load i8*, i8** %11
%19 = load i8*, i8** %13
%20 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0), i8* %18, i8* %19)
%21 = call i32 @system(i8* %4)
%22 = getelementptr inbounds i8*, i8** %1, i64 3
%23 = load i8*, i8** %22
%24 = getelementptr inbounds i8*, i8** %1, i64 4
%25 = load i8*, i8** %24
%26 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.4, i64 0, i64 0), i8* %23, i8* %25)
%27 = call i32 @system(i8* %4)
%28 = load i8*, i8** %11
%29 = load i8*, i8** %13
%30 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.5, i64 0, i64 0), i8* %28, i8* %29)
%31 = call i32 @system(i8* %4)
%32 = tail call i32 @system(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0))
ret i32 0
}