#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 *, ...);
int integerPointer() {
  printf("testing pointers understanding! ==integerPointer start== \n\n");
  int x, y, a, b;
  long int c;
  int *ip;
  x = 1;
  y = 2;
  a = 31;
  b = 32;
  c = 53;
  ip = &x;
  printf("x  %i and x  address is %p \n", x, (void *)&x);
  printf("y  %i and y  address is %p \n", y, (void *)&y);
  printf("a  %i and a  address is %p \n", a, (void *)&a);
  printf("b  %i and b  address is %p \n", b, (void *)&b);
  printf("c  %li and c  address is %p \n", c, (void *)&c);
  printf("ip %i and ip address is %p \n", *ip, (void *)ip);
  x = 13;
  printf("\nafter x changed to 13\n\n");
  printf("x  %i and x  address is %p \n", x, (void *)&x);
  printf("y  %i and y  address is %p \n", y, (void *)&y);
  printf("ip %i and ip address is %p \n", *ip, (void *)ip);
  y = *ip;
  printf("\nafter y changed to *ip\n\n");
  printf("x  %i and x  address is %p \n", x, (void *)&x);
  printf("y  %i and y  address is %p \n", y, (void *)&y);
  printf("ip %i and ip address is %p \n", *ip, (void *)ip);
  printf("you do not use ip on the rhs and use on the lhs for &");
  x = ip;
  printf("\nafter x changed to ip -- warning - not right as ip is *int and x "
         "is int type\n\n");
  printf("\nafter x changed to ip -- lost some info as int cannot store the "
         "address\n\n");
  printf("x  0x%x and x  address is %p \n", x, (void *)&x);
  printf("x  %i and x  address is %p \n", x, (void *)&x);
  printf("y  %i and y  address is %p \n", y, (void *)&y);
  printf("ip %i and ip address is %p \n", *ip, (void *)ip);
  *ip = 42;
  printf("\nafter ip content is still the old x address and *ip = &x changed "
         "to 42\n\n");
  printf("x  %i and x  address is %p \n", x, (void *)&x);
  printf("y  %i and y  address is %p \n", y, (void *)&y);
  printf("ip %i and ip address is %p \n", *ip, (void *)ip);
  printf("\n");
  printf("when = x i.e. x is on the rhs, the address of x is use to get     "
         "the content pointed by it to   LHS\n");
  printf("when x = i.e. x is on the lhs, the address of x is use to replace "
         "the content pointed by it from LHS\n");
  printf("similar except it is address of x here\n");
  printf("when = *ip i.e. *ip is on the rhs, the address in ip is use to get   "
         "  the content pointed by it to   LHS\n");
  printf("when *ip = i.e. *ip is on the lhs, the address in ip is use to "
         "replace the content pointed by it from LHS\n");
  printf("similar except it is address in ip here\n");
  printf("you do not use ip on the rhs and use on the lhs for &");
  printf("\n");
  printf("testing pointers understanding! ==integerPointer end== \n\n");
  return 0;
}


x86 assembly (clang, -O0):
<integerPointer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xee1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
movl   $0x2,-0x8(%rbp)
movl   $0x1f,-0xc(%rbp)
movl   $0x20,-0x10(%rbp)
movq   $0x35,-0x18(%rbp)
lea    -0x4(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x4(%rbp),%esi
lea    -0x4(%rbp),%rdx
lea    0xedc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
lea    -0x8(%rbp),%rdx
lea    0xee4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%esi
lea    -0xc(%rbp),%rdx
lea    0xeec(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%esi
lea    -0x10(%rbp),%rdx
lea    0xef4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rsi
lea    -0x18(%rbp),%rdx
lea    0xefb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%rax
mov    (%rax),%esi
mov    -0x20(%rbp),%rdx
lea    0xf01(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0xd,-0x4(%rbp)
lea    0xf09(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%esi
lea    -0x4(%rbp),%rdx
lea    0xe45(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
lea    -0x8(%rbp),%rdx
lea    0xe4d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%rax
mov    (%rax),%esi
mov    -0x20(%rbp),%rdx
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
lea    0xec9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%esi
lea    -0x4(%rbp),%rdx
lea    0xdec(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
lea    -0x8(%rbp),%rdx
lea    0xdf4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%rax
mov    (%rax),%esi
mov    -0x20(%rbp),%rdx
lea    0xe51(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe93(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%rax
mov    %eax,-0x4(%rbp)
lea    0xeb4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xef6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%esi
lea    -0x4(%rbp),%rdx
lea    0xf2c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%esi
lea    -0x4(%rbp),%rdx
lea    0xd64(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
lea    -0x8(%rbp),%rdx
lea    0xd6c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%rax
mov    (%rax),%esi
mov    -0x20(%rbp),%rdx
lea    0xdc9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%rax
movl   $0x2a,(%rax)
lea    0xef1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%esi
lea    -0x4(%rbp),%rdx
lea    0xd0a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
lea    -0x8(%rbp),%rdx
lea    0xd12(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%rax
mov    (%rax),%esi
mov    -0x20(%rbp),%rdx
lea    0xd6f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0x1116(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xedd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf35(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf8d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xfa7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0x1004(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0x1061(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xd4f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0x10a6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0x1060(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<integerPointer>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xfbf(%rip),%rdi
call   1040 <puts@plt>
movl   $0x1,(%rsp)
movl   $0x2,0x4(%rsp)
movl   $0x1f,0xc(%rsp)
movl   $0x20,0x8(%rsp)
movq   $0x35,0x10(%rsp)
lea    0xe87(%rip),%r14
mov    %rsp,%rbx
mov    %r14,%rdi
mov    $0x1,%esi
mov    %rbx,%rdx
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe88(%rip),%r15
lea    0x4(%rsp),%r12
mov    %r15,%rdi
mov    $0x2,%esi
mov    %r12,%rdx
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe87(%rip),%rdi
lea    0xc(%rsp),%rdx
mov    $0x1f,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe8c(%rip),%rdi
lea    0x8(%rsp),%rdx
mov    $0x20,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe91(%rip),%rdi
lea    0x10(%rsp),%rdx
mov    $0x35,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    (%rsp),%esi
lea    0xe94(%rip),%r13
mov    %r13,%rdi
mov    %rbx,%rdx
xor    %eax,%eax
call   1050 <printf@plt>
movl   $0xd,(%rsp)
lea    0xf26(%rip),%rdi
call   1040 <puts@plt>
mov    (%rsp),%esi
mov    %r14,%rdi
mov    %rbx,%rdx
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x4(%rsp),%esi
mov    %r15,%rdi
mov    %r12,%rdx
xor    %eax,%eax
call   1050 <printf@plt>
mov    (%rsp),%esi
mov    %r13,%rdi
mov    %rbx,%rdx
xor    %eax,%eax
call   1050 <printf@plt>
mov    (%rsp),%eax
mov    %eax,0x4(%rsp)
lea    0xefa(%rip),%rdi
call   1040 <puts@plt>
mov    (%rsp),%esi
mov    %r14,%rdi
mov    %rbx,%rdx
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x4(%rsp),%esi
mov    %r15,%rdi
mov    %r12,%rdx
xor    %eax,%eax
call   1050 <printf@plt>
mov    (%rsp),%esi
mov    %r13,%rdi
mov    %rbx,%rdx
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe15(%rip),%rbp
mov    %rbp,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %ebx,(%rsp)
lea    0xec2(%rip),%rdi
call   1040 <puts@plt>
lea    0xf05(%rip),%rdi
call   1040 <puts@plt>
mov    (%rsp),%esi
lea    0xe1c(%rip),%rdi
mov    %rbx,%rdx
xor    %eax,%eax
call   1050 <printf@plt>
mov    (%rsp),%esi
mov    %r14,%rdi
mov    %rbx,%rdx
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x4(%rsp),%esi
mov    %r15,%rdi
mov    %r12,%rdx
xor    %eax,%eax
call   1050 <printf@plt>
mov    (%rsp),%esi
mov    %r13,%rdi
mov    %rbx,%rdx
xor    %eax,%eax
call   1050 <printf@plt>
movl   $0x2a,(%rsp)
lea    0xef7(%rip),%rdi
call   1040 <puts@plt>
mov    (%rsp),%esi
mov    %r14,%rdi
mov    %rbx,%rdx
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x4(%rsp),%esi
mov    %r15,%rdi
mov    %r12,%rdx
xor    %eax,%eax
call   1050 <printf@plt>
mov    (%rsp),%esi
mov    %r13,%rdi
mov    %rbx,%rdx
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xef9(%rip),%rdi
call   1040 <puts@plt>
lea    0xf52(%rip),%rdi
call   1040 <puts@plt>
lea    0xfab(%rip),%rdi
call   1040 <puts@plt>
lea    0xfc6(%rip),%rdi
call   1040 <puts@plt>
lea    0x1024(%rip),%rdi
call   1040 <puts@plt>
lea    0x1082(%rip),%rdi
call   1040 <puts@plt>
mov    %rbp,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0x108a(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [60 x i8] c"testing pointers understanding! ==integerPointer start== \0A\0A\00"
@.str.1 = [29 x i8] c"x %i and x address is %p \0A\00"
@.str.2 = [29 x i8] c"y %i and y address is %p \0A\00"
@.str.3 = [29 x i8] c"a %i and a address is %p \0A\00"
@.str.4 = [29 x i8] c"b %i and b address is %p \0A\00"
@.str.5 = [30 x i8] c"c %li and c address is %p \0A\00"
@.str.6 = [29 x i8] c"ip %i and ip address is %p \0A\00"
@.str.7 = [25 x i8] c"\0Aafter x changed to 13\0A\0A\00"
@.str.8 = [26 x i8] c"\0Aafter y changed to *ip\0A\0A\00"
@.str.9 = [54 x i8] c"you do not use ip on the rhs and use on the lhs for &\00"
@.str.10 = [80 x i8] c"\0Aafter x changed to ip -- warning - not right as ip is *int and x is int type\0A\0A\00"
@.str.11 = [75 x i8] c"\0Aafter x changed to ip -- lost some info as int cannot store the address\0A\0A\00"
@.str.12 = [31 x i8] c"x 0x%x and x address is %p \0A\00"
@.str.13 = [74 x i8] c"\0Aafter ip content is still the old x address and *ip = &x changed to 42\0A\0A\00"
@.str.14 = [2 x i8] c"\0A\00"
@.str.15 = [102 x i8] c"when = x i.e. x is on the rhs, the address of x is use to get the content pointed by it to LHS\0A\00"
@.str.16 = [102 x i8] c"when x = i.e. x is on the lhs, the address of x is use to replace the content pointed by it from LHS\0A\00"
@.str.17 = [40 x i8] c"similar except it is address of x here\0A\00"
@.str.18 = [107 x i8] c"when = *ip i.e. *ip is on the rhs, the address in ip is use to get the content pointed by it to LHS\0A\00"
@.str.19 = [107 x i8] c"when *ip = i.e. *ip is on the lhs, the address in ip is use to replace the content pointed by it from LHS\0A\00"
@.str.20 = [41 x i8] c"similar except it is address in ip here\0A\00"
@.str.21 = [58 x i8] c"testing pointers understanding! ==integerPointer end== \0A\0A\00"
define i32 @integerPointer() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i64
%6 = alloca i32*
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %1
store i32 2, i32* %2
store i32 31, i32* %3
store i32 32, i32* %4
store i64 53, i64* %5
store i32* %1, i32** %6
%8 = load i32, i32* %1
%9 = bitcast i32* %1 to i8*
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i32 %8, i8* %9)
%11 = load i32, i32* %2
%12 = bitcast i32* %2 to i8*
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i32 %11, i8* %12)
%14 = load i32, i32* %3
%15 = bitcast i32* %3 to i8*
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0), i32 %14, i8* %15)
%17 = load i32, i32* %4
%18 = bitcast i32* %4 to i8*
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0), i32 %17, i8* %18)
%20 = load i64, i64* %5
%21 = bitcast i64* %5 to i8*
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0), i64 %20, i8* %21)
%23 = load i32*, i32** %6
%24 = load i32, i32* %23
%25 = load i32*, i32** %6
%26 = bitcast i32* %25 to i8*
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.6, i64 0, i64 0), i32 %24, i8* %26)
store i32 13, i32* %1
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.7, i64 0, i64 0))
%29 = load i32, i32* %1
%30 = bitcast i32* %1 to i8*
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i32 %29, i8* %30)
%32 = load i32, i32* %2
%33 = bitcast i32* %2 to i8*
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i32 %32, i8* %33)
%35 = load i32*, i32** %6
%36 = load i32, i32* %35
%37 = load i32*, i32** %6
%38 = bitcast i32* %37 to i8*
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.6, i64 0, i64 0), i32 %36, i8* %38)
%40 = load i32*, i32** %6
%41 = load i32, i32* %40
store i32 %41, i32* %2
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.8, i64 0, i64 0))
%43 = load i32, i32* %1
%44 = bitcast i32* %1 to i8*
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i32 %43, i8* %44)
%46 = load i32, i32* %2
%47 = bitcast i32* %2 to i8*
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i32 %46, i8* %47)
%49 = load i32*, i32** %6
%50 = load i32, i32* %49
%51 = load i32*, i32** %6
%52 = bitcast i32* %51 to i8*
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.6, i64 0, i64 0), i32 %50, i8* %52)
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.9, i64 0, i64 0))
%55 = load i32*, i32** %6
%56 = ptrtoint i32* %55 to i32
store i32 %56, i32* %1
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([80 x i8], [80 x i8]* @.str.10, i64 0, i64 0))
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([75 x i8], [75 x i8]* @.str.11, i64 0, i64 0))
%59 = load i32, i32* %1
%60 = bitcast i32* %1 to i8*
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.12, i64 0, i64 0), i32 %59, i8* %60)
%62 = load i32, i32* %1
%63 = bitcast i32* %1 to i8*
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i32 %62, i8* %63)
%65 = load i32, i32* %2
%66 = bitcast i32* %2 to i8*
%67 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i32 %65, i8* %66)
%68 = load i32*, i32** %6
%69 = load i32, i32* %68
%70 = load i32*, i32** %6
%71 = bitcast i32* %70 to i8*
%72 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.6, i64 0, i64 0), i32 %69, i8* %71)
%73 = load i32*, i32** %6
store i32 42, i32* %73
%74 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str.13, i64 0, i64 0))
%75 = load i32, i32* %1
%76 = bitcast i32* %1 to i8*
%77 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i32 %75, i8* %76)
%78 = load i32, i32* %2
%79 = bitcast i32* %2 to i8*
%80 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i32 %78, i8* %79)
%81 = load i32*, i32** %6
%82 = load i32, i32* %81
%83 = load i32*, i32** %6
%84 = bitcast i32* %83 to i8*
%85 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.6, i64 0, i64 0), i32 %82, i8* %84)
%86 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.14, i64 0, i64 0))
%87 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([102 x i8], [102 x i8]* @.str.15, i64 0, i64 0))
%88 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([102 x i8], [102 x i8]* @.str.16, i64 0, i64 0))
%89 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.17, i64 0, i64 0))
%90 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([107 x i8], [107 x i8]* @.str.18, i64 0, i64 0))
%91 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([107 x i8], [107 x i8]* @.str.19, i64 0, i64 0))
%92 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.20, i64 0, i64 0))
%93 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.9, i64 0, i64 0))
%94 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.14, i64 0, i64 0))
%95 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.21, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [29 x i8] c"x %i and x address is %p \0A\00"
@.str.2 = [29 x i8] c"y %i and y address is %p \0A\00"
@.str.3 = [29 x i8] c"a %i and a address is %p \0A\00"
@.str.4 = [29 x i8] c"b %i and b address is %p \0A\00"
@.str.5 = [30 x i8] c"c %li and c address is %p \0A\00"
@.str.6 = [29 x i8] c"ip %i and ip address is %p \0A\00"
@.str.9 = [54 x i8] c"you do not use ip on the rhs and use on the lhs for &\00"
@.str.12 = [31 x i8] c"x 0x%x and x address is %p \0A\00"
@str = [59 x i8] c"testing pointers understanding! ==integerPointer start== \0A\00"
@str.22 = [24 x i8] c"\0Aafter x changed to 13\0A\00"
@str.23 = [25 x i8] c"\0Aafter y changed to *ip\0A\00"
@str.24 = [79 x i8] c"\0Aafter x changed to ip -- warning - not right as ip is *int and x is int type\0A\00"
@str.25 = [74 x i8] c"\0Aafter x changed to ip -- lost some info as int cannot store the address\0A\00"
@str.26 = [73 x i8] c"\0Aafter ip content is still the old x address and *ip = &x changed to 42\0A\00"
@str.27 = [101 x i8] c"when = x i.e. x is on the rhs, the address of x is use to get the content pointed by it to LHS\00"
@str.28 = [101 x i8] c"when x = i.e. x is on the lhs, the address of x is use to replace the content pointed by it from LHS\00"
@str.29 = [39 x i8] c"similar except it is address of x here\00"
@str.30 = [106 x i8] c"when = *ip i.e. *ip is on the rhs, the address in ip is use to get the content pointed by it to LHS\00"
@str.31 = [106 x i8] c"when *ip = i.e. *ip is on the lhs, the address in ip is use to replace the content pointed by it from LHS\00"
@str.32 = [40 x i8] c"similar except it is address in ip here\00"
@str.33 = [57 x i8] c"testing pointers understanding! ==integerPointer end== \0A\00"
define i32 @integerPointer() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i64
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @str, i64 0, i64 0))
%7 = bitcast i32* %1 to i8*
%8 = bitcast i32* %2 to i8*
%9 = bitcast i32* %3 to i8*
%10 = bitcast i32* %4 to i8*
%11 = bitcast i64* %5 to i8*
store i32 1, i32* %1
store i32 2, i32* %2
store i32 31, i32* %3
store i32 32, i32* %4
store i64 53, i64* %5
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i32 1, i32* %1)
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i32 2, i32* %2)
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0), i32 31, i32* %3)
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0), i32 32, i32* %4)
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0), i64 53, i64* %5)
%17 = load i32, i32* %1
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.6, i64 0, i64 0), i32 %17, i32* %1)
store i32 13, i32* %1
%19 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.22, i64 0, i64 0))
%20 = load i32, i32* %1
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i32 %20, i32* %1)
%22 = load i32, i32* %2
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i32 %22, i32* %2)
%24 = load i32, i32* %1
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.6, i64 0, i64 0), i32 %24, i32* %1)
%26 = load i32, i32* %1
store i32 %26, i32* %2
%27 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.23, i64 0, i64 0))
%28 = load i32, i32* %1
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i32 %28, i32* %1)
%30 = load i32, i32* %2
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i32 %30, i32* %2)
%32 = load i32, i32* %1
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.6, i64 0, i64 0), i32 %32, i32* %1)
%34 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @.str.9, i64 0, i64 0))
%35 = ptrtoint i32* %1 to i64
%36 = trunc i64 %35 to i32
store i32 %36, i32* %1
%37 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([79 x i8], [79 x i8]* @str.24, i64 0, i64 0))
%38 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([74 x i8], [74 x i8]* @str.25, i64 0, i64 0))
%39 = load i32, i32* %1
%40 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.12, i64 0, i64 0), i32 %39, i32* %1)
%41 = load i32, i32* %1
%42 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i32 %41, i32* %1)
%43 = load i32, i32* %2
%44 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i32 %43, i32* %2)
%45 = load i32, i32* %1
%46 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.6, i64 0, i64 0), i32 %45, i32* %1)
store i32 42, i32* %1
%47 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([73 x i8], [73 x i8]* @str.26, i64 0, i64 0))
%48 = load i32, i32* %1
%49 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i32 %48, i32* %1)
%50 = load i32, i32* %2
%51 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i32 %50, i32* %2)
%52 = load i32, i32* %1
%53 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.6, i64 0, i64 0), i32 %52, i32* %1)
%54 = call i32 @putchar(i32 10)
%55 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([101 x i8], [101 x i8]* @str.27, i64 0, i64 0))
%56 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([101 x i8], [101 x i8]* @str.28, i64 0, i64 0))
%57 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str.29, i64 0, i64 0))
%58 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([106 x i8], [106 x i8]* @str.30, i64 0, i64 0))
%59 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([106 x i8], [106 x i8]* @str.31, i64 0, i64 0))
%60 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str.32, i64 0, i64 0))
%61 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @.str.9, i64 0, i64 0))
%62 = call i32 @putchar(i32 10)
%63 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @str.33, i64 0, i64 0))
ret i32 0
}