#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 **add_arr(char **, char **);
int /*<<< orphan*/ assert_log(int, int, char *, int *);
int /*<<< orphan*/ strcmp(char *, char *);
int test_add_arr(int verbose) {
  int ok = 1;
  char *a[] = {"1", "2", NULL};
  char *b[] = {"3", "4", NULL};
  char **c;
  c = add_arr(a, b);
  assert_log(!strcmp(c[0], "1"), verbose, "c[0] != '1'", &ok);
  assert_log(!strcmp(c[1], "2"), verbose, "c[1] != '2'", &ok);
  assert_log(!strcmp(c[2], "3"), verbose, "c[2] != '3'", &ok);
  assert_log(!strcmp(c[3], "4"), verbose, "c[3] != '4'", &ok);
  return ok;
}


x86 assembly (clang, -O0):
<test_add_arr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
mov    0x2c97(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0x2c94(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0x2c91(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0x2c96(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0x2c93(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    0x2c90(%rip),%rax
mov    %rax,-0x30(%rbp)
lea    -0x20(%rbp),%rdi
lea    -0x40(%rbp),%rsi
call   1050 <add_arr@plt>
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rax
mov    (%rax),%rdi
lea    0xe5d(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
mov    -0x4(%rbp),%esi
lea    0xe49(%rip),%rdx
lea    -0x8(%rbp),%rcx
call   1040 <assert_log@plt>
mov    -0x48(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe2b(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
mov    -0x4(%rbp),%esi
lea    0xe21(%rip),%rdx
lea    -0x8(%rbp),%rcx
call   1040 <assert_log@plt>
mov    -0x48(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xdf9(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
mov    -0x4(%rbp),%esi
lea    0xdf9(%rip),%rdx
lea    -0x8(%rbp),%rcx
call   1040 <assert_log@plt>
mov    -0x48(%rbp),%rax
mov    0x18(%rax),%rdi
lea    0xdc7(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
mov    -0x4(%rbp),%esi
lea    0xdd1(%rip),%rdx
lea    -0x8(%rbp),%rcx
call   1040 <assert_log@plt>
mov    -0x8(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_add_arr>:
push   %rbp
push   %r14
push   %rbx
sub    $0x50,%rsp
mov    %edi,%ebp
movl   $0x1,0xc(%rsp)
mov    0x2ca7(%rip),%rax
mov    %rax,0x40(%rsp)
movaps 0x2c8b(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
mov    0x2caf(%rip),%rax
mov    %rax,0x20(%rsp)
movaps 0x2c93(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
lea    0x30(%rsp),%rdi
lea    0x10(%rsp),%rsi
call   1050 <add_arr@plt>
mov    %rax,%rbx
mov    (%rax),%rdi
lea    0xe72(%rip),%rsi
call   1030 <strcmp@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
lea    0xe66(%rip),%rdx
lea    0xc(%rsp),%r14
mov    %ebp,%esi
mov    %r14,%rcx
call   1040 <assert_log@plt>
mov    0x8(%rbx),%rdi
lea    0xe46(%rip),%rsi
call   1030 <strcmp@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
lea    0xe44(%rip),%rdx
mov    %ebp,%esi
mov    %r14,%rcx
call   1040 <assert_log@plt>
mov    0x10(%rbx),%rdi
lea    0xe1f(%rip),%rsi
call   1030 <strcmp@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
lea    0xe27(%rip),%rdx
mov    %ebp,%esi
mov    %r14,%rcx
call   1040 <assert_log@plt>
mov    0x18(%rbx),%rdi
lea    0xdf8(%rip),%rsi
call   1030 <strcmp@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
lea    0xe0a(%rip),%rdx
mov    %ebp,%esi
mov    %r14,%rcx
call   1040 <assert_log@plt>
mov    0xc(%rsp),%eax
add    $0x50,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"1\00"
@.str.1 = [2 x i8] c"2\00"
@__const.test_add_arr.a = [3 x i8*] [i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i32 0, i32 0), i8* null]
@.str.2 = [2 x i8] c"3\00"
@.str.3 = [2 x i8] c"4\00"
@__const.test_add_arr.b = [3 x i8*] [i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i32 0, i32 0), i8* null]
@.str.4 = [12 x i8] c"c[0] != '1'\00"
@.str.5 = [12 x i8] c"c[1] != '2'\00"
@.str.6 = [12 x i8] c"c[2] != '3'\00"
@.str.7 = [12 x i8] c"c[3] != '4'\00"
define i32 @test_add_arr(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca [3 x i8*]
%5 = alloca [3 x i8*]
%6 = alloca i8**
store i32 %0, i32* %2
store i32 1, i32* %3
%7 = bitcast [3 x i8*]* %4 to i8*
%8 = bitcast [3 x i8*]* %5 to i8*
%9 = getelementptr inbounds [3 x i8*], [3 x i8*]* %4, i64 0, i64 0
%10 = getelementptr inbounds [3 x i8*], [3 x i8*]* %5, i64 0, i64 0
%11 = call i8** @add_arr(i8** %9, i8** %10)
store i8** %11, i8*** %6
%12 = load i8**, i8*** %6
%13 = getelementptr inbounds i8*, i8** %12, i64 0
%14 = load i8*, i8** %13
%15 = call i32 @strcmp(i8* %14, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%16 = icmp ne i32 %15, 0
%17 = xor i1 %16, true
%18 = zext i1 %17 to i32
%19 = load i32, i32* %2
%20 = call i32 @assert_log(i32 %18, i32 %19, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i32* %3)
%21 = load i8**, i8*** %6
%22 = getelementptr inbounds i8*, i8** %21, i64 1
%23 = load i8*, i8** %22
%24 = call i32 @strcmp(i8* %23, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%25 = icmp ne i32 %24, 0
%26 = xor i1 %25, true
%27 = zext i1 %26 to i32
%28 = load i32, i32* %2
%29 = call i32 @assert_log(i32 %27, i32 %28, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i32* %3)
%30 = load i8**, i8*** %6
%31 = getelementptr inbounds i8*, i8** %30, i64 2
%32 = load i8*, i8** %31
%33 = call i32 @strcmp(i8* %32, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%34 = icmp ne i32 %33, 0
%35 = xor i1 %34, true
%36 = zext i1 %35 to i32
%37 = load i32, i32* %2
%38 = call i32 @assert_log(i32 %36, i32 %37, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0), i32* %3)
%39 = load i8**, i8*** %6
%40 = getelementptr inbounds i8*, i8** %39, i64 3
%41 = load i8*, i8** %40
%42 = call i32 @strcmp(i8* %41, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%43 = icmp ne i32 %42, 0
%44 = xor i1 %43, true
%45 = zext i1 %44 to i32
%46 = load i32, i32* %2
%47 = call i32 @assert_log(i32 %45, i32 %46, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.7, i64 0, i64 0), i32* %3)
%48 = load i32, i32* %3
ret i32 %48
}

LLVM IR (-O2):
@.str = [2 x i8] c"1\00"
@.str.1 = [2 x i8] c"2\00"
@__const.test_add_arr.a = [3 x i8*] [i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i32 0, i32 0), i8* null]
@.str.2 = [2 x i8] c"3\00"
@.str.3 = [2 x i8] c"4\00"
@__const.test_add_arr.b = [3 x i8*] [i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i32 0, i32 0), i8* null]
@.str.4 = [12 x i8] c"c[0] != '1'\00"
@.str.5 = [12 x i8] c"c[1] != '2'\00"
@.str.6 = [12 x i8] c"c[2] != '3'\00"
@.str.7 = [12 x i8] c"c[3] != '4'\00"
define i32 @test_add_arr(i32 %0) {
%2 = alloca i32
%3 = alloca [3 x i8*]
%4 = alloca [3 x i8*]
%5 = bitcast i32* %2 to i8*
store i32 1, i32* %2
%6 = bitcast [3 x i8*]* %3 to i8*
%7 = bitcast [3 x i8*]* %4 to i8*
%8 = getelementptr inbounds [3 x i8*], [3 x i8*]* %3, i64 0, i64 0
%9 = getelementptr inbounds [3 x i8*], [3 x i8*]* %4, i64 0, i64 0
%10 = call i8** @add_arr(i8** %8, i8** %9)
%11 = load i8*, i8** %10
%12 = call i32 @strcmp(i8* dereferenceable(1) %11, i8* dereferenceable(2) getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%13 = icmp eq i32 %12, 0
%14 = zext i1 %13 to i32
%15 = call i32 @assert_log(i32 %14, i32 %0, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i32* %2)
%16 = getelementptr inbounds i8*, i8** %10, i64 1
%17 = load i8*, i8** %16
%18 = call i32 @strcmp(i8* dereferenceable(1) %17, i8* dereferenceable(2) getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%19 = icmp eq i32 %18, 0
%20 = zext i1 %19 to i32
%21 = call i32 @assert_log(i32 %20, i32 %0, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i32* %2)
%22 = getelementptr inbounds i8*, i8** %10, i64 2
%23 = load i8*, i8** %22
%24 = call i32 @strcmp(i8* dereferenceable(1) %23, i8* dereferenceable(2) getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%25 = icmp eq i32 %24, 0
%26 = zext i1 %25 to i32
%27 = call i32 @assert_log(i32 %26, i32 %0, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0), i32* %2)
%28 = getelementptr inbounds i8*, i8** %10, i64 3
%29 = load i8*, i8** %28
%30 = call i32 @strcmp(i8* dereferenceable(1) %29, i8* dereferenceable(2) getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%31 = icmp eq i32 %30, 0
%32 = zext i1 %31 to i32
%33 = call i32 @assert_log(i32 %32, i32 %0, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.7, i64 0, i64 0), i32* %2)
%34 = load i32, i32* %2
ret i32 %34
}