#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*/ printf(char *, char *, int);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int system(char *);
int main(int args, char *argv[]) {
  char buff[256];
  strcpy(buff, argv[1]);
  for (int i = 2; i < args; i++) {
    strcat(buff, " ");
    strcat(buff, argv[i]);
  }
  int sys = system(buff);
  printf("El programa %s  termino con codigo %d\n", buff, sys);
  return sys;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x110(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
call   1030 <strcpy@plt>
movl   $0x2,-0x114(%rbp)
mov    -0x114(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11c8 <main+0x88>
lea    -0x110(%rbp),%rdi
lea    0xe6c(%rip),%rsi
call   1060 <strcat@plt>
lea    -0x110(%rbp),%rdi
mov    -0x10(%rbp),%rax
movslq -0x114(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
call   1060 <strcat@plt>
mov    -0x114(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x114(%rbp)
jmp    1177 <main+0x37>
lea    -0x110(%rbp),%rdi
call   1040 <system@plt>
mov    %eax,-0x118(%rbp)
lea    -0x110(%rbp),%rsi
mov    -0x118(%rbp),%edx
lea    0xe14(%rip),%rdi
call   1050 <printf@plt>
mov    -0x118(%rbp),%eax
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x100,%rsp
mov    %rsi,%r15
mov    %edi,%ebx
mov    0x8(%rsi),%rsi
mov    %rsp,%rdi
call   1030 <strcpy@plt>
cmp    $0x3,%ebx
jl     11a0 <main+0x60>
mov    %ebx,%r12d
mov    $0x2,%ebp
lea    0xe8c(%rip),%r14
mov    %rsp,%rbx
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1060 <strcat@plt>
mov    (%r15,%rbp,8),%rsi
mov    %rbx,%rdi
call   1060 <strcat@plt>
add    $0x1,%rbp
cmp    %rbp,%r12
jne    1180 <main+0x40>
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1040 <system@plt>
mov    %eax,%ebp
lea    0xe4e(%rip),%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1050 <printf@plt>
mov    %ebp,%eax
add    $0x100,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c" \00"
@.str.1 = [39 x i8] c"El programa %s termino con codigo %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [256 x i8]
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 1
%12 = load i8*, i8** %11
%13 = call i32 @strcpy(i8* %9, i8* %12)
store i32 2, i32* %7
br label %14
14: ; preds = %28, %2
%15 = load i32, i32* %7
%16 = load i32, i32* %4
%17 = icmp slt i32 %15, %16
br i1 %17, label %18, label %31
18: ; preds = %14
%19 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%20 = call i32 @strcat(i8* %19, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%21 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%22 = load i8**, i8*** %5
%23 = load i32, i32* %7
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i8*, i8** %22, i64 %24
%26 = load i8*, i8** %25
%27 = call i32 @strcat(i8* %21, i8* %26)
br label %28
28: ; preds = %18
%29 = load i32, i32* %7
%30 = add nsw i32 %29, 1
store i32 %30, i32* %7
br label %14
31: ; preds = %14
%32 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%33 = call i32 @system(i8* %32)
store i32 %33, i32* %8
%34 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%35 = load i32, i32* %8
%36 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0), i8* %34, i32 %35)
%37 = load i32, i32* %8
ret i32 %37
}

LLVM IR (-O2):
@.str = [2 x i8] c" \00"
@.str.1 = [39 x i8] c"El programa %s termino con codigo %d\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [256 x i8]
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = call i32 @strcpy(i8* %4, i8* %6)
%8 = icmp sgt i32 %0, 2
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = zext i32 %0 to i64
br label %14
11: ; preds = %14, %2
%12 = call i32 @system(i8* %4)
%13 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0), i8* %4, i32 %12)
ret i32 %12
14: ; preds = %9, %14
%15 = phi i64 [ 2, %9 ], [ %20, %14 ]
%16 = call i32 @strcat(i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%17 = getelementptr inbounds i8*, i8** %1, i64 %15
%18 = load i8*, i8** %17
%19 = call i32 @strcat(i8* %4, i8* %18)
%20 = add nuw nsw i64 %15, 1
%21 = icmp eq i64 %20, %10
br i1 %21, label %11, label %14
}