#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 */
char *strchr(char *, char);
int /*<<< orphan*/ system(char *);
int main(int argc, char *argv[]) {
  char *ap;
  argv++;
  argc -= 2;
  ap = *argv;
  while (argc--) {
    ap = strchr(ap, '\0');
    *ap = ' ';
  }
  system(*argv);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
sub    $0x2,%eax
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x0,%eax
je     1185 <main+0x65>
mov    -0x18(%rbp),%rdi
xor    %esi,%esi
call   1040 <strchr@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movb   $0x20,(%rax)
jmp    1156 <main+0x36>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1030 <system@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
mov    %edi,%ebp
mov    0x8(%rsi),%rbx
add    $0xfffffffe,%ebp
je     1158 <main+0x38>
mov    %rsi,%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %rbx,%rdi
call   1030 <strlen@plt>
movb   $0x20,(%rbx,%rax,1)
add    %rax,%rbx
add    $0xffffffff,%ebp
jne    1140 <main+0x20>
mov    0x8(%r14),%rbx
mov    %rbx,%rdi
call   1040 <system@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i8**, i8*** %5
%8 = getelementptr inbounds i8*, i8** %7, i32 1
store i8** %8, i8*** %5
%9 = load i32, i32* %4
%10 = sub nsw i32 %9, 2
store i32 %10, i32* %4
%11 = load i8**, i8*** %5
%12 = load i8*, i8** %11
store i8* %12, i8** %6
br label %13
13: ; preds = %17, %2
%14 = load i32, i32* %4
%15 = add nsw i32 %14, -1
store i32 %15, i32* %4
%16 = icmp ne i32 %14, 0
br i1 %16, label %17, label %21
17: ; preds = %13
%18 = load i8*, i8** %6
%19 = call i8* @strchr(i8* %18, i8 signext 0)
store i8* %19, i8** %6
%20 = load i8*, i8** %6
store i8 32, i8* %20
br label %13
21: ; preds = %13
%22 = load i8**, i8*** %5
%23 = load i8*, i8** %22
%24 = call i32 @system(i8* %23)
%25 = load i32, i32* %3
ret i32 %25
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = add nsw i32 %0, -2
%5 = load i8*, i8** %3
%6 = icmp eq i32 %4, 0
br i1 %6, label %16, label %7
7: ; preds = %2, %7
%8 = phi i8* [ %12, %7 ], [ %5, %2 ]
%9 = phi i32 [ %10, %7 ], [ %4, %2 ]
%10 = add nsw i32 %9, -1
%11 = tail call i64 @strlen(i8* dereferenceable(1) %8)
%12 = getelementptr i8, i8* %8, i64 %11
store i8 32, i8* %12
%13 = icmp eq i32 %10, 0
br i1 %13, label %14, label %7
14: ; preds = %7
%15 = load i8*, i8** %3
br label %16
16: ; preds = %14, %2
%17 = phi i8* [ %15, %14 ], [ %5, %2 ]
%18 = tail call i32 @system(i8* %17)
ret i32 0
}