#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 */
typedef int /*<<< orphan*/ ptr;
typedef int /*<<< orphan*/ array;

/* Variables and functions */
int /*<<< orphan*/ print_array(int *, int);
int /*<<< orphan*/ print_pointer(int *, int);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  int array[5];
  int *ptr = array;
  int ii;
  printf("Sizes: array: %d, ptr: %d\n", sizeof(array), sizeof(ptr));
  for (ii = 0; ii < 5; ii++)
    array[ii] = ii * 10;
  for (ii = 0; ii < 5; ii++)
    printf("%d: array[%d]=%2d  *(ptr+%d) = %2d\n", ii, ii, array[ii], ii,
           *(ptr + ii));
  printf("\nprint_array(array, COUNT)\n");
  print_array(array, 5);
  printf("\nprint_array(ptr, COUNT)\n");
  print_array(ptr, 5);
  printf("\nprint_array(&array[0], COUNT)\n");
  print_array(&array[0], 5);
  printf("\n\nprint_pointer(array, COUNT)\n");
  print_pointer(array, 5);
  printf("\nprint_pointer(ptr, COUNT)\n");
  print_pointer(ptr, 5);
  printf("\nprint_pointer(&array[0], COUNT)\n");
  print_pointer(&array[0], 5);
  printf("\n\narray indexing:\n  ");
  for (ii = 0; ii < 5; ii++) {
    printf("%d ", array[ii]);
  }
  printf("\n");
  printf("pointer arithmetic:\n  ");
  for (ii = 0; ii < 5; ii++) {
    printf("%d ", *(ptr + ii));
  }
  printf("\n");
  printf("\narray indexing with pointer variable:\n  ");
  for (ii = 0; ii < 5; ii++) {
    printf("%d ", ptr[ii]);
  }
  printf("\n");
  printf("pointer arithmetic with an array name:\n  ");
  for (ii = 0; ii < 5; ii++) {
    printf("%d ", *(array + ii));
  }
  printf("\n");
  printf("Are arrays and pointers the same?\n");
  printf("  size of arr=%d\n", sizeof(array));
  printf("  size of ptr=%d\n", sizeof(ptr));
  ptr = &ii;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
lea    0xeb2(%rip),%rdi
mov    $0x14,%esi
mov    $0x8,%edx
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x2c(%rbp)
cmpl   $0x5,-0x2c(%rbp)
jge    118a <main+0x5a>
imul   $0xa,-0x2c(%rbp),%ecx
movslq -0x2c(%rbp),%rax
mov    %ecx,-0x20(%rbp,%rax,4)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1166 <main+0x36>
movl   $0x0,-0x2c(%rbp)
cmpl   $0x5,-0x2c(%rbp)
jge    11d5 <main+0xa5>
mov    -0x2c(%rbp),%esi
mov    -0x2c(%rbp),%edx
movslq -0x2c(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%ecx
mov    -0x2c(%rbp),%r8d
mov    -0x28(%rbp),%rax
movslq -0x2c(%rbp),%rdi
mov    (%rax,%rdi,4),%r9d
lea    0xe5b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1191 <main+0x61>
lea    0xe63(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x20(%rbp),%rdi
mov    $0x5,%esi
call   1030 <print_array@plt>
lea    0xe63(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x28(%rbp),%rdi
mov    $0x5,%esi
call   1030 <print_array@plt>
lea    0xe61(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x20(%rbp),%rdi
mov    $0x5,%esi
call   1030 <print_array@plt>
lea    0xe65(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x20(%rbp),%rdi
mov    $0x5,%esi
call   1050 <print_pointer@plt>
lea    0xe68(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x28(%rbp),%rdi
mov    $0x5,%esi
call   1050 <print_pointer@plt>
lea    0xe68(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x20(%rbp),%rdi
mov    $0x5,%esi
call   1050 <print_pointer@plt>
lea    0xe6e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x2c(%rbp)
cmpl   $0x5,-0x2c(%rbp)
jge    12c0 <main+0x190>
movslq -0x2c(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%esi
lea    0xe5c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1292 <main+0x162>
lea    0xe29(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe36(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x2c(%rbp)
cmpl   $0x5,-0x2c(%rbp)
jge    1314 <main+0x1e4>
mov    -0x28(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe08(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    12e3 <main+0x1b3>
lea    0xdd5(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xdf9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x2c(%rbp)
cmpl   $0x5,-0x2c(%rbp)
jge    1368 <main+0x238>
mov    -0x28(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xdb4(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1337 <main+0x207>
lea    0xd81(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xdcf(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x2c(%rbp)
cmpl   $0x5,-0x2c(%rbp)
jge    13b9 <main+0x289>
movslq -0x2c(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%esi
lea    0xd63(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    138b <main+0x25b>
lea    0xd30(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xda8(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xdbd(%rip),%rdi
mov    $0x14,%esi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xdbc(%rip),%rdi
mov    $0x8,%esi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x2c(%rbp),%rax
mov    %rax,-0x28(%rbp)
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
lea    0xeb4(%rip),%rdi
mov    $0x14,%esi
mov    $0x8,%edx
xor    %eax,%eax
call   1060 <printf@plt>
movaps 0xe8c(%rip),%xmm0
movaps %xmm0,(%rsp)
movl   $0x28,0x10(%rsp)
lea    0xea4(%rip),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
xor    %r9d,%r9d
xor    %eax,%eax
call   1060 <printf@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x1,%edx
mov    $0xa,%ecx
mov    $0x1,%r8d
mov    $0xa,%r9d
xor    %eax,%eax
call   1060 <printf@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
mov    $0x2,%edx
mov    $0x14,%ecx
mov    $0x2,%r8d
mov    $0x14,%r9d
xor    %eax,%eax
call   1060 <printf@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
mov    $0x3,%edx
mov    $0x1e,%ecx
mov    $0x3,%r8d
mov    $0x1e,%r9d
xor    %eax,%eax
call   1060 <printf@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
mov    $0x4,%edx
mov    $0x28,%ecx
mov    $0x4,%r8d
mov    $0x28,%r9d
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xebf(%rip),%rdi
call   1040 <puts@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x5,%esi
call   1050 <print_array@plt>
lea    0xebe(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
call   1050 <print_array@plt>
lea    0xebe(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
call   1050 <print_array@plt>
lea    0xec4(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
call   1070 <print_pointer@plt>
lea    0xec9(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
call   1070 <print_pointer@plt>
lea    0xecb(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
call   1070 <print_pointer@plt>
lea    0xd7e(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    (%rsp),%esi
lea    0xd82(%rip),%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x4(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x8(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x10(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xd33(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    (%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x4(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x8(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x10(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xced(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    (%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x4(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x8(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x10(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xcba(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    (%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x4(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x8(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x10(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xd58(%rip),%rdi
call   1040 <puts@plt>
lea    0xc7b(%rip),%rdi
mov    $0x14,%esi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xc7a(%rip),%rdi
mov    $0x8,%esi
xor    %eax,%eax
call   1060 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [27 x i8] c"Sizes: array: %d, ptr: %d\0A\00"
@.str.1 = [36 x i8] c"%d: array[%d]=%2d *(ptr+%d) = %2d\0A\00"
@.str.2 = [28 x i8] c"\0Aprint_array(array, COUNT)\0A\00"
@.str.3 = [26 x i8] c"\0Aprint_array(ptr, COUNT)\0A\00"
@.str.4 = [32 x i8] c"\0Aprint_array(&array[0], COUNT)\0A\00"
@.str.5 = [31 x i8] c"\0A\0Aprint_pointer(array, COUNT)\0A\00"
@.str.6 = [28 x i8] c"\0Aprint_pointer(ptr, COUNT)\0A\00"
@.str.7 = [34 x i8] c"\0Aprint_pointer(&array[0], COUNT)\0A\00"
@.str.8 = [21 x i8] c"\0A\0Aarray indexing:\0A \00"
@.str.9 = [4 x i8] c"%d \00"
@.str.10 = [2 x i8] c"\0A\00"
@.str.11 = [23 x i8] c"pointer arithmetic:\0A \00"
@.str.12 = [42 x i8] c"\0Aarray indexing with pointer variable:\0A \00"
@.str.13 = [42 x i8] c"pointer arithmetic with an array name:\0A \00"
@.str.14 = [35 x i8] c"Are arrays and pointers the same?\0A\00"
@.str.15 = [18 x i8] c" size of arr=%d\0A\00"
@.str.16 = [18 x i8] c" size of ptr=%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [5 x i32]
%3 = alloca i32*
%4 = alloca i32
store i32 0, i32* %1
%5 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 0
store i32* %5, i32** %3
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i64 20, i64 8)
store i32 0, i32* %4
br label %7
7: ; preds = %16, %0
%8 = load i32, i32* %4
%9 = icmp slt i32 %8, 5
br i1 %9, label %10, label %19
10: ; preds = %7
%11 = load i32, i32* %4
%12 = mul nsw i32 %11, 10
%13 = load i32, i32* %4
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 %14
store i32 %12, i32* %15
br label %16
16: ; preds = %10
%17 = load i32, i32* %4
%18 = add nsw i32 %17, 1
store i32 %18, i32* %4
br label %7
19: ; preds = %7
store i32 0, i32* %4
br label %20
20: ; preds = %37, %19
%21 = load i32, i32* %4
%22 = icmp slt i32 %21, 5
br i1 %22, label %23, label %40
23: ; preds = %20
%24 = load i32, i32* %4
%25 = load i32, i32* %4
%26 = load i32, i32* %4
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 %27
%29 = load i32, i32* %28
%30 = load i32, i32* %4
%31 = load i32*, i32** %3
%32 = load i32, i32* %4
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds i32, i32* %31, i64 %33
%35 = load i32, i32* %34
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0), i32 %24, i32 %25, i32 %29, i32 %30, i32 %35)
br label %37
37: ; preds = %23
%38 = load i32, i32* %4
%39 = add nsw i32 %38, 1
store i32 %39, i32* %4
br label %20
40: ; preds = %20
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0))
%42 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 0
%43 = call i32 @print_array(i32* %42, i32 5)
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
%45 = load i32*, i32** %3
%46 = call i32 @print_array(i32* %45, i32 5)
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.4, i64 0, i64 0))
%48 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 0
%49 = call i32 @print_array(i32* %48, i32 5)
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.5, i64 0, i64 0))
%51 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 0
%52 = call i32 @print_pointer(i32* %51, i32 5)
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0))
%54 = load i32*, i32** %3
%55 = call i32 @print_pointer(i32* %54, i32 5)
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.7, i64 0, i64 0))
%57 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 0
%58 = call i32 @print_pointer(i32* %57, i32 5)
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.8, i64 0, i64 0))
store i32 0, i32* %4
br label %60
60: ; preds = %69, %40
%61 = load i32, i32* %4
%62 = icmp slt i32 %61, 5
br i1 %62, label %63, label %72
63: ; preds = %60
%64 = load i32, i32* %4
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 %65
%67 = load i32, i32* %66
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i32 %67)
br label %69
69: ; preds = %63
%70 = load i32, i32* %4
%71 = add nsw i32 %70, 1
store i32 %71, i32* %4
br label %60
72: ; preds = %60
%73 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0))
%74 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.11, i64 0, i64 0))
store i32 0, i32* %4
br label %75
75: ; preds = %85, %72
%76 = load i32, i32* %4
%77 = icmp slt i32 %76, 5
br i1 %77, label %78, label %88
78: ; preds = %75
%79 = load i32*, i32** %3
%80 = load i32, i32* %4
%81 = sext i32 %80 to i64
%82 = getelementptr inbounds i32, i32* %79, i64 %81
%83 = load i32, i32* %82
%84 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i32 %83)
br label %85
85: ; preds = %78
%86 = load i32, i32* %4
%87 = add nsw i32 %86, 1
store i32 %87, i32* %4
br label %75
88: ; preds = %75
%89 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0))
%90 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.12, i64 0, i64 0))
store i32 0, i32* %4
br label %91
91: ; preds = %101, %88
%92 = load i32, i32* %4
%93 = icmp slt i32 %92, 5
br i1 %93, label %94, label %104
94: ; preds = %91
%95 = load i32*, i32** %3
%96 = load i32, i32* %4
%97 = sext i32 %96 to i64
%98 = getelementptr inbounds i32, i32* %95, i64 %97
%99 = load i32, i32* %98
%100 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i32 %99)
br label %101
101: ; preds = %94
%102 = load i32, i32* %4
%103 = add nsw i32 %102, 1
store i32 %103, i32* %4
br label %91
104: ; preds = %91
%105 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0))
%106 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.13, i64 0, i64 0))
store i32 0, i32* %4
br label %107
107: ; preds = %117, %104
%108 = load i32, i32* %4
%109 = icmp slt i32 %108, 5
br i1 %109, label %110, label %120
110: ; preds = %107
%111 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 0
%112 = load i32, i32* %4
%113 = sext i32 %112 to i64
%114 = getelementptr inbounds i32, i32* %111, i64 %113
%115 = load i32, i32* %114
%116 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i32 %115)
br label %117
117: ; preds = %110
%118 = load i32, i32* %4
%119 = add nsw i32 %118, 1
store i32 %119, i32* %4
br label %107
120: ; preds = %107
%121 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0))
%122 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.14, i64 0, i64 0))
%123 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.15, i64 0, i64 0), i64 20)
%124 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.16, i64 0, i64 0), i64 8)
store i32* %4, i32** %3
ret i32 0
}

LLVM IR (-O2):
@.str = [27 x i8] c"Sizes: array: %d, ptr: %d\0A\00"
@.str.1 = [36 x i8] c"%d: array[%d]=%2d *(ptr+%d) = %2d\0A\00"
@.str.8 = [21 x i8] c"\0A\0Aarray indexing:\0A \00"
@.str.9 = [4 x i8] c"%d \00"
@.str.11 = [23 x i8] c"pointer arithmetic:\0A \00"
@.str.12 = [42 x i8] c"\0Aarray indexing with pointer variable:\0A \00"
@.str.13 = [42 x i8] c"pointer arithmetic with an array name:\0A \00"
@.str.15 = [18 x i8] c" size of arr=%d\0A\00"
@.str.16 = [18 x i8] c" size of ptr=%d\0A\00"
@str = [27 x i8] c"\0Aprint_array(array, COUNT)\00"
@str.17 = [25 x i8] c"\0Aprint_array(ptr, COUNT)\00"
@str.18 = [31 x i8] c"\0Aprint_array(&array[0], COUNT)\00"
@str.19 = [30 x i8] c"\0A\0Aprint_pointer(array, COUNT)\00"
@str.20 = [27 x i8] c"\0Aprint_pointer(ptr, COUNT)\00"
@str.21 = [33 x i8] c"\0Aprint_pointer(&array[0], COUNT)\00"
@str.22 = [34 x i8] c"Are arrays and pointers the same?\00"
define i32 @main() {
%1 = alloca [5 x i32]
%2 = bitcast [5 x i32]* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i64 20, i64 8)
%4 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 0
%5 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 1
%6 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 2
%7 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 3
%8 = bitcast [5 x i32]* %1 to <4 x i32>*
store <4 x i32> <i32 0, i32 10, i32 20, i32 30>, <4 x i32>* %8
%9 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 4
store i32 40, i32* %9
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0), i32 0, i32 0, i32 0, i32 0, i32 0)
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0), i32 1, i32 1, i32 10, i32 1, i32 10)
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0), i32 2, i32 2, i32 20, i32 2, i32 20)
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0), i32 3, i32 3, i32 30, i32 3, i32 30)
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0), i32 4, i32 4, i32 40, i32 4, i32 40)
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str, i64 0, i64 0))
%16 = call i32 @print_array(i32* %4, i32 5)
%17 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.17, i64 0, i64 0))
%18 = call i32 @print_array(i32* %4, i32 5)
%19 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str.18, i64 0, i64 0))
%20 = call i32 @print_array(i32* %4, i32 5)
%21 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str.19, i64 0, i64 0))
%22 = call i32 @print_pointer(i32* %4, i32 5)
%23 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.20, i64 0, i64 0))
%24 = call i32 @print_pointer(i32* %4, i32 5)
%25 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.21, i64 0, i64 0))
%26 = call i32 @print_pointer(i32* %4, i32 5)
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.8, i64 0, i64 0))
%28 = load i32, i32* %4
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i32 %28)
%30 = load i32, i32* %5
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i32 %30)
%32 = load i32, i32* %6
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i32 %32)
%34 = load i32, i32* %7
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i32 %34)
%36 = load i32, i32* %9
%37 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i32 %36)
%38 = call i32 @putchar(i32 10)
%39 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.11, i64 0, i64 0))
%40 = load i32, i32* %4
%41 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i32 %40)
%42 = load i32, i32* %5
%43 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i32 %42)
%44 = load i32, i32* %6
%45 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i32 %44)
%46 = load i32, i32* %7
%47 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i32 %46)
%48 = load i32, i32* %9
%49 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i32 %48)
%50 = call i32 @putchar(i32 10)
%51 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.12, i64 0, i64 0))
%52 = load i32, i32* %4
%53 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i32 %52)
%54 = load i32, i32* %5
%55 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i32 %54)
%56 = load i32, i32* %6
%57 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i32 %56)
%58 = load i32, i32* %7
%59 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i32 %58)
%60 = load i32, i32* %9
%61 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i32 %60)
%62 = call i32 @putchar(i32 10)
%63 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.13, i64 0, i64 0))
%64 = load i32, i32* %4
%65 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i32 %64)
%66 = load i32, i32* %5
%67 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i32 %66)
%68 = load i32, i32* %6
%69 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i32 %68)
%70 = load i32, i32* %7
%71 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i32 %70)
%72 = load i32, i32* %9
%73 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i32 %72)
%74 = call i32 @putchar(i32 10)
%75 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str.22, i64 0, i64 0))
%76 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.15, i64 0, i64 0), i64 20)
%77 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.16, i64 0, i64 0), i64 8)
ret i32 0
}