#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*/ vec;

/* Variables and functions */
int EXIT_SUCCESS;
int /*<<< orphan*/ printf(char *, ...);
int main(void) {
  int vec[10] = {98, 16, 24, 10, 87, 28, 93, 11, 54, 92};
  int *ptr = vec;
  printf("            Array: ");
  for (int i = 0; i < sizeof(vec) / sizeof(vec[0]); i++)
    printf("%d, ", vec[i]);
  printf("\nAddress of vector: %d %p \n", *ptr, (void *)ptr);
  ptr++;
  printf("ptr + %d (%2d byte): %d %p\n", 1, 4, *ptr, (void *)ptr);
  ptr += 1;
  printf("ptr + %d (%2d byte): %d %p\n", 1, 4, *ptr, (void *)ptr);
  printf("ptr + %d (%2d byte): %d %p\n", 4, 16, *(ptr + 4), (void *)(ptr + 4));
  return (EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
lea    0xec6(%rip),%rsi
mov    $0x28,%edx
call   1040 <memcpy@plt>
lea    -0x30(%rbp),%rax
mov    %rax,-0x38(%rbp)
lea    0xed5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x3c(%rbp)
movslq -0x3c(%rbp),%rax
cmp    $0xa,%rax
jae    1193 <main+0x73>
movslq -0x3c(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%esi
lea    0xebe(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    1161 <main+0x41>
mov    -0x38(%rbp),%rax
mov    (%rax),%esi
mov    -0x38(%rbp),%rdx
lea    0xe9d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x38(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
mov    (%rax),%ecx
mov    -0x38(%rbp),%r8
lea    0xe95(%rip),%rdi
mov    $0x1,%esi
mov    $0x4,%edx
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x38(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
mov    (%rax),%ecx
mov    -0x38(%rbp),%r8
lea    0xe67(%rip),%rdi
mov    $0x1,%esi
mov    $0x4,%edx
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x38(%rbp),%rax
mov    0x10(%rax),%ecx
mov    -0x38(%rbp),%r8
add    $0x10,%r8
lea    0xe40(%rip),%rdi
mov    $0x4,%esi
mov    $0x10,%edx
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2dab(%rip),%rax
mov    (%rax),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    0xefe(%rip),%rax
mov    %rax,0x20(%rsp)
movaps 0xee2(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xec6(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0xee3(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xee9(%rip),%rbx
mov    %rbx,%rdi
mov    $0x62,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x4(%rsp),%r15
mov    %rbx,%rdi
mov    $0x10,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x8(%rsp),%r14
mov    %rbx,%rdi
mov    $0x18,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x57,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x1c,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x18(%rsp),%r12
mov    %rbx,%rdi
mov    $0x5d,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0xb,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x36,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x5c,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe42(%rip),%rdi
mov    %rsp,%rdx
mov    $0x62,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x4(%rsp),%ecx
lea    0xe44(%rip),%rbx
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x4,%edx
mov    %r15,%r8
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x8(%rsp),%ecx
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x4,%edx
mov    %r14,%r8
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x18(%rsp),%ecx
mov    %rbx,%rdi
mov    $0x4,%esi
mov    $0x10,%edx
mov    %r12,%r8
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x2d73(%rip),%rax
mov    (%rax),%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.main.vec = [10 x i32] [i32 98, i32 16, i32 24, i32 10, i32 87, i32 28, i32 93, i32 11, i32 54, i32 92]
@.str = [20 x i8] c" Array: \00"
@.str.1 = [5 x i8] c"%d, \00"
@.str.2 = [28 x i8] c"\0AAddress of vector: %d %p \0A\00"
@.str.3 = [28 x i8] c"ptr + %d (%2d byte): %d %p\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i32]
%3 = alloca i32*
%4 = alloca i32
store i32 0, i32* %1
%5 = bitcast [10 x i32]* %2 to i8*
%6 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
store i32* %6, i32** %3
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %4
br label %8
8: ; preds = %18, %0
%9 = load i32, i32* %4
%10 = sext i32 %9 to i64
%11 = icmp ult i64 %10, 10
br i1 %11, label %12, label %21
12: ; preds = %8
%13 = load i32, i32* %4
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %14
%16 = load i32, i32* %15
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %16)
br label %18
18: ; preds = %12
%19 = load i32, i32* %4
%20 = add nsw i32 %19, 1
store i32 %20, i32* %4
br label %8
21: ; preds = %8
%22 = load i32*, i32** %3
%23 = load i32, i32* %22
%24 = load i32*, i32** %3
%25 = bitcast i32* %24 to i8*
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i32 %23, i8* %25)
%27 = load i32*, i32** %3
%28 = getelementptr inbounds i32, i32* %27, i32 1
store i32* %28, i32** %3
%29 = load i32*, i32** %3
%30 = load i32, i32* %29
%31 = load i32*, i32** %3
%32 = bitcast i32* %31 to i8*
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i32 1, i32 4, i32 %30, i8* %32)
%34 = load i32*, i32** %3
%35 = getelementptr inbounds i32, i32* %34, i64 1
store i32* %35, i32** %3
%36 = load i32*, i32** %3
%37 = load i32, i32* %36
%38 = load i32*, i32** %3
%39 = bitcast i32* %38 to i8*
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i32 1, i32 4, i32 %37, i8* %39)
%41 = load i32*, i32** %3
%42 = getelementptr inbounds i32, i32* %41, i64 4
%43 = load i32, i32* %42
%44 = load i32*, i32** %3
%45 = getelementptr inbounds i32, i32* %44, i64 4
%46 = bitcast i32* %45 to i8*
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i32 4, i32 16, i32 %43, i8* %46)
%48 = load i32, i32* @EXIT_SUCCESS
ret i32 %48
}

LLVM IR (-O2):
@__const.main.vec = [10 x i32] [i32 98, i32 16, i32 24, i32 10, i32 87, i32 28, i32 93, i32 11, i32 54, i32 92]
@.str = [20 x i8] c" Array: \00"
@.str.1 = [5 x i8] c"%d, \00"
@.str.2 = [28 x i8] c"\0AAddress of vector: %d %p \0A\00"
@.str.3 = [28 x i8] c"ptr + %d (%2d byte): %d %p\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca [10 x i32]
%2 = bitcast [10 x i32]* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 98)
%5 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 1
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 16)
%7 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 2
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 24)
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 10)
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 87)
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 28)
%12 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 6
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 93)
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 11)
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 54)
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 92)
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i32 98, [10 x i32]* %1)
%18 = load i32, i32* %5
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i32 1, i32 4, i32 %18, i32* %5)
%20 = load i32, i32* %7
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i32 1, i32 4, i32 %20, i32* %7)
%22 = load i32, i32* %12
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i32 4, i32 16, i32 %22, i32* %12)
%24 = load i32, i32* @EXIT_SUCCESS
ret i32 %24
}