#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 */
scalar_t__ in_array(char *, char const **);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  const char *test_array[] = {"aaa", "bbb", "ccc", NULL};
  printf("%s, addr:%lu\n", test_array[0], &test_array[0]);
  printf("%s, addr:%lu\n", test_array[1], &test_array[1]);
  printf("%s, addr:%lu\n", test_array[2], &test_array[2]);
  printf("sizeof(const char*)=%u\n", sizeof(const char *));
  if (in_array("ccc", test_array)) {
    printf("ccc in array\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2cca(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0x2cc7(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0x2cc4(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0x2cc1(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x30(%rbp),%rsi
lea    -0x30(%rbp),%rdx
lea    0xea2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x28(%rbp),%rsi
lea    -0x30(%rbp),%rdx
add    $0x8,%rdx
lea    0xe88(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%rsi
lea    -0x30(%rbp),%rdx
add    $0x10,%rdx
lea    0xe6e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe6e(%rip),%rdi
mov    $0x8,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x30(%rbp),%rsi
lea    0xe45(%rip),%rdi
call   1040 <in_array@plt>
cmp    $0x0,%rax
je     11e0 <main+0xc0>
lea    0xe59(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x20,%rsp
movaps 0x2cd0(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0x2cb4(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0x10(%rsp),%r14
lea    0xeb0(%rip),%rbx
lea    0xe9d(%rip),%rsi
mov    %rsp,%r15
mov    %rbx,%rdi
mov    %r15,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x8(%rsp),%rdx
mov    0x8(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x10(%rsp),%rsi
mov    %rbx,%rdi
mov    %r14,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe7a(%rip),%rdi
mov    $0x8,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe55(%rip),%rdi
mov    %r15,%rsi
call   1050 <in_array@plt>
test   %rax,%rax
je     11cc <main+0x9c>
lea    0xe6b(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [4 x i8] c"aaa\00"
@.str.1 = [4 x i8] c"bbb\00"
@.str.2 = [4 x i8] c"ccc\00"
@__const.main.test_array = [4 x i8*] [i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i32 0, i32 0), i8* null]
@.str.3 = [14 x i8] c"%s, addr:%lu\0A\00"
@.str.4 = [24 x i8] c"sizeof(const char*)=%u\0A\00"
@.str.5 = [14 x i8] c"ccc in array\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [4 x i8*]
store i32 0, i32* %1
%3 = bitcast [4 x i8*]* %2 to i8*
%4 = getelementptr inbounds [4 x i8*], [4 x i8*]* %2, i64 0, i64 0
%5 = load i8*, i8** %4
%6 = getelementptr inbounds [4 x i8*], [4 x i8*]* %2, i64 0, i64 0
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i8* %5, i8** %6)
%8 = getelementptr inbounds [4 x i8*], [4 x i8*]* %2, i64 0, i64 1
%9 = load i8*, i8** %8
%10 = getelementptr inbounds [4 x i8*], [4 x i8*]* %2, i64 0, i64 1
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i8* %9, i8** %10)
%12 = getelementptr inbounds [4 x i8*], [4 x i8*]* %2, i64 0, i64 2
%13 = load i8*, i8** %12
%14 = getelementptr inbounds [4 x i8*], [4 x i8*]* %2, i64 0, i64 2
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i8* %13, i8** %14)
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0), i64 8)
%17 = getelementptr inbounds [4 x i8*], [4 x i8*]* %2, i64 0, i64 0
%18 = call i64 @in_array(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8** %17)
%19 = icmp ne i64 %18, 0
br i1 %19, label %20, label %22
20: ; preds = %0
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0))
br label %22
22: ; preds = %20, %0
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"aaa\00"
@.str.1 = [4 x i8] c"bbb\00"
@.str.2 = [4 x i8] c"ccc\00"
@__const.main.test_array = [4 x i8*] [i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i32 0, i32 0), i8* null]
@.str.3 = [14 x i8] c"%s, addr:%lu\0A\00"
@.str.4 = [24 x i8] c"sizeof(const char*)=%u\0A\00"
@str = [13 x i8] c"ccc in array\00"
define i32 @main() {
%1 = alloca [4 x i8*]
%2 = bitcast [4 x i8*]* %1 to i8*
%3 = getelementptr inbounds [4 x i8*], [4 x i8*]* %1, i64 0, i64 0
%4 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8** %3)
%5 = getelementptr inbounds [4 x i8*], [4 x i8*]* %1, i64 0, i64 1
%6 = load i8*, i8** %5
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i8* %6, i8** %5)
%8 = getelementptr inbounds [4 x i8*], [4 x i8*]* %1, i64 0, i64 2
%9 = load i8*, i8** %8
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i8* %9, i8** %8)
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0), i64 8)
%12 = call i64 @in_array(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8** %3)
%13 = icmp eq i64 %12, 0
br i1 %13, label %16, label %14
14: ; preds = %0
%15 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
br label %16
16: ; preds = %14, %0
ret i32 0
}