#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 *, char *);
int /*<<< orphan*/ putchar(char);
int myfunc(void *p, int argc, char **argv, char **argvv) {
  int i;
  *(int *)p = 0;
  for (i = 0; i < argc; i++) {
    printf("%s = %s \n", argvv[i], argv[i] ? argv[i] : "NULL");
  }
  putchar('\n');
  return 0;
}


x86 assembly (clang, -O0):
<myfunc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rax
movl   $0x0,(%rax)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11be <myfunc+0x9e>
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x30(%rbp)
mov    -0x18(%rbp),%rax
movslq -0x24(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     118c <myfunc+0x6c>
mov    -0x18(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x38(%rbp)
jmp    119c <myfunc+0x7c>
lea    0xe77(%rip),%rax
mov    %rax,-0x38(%rbp)
jmp    119c <myfunc+0x7c>
mov    -0x30(%rbp),%rsi
mov    -0x38(%rbp),%rdx
lea    0xe55(%rip),%rdi
call   1040 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1148 <myfunc+0x28>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<myfunc>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
movl   $0x0,(%rdi)
test   %esi,%esi
jle    1170 <myfunc+0x50>
mov    %rcx,%r14
mov    %rdx,%r12
mov    %esi,%r13d
xor    %ebx,%ebx
lea    0xec3(%rip),%rbp
lea    0xeb2(%rip),%r15
xchg   %ax,%ax
mov    (%r14,%rbx,8),%rsi
mov    (%r12,%rbx,8),%rdx
test   %rdx,%rdx
cmove  %rbp,%rdx
mov    %r15,%rdi
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r13
jne    1150 <myfunc+0x30>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [10 x i8] c"%s = %s \0A\00"
@.str.1 = [5 x i8] c"NULL\00"
define i32 @myfunc(i8* nocapture writeonly %0, i32 %1, i8** nocapture %2, i8** nocapture %3) {
%5 = bitcast i8* %0 to i32*
store i32 0, i32* %5
%6 = icmp sgt i32 %1, 0
br i1 %6, label %7, label %20
7: ; preds = %4
%8 = zext i32 %1 to i64
br label %9
9: ; preds = %7, %9
%10 = phi i64 [ 0, %7 ], [ %18, %9 ]
%11 = getelementptr inbounds i8*, i8** %3, i64 %10
%12 = load i8*, i8** %11
%13 = getelementptr inbounds i8*, i8** %2, i64 %10
%14 = load i8*, i8** %13
%15 = icmp eq i8* %14, null
%16 = select i1 %15, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %14
%17 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %12, i8* %16)
%18 = add nuw nsw i64 %10, 1
%19 = icmp eq i64 %18, %8
br i1 %19, label %20, label %9
20: ; preds = %9, %4
%21 = tail call i32 @putchar(i8 signext 10)
ret i32 0
}