#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 main(void) {
  printf("\npointersinstructures started\n\n");
  struct intPtrs {
    int *p1;
    int *p2;
  };
  struct intPtrs pointers;
  int i1 = 100, i2;
  pointers.p1 = &i1;
  pointers.p2 = &i2;
  *pointers.p2 = -97;
  printf("i1 = %i, *pointers.p1 = %i\n", i1, *pointers.p1);
  printf("i2 = %i, *pointers.p2 = %i\n", i2, *pointers.p2);
  printf("\npointersinstructures ended\n\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x64,-0x1c(%rbp)
lea    -0x1c(%rbp),%rax
mov    %rax,-0x18(%rbp)
lea    -0x20(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movl   $0xffffff9f,(%rax)
mov    -0x1c(%rbp),%esi
mov    -0x18(%rbp),%rax
mov    (%rax),%edx
lea    0xec2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%esi
mov    -0x10(%rbp),%rax
mov    (%rax),%edx
lea    0xec7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xf10(%rip),%rdi
call   1030 <puts@plt>
lea    0xecc(%rip),%rdi
mov    $0x64,%esi
mov    $0x64,%edx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xed0(%rip),%rdi
mov    $0xffffff9f,%esi
mov    $0xffffff9f,%edx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xef3(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.intPtrs = type { i32*, i32* }
@.str = [32 x i8] c"\0Apointersinstructures started\0A\0A\00"
@.str.1 = [28 x i8] c"i1 = %i, *pointers.p1 = %i\0A\00"
@.str.2 = [28 x i8] c"i2 = %i, *pointers.p2 = %i\0A\00"
@.str.3 = [30 x i8] c"\0Apointersinstructures ended\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.intPtrs
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
store i32 100, i32* %3
%6 = getelementptr inbounds %struct.intPtrs, %struct.intPtrs* %2, i32 0, i32 0
store i32* %3, i32** %6
%7 = getelementptr inbounds %struct.intPtrs, %struct.intPtrs* %2, i32 0, i32 1
store i32* %4, i32** %7
%8 = getelementptr inbounds %struct.intPtrs, %struct.intPtrs* %2, i32 0, i32 1
%9 = load i32*, i32** %8
store i32 -97, i32* %9
%10 = load i32, i32* %3
%11 = getelementptr inbounds %struct.intPtrs, %struct.intPtrs* %2, i32 0, i32 0
%12 = load i32*, i32** %11
%13 = load i32, i32* %12
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i32 %10, i32 %13)
%15 = load i32, i32* %4
%16 = getelementptr inbounds %struct.intPtrs, %struct.intPtrs* %2, i32 0, i32 1
%17 = load i32*, i32** %16
%18 = load i32, i32* %17
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i32 %15, i32 %18)
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [28 x i8] c"i1 = %i, *pointers.p1 = %i\0A\00"
@.str.2 = [28 x i8] c"i2 = %i, *pointers.p2 = %i\0A\00"
@str = [31 x i8] c"\0Apointersinstructures started\0A\00"
@str.4 = [29 x i8] c"\0Apointersinstructures ended\0A\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i32 100, i32 100)
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i32 -97, i32 -97)
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str.4, i64 0, i64 0))
ret i32 0
}