#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 *, ...);
void main() {
  char *books[4] = {"C Programming Language", "Assembly Language",
                    "Java Language", "Natural Language"};
  int num = 4;
  char *ptr;
  int row;
  for (row = 0; row < num; row++)
    printf("string %d = %s\n", row + 1, books[row]);
  printf("\n");
  for (row = 0, ptr = *books; row < num; ptr = books[row]) {
    printf("string %d = %s\n", row + 1, ptr);
    row++;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x2ce1(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0x2cde(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0x2cdb(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0x2cd8(%rip),%rax
mov    %rax,-0x8(%rbp)
movl   $0x4,-0x24(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    1189 <main+0x79>
mov    -0x34(%rbp),%esi
add    $0x1,%esi
movslq -0x34(%rbp),%rax
mov    -0x20(%rbp,%rax,8),%rdx
lea    0xed4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1152 <main+0x42>
lea    0xec6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x34(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    11e5 <main+0xd5>
mov    -0x34(%rbp),%esi
add    $0x1,%esi
mov    -0x30(%rbp),%rdx
lea    0xe85(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
movslq -0x34(%rbp),%rax
mov    -0x20(%rbp,%rax,8),%rax
mov    %rax,-0x30(%rbp)
jmp    11a6 <main+0x96>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
lea    0xf18(%rip),%rbx
lea    0xec9(%rip),%r14
mov    %rbx,%rdi
mov    $0x1,%esi
mov    %r14,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xec7(%rip),%r15
mov    %rbx,%rdi
mov    $0x2,%esi
mov    %r15,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xec0(%rip),%r12
mov    %rbx,%rdi
mov    $0x3,%esi
mov    %r12,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeb5(%rip),%r13
mov    %rbx,%rdi
mov    $0x4,%esi
mov    %r13,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    %r14,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
mov    %r15,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
mov    %r12,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
mov    %r13,%rdx
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
jmp    1040 <printf@plt>

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

LLVM IR (-O2):
@.str = [23 x i8] c"C Programming Language\00"
@.str.1 = [18 x i8] c"Assembly Language\00"
@.str.2 = [14 x i8] c"Java Language\00"
@.str.3 = [17 x i8] c"Natural Language\00"
@.str.4 = [16 x i8] c"string %d = %s\0A\00"
define void @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i32 1, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i32 2, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i32 3, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i32 4, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0))
%5 = tail call i32 @putchar(i32 10)
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i32 1, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i32 2, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i32 3, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i32 4, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0))
ret void
}