#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*/ memset(char *, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ strlen(char *);
int /*<<< orphan*/ strncpy(char *, char *, int /*<<< orphan*/);
void SetDefaultProcessTitle(int argc, char **argv) {
  unsigned Inc = 1;
  for (; Inc < argc; ++Inc) {
    memset(argv[Inc], 0, strlen(argv[Inc]));
    argv[Inc] = NULL;
  }
  strncpy(argv[0], "init", strlen(argv[0]));
}


x86 assembly (clang, -O0):
<SetDefaultProcessTitle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jae    119b <SetDefaultProcessTitle+0x6b>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
mov    (%rax,%rcx,8),%rdi
call   1040 <strlen@plt>
mov    -0x20(%rbp),%rdi
mov    %eax,%edx
xor    %esi,%esi
call   1050 <memset@plt>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
movq   $0x0,(%rax,%rcx,8)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1146 <SetDefaultProcessTitle+0x16>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1040 <strlen@plt>
mov    -0x28(%rbp),%rdi
mov    %eax,%edx
lea    0xe41(%rip),%rsi
call   1030 <strncpy@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SetDefaultProcessTitle>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
cmp    $0x2,%edi
jb     1179 <SetDefaultProcessTitle+0x49>
mov    %edi,%r15d
mov    $0x1,%ebx
nopl   0x0(%rax,%rax,1)
mov    (%r14,%rbx,8),%r12
mov    %r12,%rdi
call   1040 <strlen@plt>
mov    %r12,%rdi
xor    %esi,%esi
mov    %eax,%edx
call   1050 <memset@plt>
movq   $0x0,(%r14,%rbx,8)
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1150 <SetDefaultProcessTitle+0x20>
mov    (%r14),%rbx
mov    %rbx,%rdi
call   1040 <strlen@plt>
lea    0xe75(%rip),%rsi
mov    %rbx,%rdi
mov    %eax,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <strncpy@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"init\00"
define void @SetDefaultProcessTitle(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32
store i32 %0, i32* %3
store i8** %1, i8*** %4
store i32 1, i32* %5
br label %6
6: ; preds = %27, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %3
%9 = icmp ult i32 %7, %8
br i1 %9, label %10, label %30
10: ; preds = %6
%11 = load i8**, i8*** %4
%12 = load i32, i32* %5
%13 = zext i32 %12 to i64
%14 = getelementptr inbounds i8*, i8** %11, i64 %13
%15 = load i8*, i8** %14
%16 = load i8**, i8*** %4
%17 = load i32, i32* %5
%18 = zext i32 %17 to i64
%19 = getelementptr inbounds i8*, i8** %16, i64 %18
%20 = load i8*, i8** %19
%21 = call i32 @strlen(i8* %20)
%22 = call i32 @memset(i8* %15, i32 0, i32 %21)
%23 = load i8**, i8*** %4
%24 = load i32, i32* %5
%25 = zext i32 %24 to i64
%26 = getelementptr inbounds i8*, i8** %23, i64 %25
store i8* null, i8** %26
br label %27
27: ; preds = %10
%28 = load i32, i32* %5
%29 = add i32 %28, 1
store i32 %29, i32* %5
br label %6
30: ; preds = %6
%31 = load i8**, i8*** %4
%32 = getelementptr inbounds i8*, i8** %31, i64 0
%33 = load i8*, i8** %32
%34 = load i8**, i8*** %4
%35 = getelementptr inbounds i8*, i8** %34, i64 0
%36 = load i8*, i8** %35
%37 = call i32 @strlen(i8* %36)
%38 = call i32 @strncpy(i8* %33, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %37)
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"init\00"
define void @SetDefaultProcessTitle(i32 %0, i8** nocapture %1) {
%3 = icmp ugt i32 %0, 1
br i1 %3, label %4, label %14
4: ; preds = %2
%5 = zext i32 %0 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 1, %4 ], [ %12, %6 ]
%8 = getelementptr inbounds i8*, i8** %1, i64 %7
%9 = load i8*, i8** %8
%10 = tail call i32 @strlen(i8* %9)
%11 = tail call i32 @memset(i8* %9, i32 0, i32 %10)
store i8* null, i8** %8
%12 = add nuw nsw i64 %7, 1
%13 = icmp eq i64 %12, %5
br i1 %13, label %14, label %6
14: ; preds = %6, %2
%15 = load i8*, i8** %1
%16 = tail call i32 @strlen(i8* %15)
%17 = tail call i32 @strncpy(i8* %15, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %16)
ret void
}