#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*/ assert(int);
int /*<<< orphan*/ printf(char *, ...);
void test_list_of_strings() {
  printf("\n===== test_list_of_strings\n");
  char *names[] = {"A Name", "B Name", "C Name", "D Name"};
  assert(names[0] == "A Name");
  assert(names[1] == "B Name");
  assert(names[2] == "C Name");
  assert(names[3] == "D Name");
  printf("Initializing an array of char pointer strings: `char *names[] = {\"A "
         "Name\",...}`\n");
  assert(*names[0] == 'A');
  printf("Dereferencing char pointer: `*names[0]`, Returns %c\n", *names[0]);
}


x86 assembly (clang, -O0):
<test_list_of_strings>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xed1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2cc3(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0x2cc0(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0x2cbd(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0x2cba(%rip),%rax
mov    %rax,-0x8(%rbp)
lea    0xeb4(%rip),%rax
cmp    %rax,-0x20(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    0xea3(%rip),%rax
cmp    %rax,-0x18(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    0xe92(%rip),%rax
cmp    %rax,-0x10(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    0xe81(%rip),%rax
cmp    %rax,-0x8(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    0xe70(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x41,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x20(%rbp),%rax
movsbl (%rax),%esi
lea    0xe95(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_list_of_strings>:
push   %rax
lea    0xefd(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1050 <assert@plt>
mov    $0x1,%edi
call   1050 <assert@plt>
mov    $0x1,%edi
call   1050 <assert@plt>
mov    $0x1,%edi
call   1050 <assert@plt>
lea    0xee5(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1050 <assert@plt>
lea    0xe7e(%rip),%rdi
mov    $0x41,%esi
xor    %eax,%eax
pop    %rcx
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [29 x i8] c"\0A===== test_list_of_strings\0A\00"
@.str.1 = [7 x i8] c"A Name\00"
@.str.2 = [7 x i8] c"B Name\00"
@.str.3 = [7 x i8] c"C Name\00"
@.str.4 = [7 x i8] c"D Name\00"
@__const.test_list_of_strings.names = [4 x i8*] [i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i32 0, i32 0)]
@.str.5 = [81 x i8] c"Initializing an array of char pointer strings: `char *names[] = {\22A Name\22,...}`\0A\00"
@.str.6 = [53 x i8] c"Dereferencing char pointer: `*names[0]`, Returns %c\0A\00"
define void @test_list_of_strings() {
%1 = alloca [4 x i8*]
%2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%3 = bitcast [4 x i8*]* %1 to i8*
%4 = getelementptr inbounds [4 x i8*], [4 x i8*]* %1, i64 0, i64 0
%5 = load i8*, i8** %4
%6 = icmp eq i8* %5, getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0)
%7 = zext i1 %6 to i32
%8 = call i32 @assert(i32 %7)
%9 = getelementptr inbounds [4 x i8*], [4 x i8*]* %1, i64 0, i64 1
%10 = load i8*, i8** %9
%11 = icmp eq i8* %10, getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0)
%12 = zext i1 %11 to i32
%13 = call i32 @assert(i32 %12)
%14 = getelementptr inbounds [4 x i8*], [4 x i8*]* %1, i64 0, i64 2
%15 = load i8*, i8** %14
%16 = icmp eq i8* %15, getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0)
%17 = zext i1 %16 to i32
%18 = call i32 @assert(i32 %17)
%19 = getelementptr inbounds [4 x i8*], [4 x i8*]* %1, i64 0, i64 3
%20 = load i8*, i8** %19
%21 = icmp eq i8* %20, getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0)
%22 = zext i1 %21 to i32
%23 = call i32 @assert(i32 %22)
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([81 x i8], [81 x i8]* @.str.5, i64 0, i64 0))
%25 = getelementptr inbounds [4 x i8*], [4 x i8*]* %1, i64 0, i64 0
%26 = load i8*, i8** %25
%27 = load i8, i8* %26
%28 = sext i8 %27 to i32
%29 = icmp eq i32 %28, 65
%30 = zext i1 %29 to i32
%31 = call i32 @assert(i32 %30)
%32 = getelementptr inbounds [4 x i8*], [4 x i8*]* %1, i64 0, i64 0
%33 = load i8*, i8** %32
%34 = load i8, i8* %33
%35 = sext i8 %34 to i32
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.6, i64 0, i64 0), i32 %35)
ret void
}

LLVM IR (-O2):
@.str.6 = [53 x i8] c"Dereferencing char pointer: `*names[0]`, Returns %c\0A\00"
@str = [28 x i8] c"\0A===== test_list_of_strings\00"
@str.7 = [80 x i8] c"Initializing an array of char pointer strings: `char *names[] = {\22A Name\22,...}`\00"
define void @test_list_of_strings() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @assert(i32 1)
%3 = tail call i32 @assert(i32 1)
%4 = tail call i32 @assert(i32 1)
%5 = tail call i32 @assert(i32 1)
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([80 x i8], [80 x i8]* @str.7, i64 0, i64 0))
%7 = tail call i32 @assert(i32 1)
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @.str.6, i64 0, i64 0), i32 65)
ret void
}