#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 *ez_add(char *, int /*<<< orphan*/, char *, int /*<<< orphan*/);
int /*<<< orphan*/ strlen(char *);
int main(int argc, char *argv[]) {
  char *a = ((void *)0), *b = ((void *)0);
  if (argc >= 3) {
    a = argv[1];
    b = argv[2];
  }
  char *res = ez_add(a, strlen(a), b, strlen(b));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
cmpl   $0x3,-0x8(%rbp)
jl     1168 <main+0x48>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x34(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x20(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x40(%rbp),%rdi
mov    -0x34(%rbp),%esi
mov    -0x30(%rbp),%rdx
mov    %eax,%ecx
call   1040 <ez_add@plt>
mov    %rax,-0x28(%rbp)
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
cmp    $0x3,%edi
jl     1133 <main+0x13>
mov    0x8(%rsi),%rbx
mov    0x10(%rsi),%r14
jmp    1138 <main+0x18>
xor    %r14d,%r14d
xor    %ebx,%ebx
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %eax,%ebp
mov    %r14,%rdi
call   1030 <strlen@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %r14,%rdx
mov    %eax,%ecx
call   1040 <ez_add@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*
%7 = alloca i8*
%8 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* null, i8** %6
store i8* null, i8** %7
%9 = load i32, i32* %4
%10 = icmp sge i32 %9, 3
br i1 %10, label %11, label %18
11: ; preds = %2
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
store i8* %14, i8** %6
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 2
%17 = load i8*, i8** %16
store i8* %17, i8** %7
br label %18
18: ; preds = %11, %2
%19 = load i8*, i8** %6
%20 = load i8*, i8** %6
%21 = call i32 @strlen(i8* %20)
%22 = load i8*, i8** %7
%23 = load i8*, i8** %7
%24 = call i32 @strlen(i8* %23)
%25 = call i8* @ez_add(i8* %19, i32 %21, i8* %22, i32 %24)
store i8* %25, i8** %8
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 2
br i1 %3, label %4, label %9
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = getelementptr inbounds i8*, i8** %1, i64 2
%8 = load i8*, i8** %7
br label %9
9: ; preds = %4, %2
%10 = phi i8* [ %8, %4 ], [ null, %2 ]
%11 = phi i8* [ %6, %4 ], [ null, %2 ]
%12 = tail call i32 @strlen(i8* %11)
%13 = tail call i32 @strlen(i8* %10)
%14 = tail call i8* @ez_add(i8* %11, i32 %12, i8* %10, i32 %13)
ret i32 0
}