int main() {
  printf("char tipinde diziler\n");
  printf("====================\n");
  int dizi_a[4] = {'T', 'E', 'S', 'T'};
  printf("sizeof(char) : %d\n", sizeof(char));
  printf("sizeof(dizi_a) : %d\n\n", sizeof(dizi_a));
  printf("ilk elemanin adresi : %u\n", &dizi_a[0]);
  printf("ikinci elemanin adresi : %u\n\n", &dizi_a[1]);
  printf("%c\n", dizi_a[2]);
  printf("%u\n\n", &dizi_a[2]);
  printf("int tipinde diziler\n");
  printf("====================\n");
  int dizi_b[3] = {100, 500, 1500};
  printf("sizeof(int) : %d\n", sizeof(int));
  printf("sizeof(dizi_b) : %d\n\n", sizeof(dizi_b));
  printf("ilk elemanin adresi : %u\n", &dizi_b[0]);
  printf("ikinci elemanin adresi : %u\n\n", &dizi_b[1]);
  printf("%d\n", dizi_b[2]);
  printf("%u\n\n", &dizi_b[2]);
  printf("dizinin pointer olarak kullanilmasi\n");
  printf("===================================\n");
  printf("dizi_b[2] : %d\n", dizi_b[2]);
  printf("*(dizi_b + 2) : %d\n\n", *(dizi_b + 2));
  printf("&dizi_b[2] : %u\n", &dizi_b[2]);
  printf("(dizi_b + 2) : %u\n", (dizi_b + 2));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xfb8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x100e(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0x100b(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    0xebe(%rip),%rdi
mov    $0x1,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xebe(%rip),%rdi
mov    $0x10,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x20(%rbp),%rsi
lea    0xebd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x20(%rbp),%rsi
add    $0x4,%rsi
lea    0xec1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%esi
lea    0xece(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x20(%rbp),%rsi
add    $0x8,%rsi
lea    0xeb3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeae(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf11(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0xf77(%rip),%rax
mov    %rax,-0x2c(%rbp)
mov    0xf75(%rip),%eax
mov    %eax,-0x24(%rbp)
lea    0xe93(%rip),%rdi
mov    $0x4,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe92(%rip),%rdi
mov    $0xc,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x2c(%rbp),%rsi
lea    0xe18(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x2c(%rbp),%rsi
add    $0x4,%rsi
lea    0xe1c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x24(%rbp),%esi
lea    0xdd7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x2c(%rbp),%rsi
add    $0x8,%rsi
lea    0xe0e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe46(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe5d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x24(%rbp),%esi
lea    0xe71(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x24(%rbp),%esi
lea    0xe70(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x2c(%rbp),%rsi
add    $0x8,%rsi
lea    0xe6f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x2c(%rbp),%rsi
add    $0x8,%rsi
lea    0xe6a(%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   %r13
push   %r12
push   %rbx
sub    $0x20,%rsp
lea    0xfb2(%rip),%rdi
call   1030 <puts@plt>
lea    0x1002(%rip),%r13
mov    %r13,%rdi
call   1030 <puts@plt>
movaps 0xeb1(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
lea    0xeb5(%rip),%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeb5(%rip),%rdi
mov    $0x10,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeb8(%rip),%r14
lea    0x10(%rsp),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x14(%rsp),%rsi
lea    0xeb7(%rip),%r15
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x18(%rsp),%rbx
mov    0x18(%rsp),%esi
lea    0xebb(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xea8(%rip),%r12
mov    %r12,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xf23(%rip),%rdi
call   1030 <puts@plt>
mov    %r13,%rdi
call   1030 <puts@plt>
mov    0xf75(%rip),%eax
mov    %eax,0x8(%rsp)
mov    0xf62(%rip),%rax
mov    %rax,(%rsp)
lea    0x8(%rsp),%rbx
lea    0xe6f(%rip),%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe6e(%rip),%rdi
mov    $0xc,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rsp,%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x4(%rsp),%rsi
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rsp),%esi
lea    0xdd3(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xea8(%rip),%rdi
call   1030 <puts@plt>
lea    0xec0(%rip),%rdi
call   1030 <puts@plt>
mov    0x8(%rsp),%esi
lea    0xe1a(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rsp),%esi
lea    0xe18(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe1f(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe1f(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [22 x i8] c"char tipinde diziler\0A\00"
@.str.1 = [22 x i8] c"====================\0A\00"
@__const.main.dizi_a = [4 x i32] [i32 84, i32 69, i32 83, i32 84]
@.str.2 = [19 x i8] c"sizeof(char) : %d\0A\00"
@.str.3 = [22 x i8] c"sizeof(dizi_a) : %d\0A\0A\00"
@.str.4 = [26 x i8] c"ilk elemanin adresi : %u\0A\00"
@.str.5 = [30 x i8] c"ikinci elemanin adresi : %u\0A\0A\00"
@.str.6 = [4 x i8] c"%c\0A\00"
@.str.7 = [5 x i8] c"%u\0A\0A\00"
@.str.8 = [21 x i8] c"int tipinde diziler\0A\00"
@__const.main.dizi_b = [3 x i32] [i32 100, i32 500, i32 1500]
@.str.9 = [18 x i8] c"sizeof(int) : %d\0A\00"
@.str.10 = [22 x i8] c"sizeof(dizi_b) : %d\0A\0A\00"
@.str.11 = [4 x i8] c"%d\0A\00"
@.str.12 = [37 x i8] c"dizinin pointer olarak kullanilmasi\0A\00"
@.str.13 = [37 x i8] c"===================================\0A\00"
@.str.14 = [16 x i8] c"dizi_b[2] : %d\0A\00"
@.str.15 = [21 x i8] c"*(dizi_b + 2) : %d\0A\0A\00"
@.str.16 = [17 x i8] c"&dizi_b[2] : %u\0A\00"
@.str.17 = [19 x i8] c"(dizi_b + 2) : %u\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [4 x i32]
%3 = alloca [3 x i32]
store i32 0, i32* %1
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%6 = bitcast [4 x i32]* %2 to i8*
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i64 1)
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i64 16)
%9 = getelementptr inbounds [4 x i32], [4 x i32]* %2, i64 0, i64 0
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0), i32* %9)
%11 = getelementptr inbounds [4 x i32], [4 x i32]* %2, i64 0, i64 1
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0), i32* %11)
%13 = getelementptr inbounds [4 x i32], [4 x i32]* %2, i64 0, i64 2
%14 = load i32, i32* %13
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %14)
%16 = getelementptr inbounds [4 x i32], [4 x i32]* %2, i64 0, i64 2
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i32* %16)
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.8, i64 0, i64 0))
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%20 = bitcast [3 x i32]* %3 to i8*
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.9, i64 0, i64 0), i64 4)
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.10, i64 0, i64 0), i64 12)
%23 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 0
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0), i32* %23)
%25 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 1
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0), i32* %25)
%27 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 2
%28 = load i32, i32* %27
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.11, i64 0, i64 0), i32 %28)
%30 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 2
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i32* %30)
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.12, i64 0, i64 0))
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.13, i64 0, i64 0))
%34 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 2
%35 = load i32, i32* %34
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.14, i64 0, i64 0), i32 %35)
%37 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 0
%38 = getelementptr inbounds i32, i32* %37, i64 2
%39 = load i32, i32* %38
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.15, i64 0, i64 0), i32 %39)
%41 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 2
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.16, i64 0, i64 0), i32* %41)
%43 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 0
%44 = getelementptr inbounds i32, i32* %43, i64 2
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.17, i64 0, i64 0), i32* %44)
ret i32 0
}

LLVM IR (-O2):
@__const.main.dizi_a = [4 x i32] [i32 84, i32 69, i32 83, i32 84]
@.str.2 = [19 x i8] c"sizeof(char) : %d\0A\00"
@.str.3 = [22 x i8] c"sizeof(dizi_a) : %d\0A\0A\00"
@.str.4 = [26 x i8] c"ilk elemanin adresi : %u\0A\00"
@.str.5 = [30 x i8] c"ikinci elemanin adresi : %u\0A\0A\00"
@.str.6 = [4 x i8] c"%c\0A\00"
@.str.7 = [5 x i8] c"%u\0A\0A\00"
@__const.main.dizi_b = [3 x i32] [i32 100, i32 500, i32 1500]
@.str.9 = [18 x i8] c"sizeof(int) : %d\0A\00"
@.str.10 = [22 x i8] c"sizeof(dizi_b) : %d\0A\0A\00"
@.str.11 = [4 x i8] c"%d\0A\00"
@.str.14 = [16 x i8] c"dizi_b[2] : %d\0A\00"
@.str.15 = [21 x i8] c"*(dizi_b + 2) : %d\0A\0A\00"
@.str.16 = [17 x i8] c"&dizi_b[2] : %u\0A\00"
@.str.17 = [19 x i8] c"(dizi_b + 2) : %u\0A\00"
@str = [21 x i8] c"char tipinde diziler\00"
@str.19 = [20 x i8] c"int tipinde diziler\00"
@str.20 = [21 x i8] c"====================\00"
@str.21 = [36 x i8] c"dizinin pointer olarak kullanilmasi\00"
@str.22 = [36 x i8] c"===================================\00"
define i32 @main() {
%1 = alloca [4 x i32]
%2 = alloca [3 x i32]
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.20, i64 0, i64 0))
%5 = bitcast [4 x i32]* %1 to i8*
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i64 1)
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i64 16)
%8 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 0
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0), i32* %8)
%10 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 1
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0), i32* %10)
%12 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 2
%13 = load i32, i32* %12
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %13)
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i32* %12)
%16 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.19, i64 0, i64 0))
%17 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.20, i64 0, i64 0))
%18 = bitcast [3 x i32]* %2 to i8*
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.9, i64 0, i64 0), i64 4)
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.10, i64 0, i64 0), i64 12)
%21 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 0
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0), i32* %21)
%23 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 1
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0), i32* %23)
%25 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 2
%26 = load i32, i32* %25
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.11, i64 0, i64 0), i32 %26)
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i32* %25)
%29 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str.21, i64 0, i64 0))
%30 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str.22, i64 0, i64 0))
%31 = load i32, i32* %25
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.14, i64 0, i64 0), i32 %31)
%33 = load i32, i32* %25
%34 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.15, i64 0, i64 0), i32 %33)
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.16, i64 0, i64 0), i32* %25)
%36 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.17, i64 0, i64 0), i32* %25)
ret i32 0
}