#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 getpid();
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ sleep(int);
int strlen(char *);
int main(int argc, char **argv) {
  printf("%d\n", getpid());
  for (int i = 1; i < argc; i++)
    for (int j = 0; j < strlen(argv[i]); j++)
      argv[i][j] = 'x';
  sleep(60);
  return 0;
}


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    $0x0,%al
call   1030 <getpid@plt>
mov    %eax,%esi
lea    0xe9a(%rip),%rdi
call   1050 <printf@plt>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11de <main+0x9e>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x1c(%rbp),%eax
cmp    %ecx,%eax
jge    11cb <main+0x8b>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x18(%rbp),%rcx
movb   $0x78,(%rax,%rcx,1)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1185 <main+0x45>
jmp    11d0 <main+0x90>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1172 <main+0x32>
mov    $0x3c,%edi
call   1060 <sleep@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r15
mov    %edi,%ebp
xor    %eax,%eax
call   1030 <getpid@plt>
lea    0xea6(%rip),%rdi
mov    %eax,%esi
call   1050 <printf@plt>
cmp    $0x2,%ebp
jl     11ae <main+0x6e>
mov    %ebp,%r14d
mov    $0x1,%ebp
jmp    1179 <main+0x39>
add    $0x1,%rbp
cmp    %r14,%rbp
je     11ae <main+0x6e>
mov    (%r15,%rbp,8),%rdi
call   1040 <strlen@plt>
test   %eax,%eax
jle    1170 <main+0x30>
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    (%r15,%rbp,8),%rax
movb   $0x78,(%rax,%rbx,1)
add    $0x1,%rbx
mov    (%r15,%rbp,8),%rdi
call   1040 <strlen@plt>
cltq
cmp    %rax,%rbx
jl     1190 <main+0x50>
jmp    1170 <main+0x30>
mov    $0x3c,%edi
call   1060 <sleep@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = tail call i32 (...) @getpid()
%4 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = icmp sgt i32 %0, 1
br i1 %5, label %6, label %14
6: ; preds = %2
%7 = zext i32 %0 to i64
br label %8
8: ; preds = %6, %16
%9 = phi i64 [ 1, %6 ], [ %17, %16 ]
%10 = getelementptr inbounds i8*, i8** %1, i64 %9
%11 = load i8*, i8** %10
%12 = tail call i32 @strlen(i8* %11)
%13 = icmp sgt i32 %12, 0
br i1 %13, label %19, label %16
14: ; preds = %16, %2
%15 = tail call i32 @sleep(i32 60)
ret i32 0
16: ; preds = %19, %8
%17 = add nuw nsw i64 %9, 1
%18 = icmp eq i64 %17, %7
br i1 %18, label %14, label %8
19: ; preds = %8, %19
%20 = phi i64 [ %23, %19 ], [ 0, %8 ]
%21 = load i8*, i8** %10
%22 = getelementptr inbounds i8, i8* %21, i64 %20
store i8 120, i8* %22
%23 = add nuw nsw i64 %20, 1
%24 = load i8*, i8** %10
%25 = tail call i32 @strlen(i8* %24)
%26 = sext i32 %25 to i64
%27 = icmp slt i64 %23, %26
br i1 %27, label %19, label %16
}