#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 EXIT_SUCCESS;
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ setbuf(int /*<<< orphan*/, int /*<<< orphan*/ *);
int /*<<< orphan*/ stdout;
int main(void) {
  setbuf(stdout, NULL);
  int x = 5;
  int *y;
  printf("Adresse x=%p Wert x=%d\n", &x, x);
  printf("Adresse *y=%p, Wert *y=%d (Unsinn)\n", &y, *y);
  printf("\ny=&x;\n\n");
  y = &x;
  printf("Adresse x=%p Wert x=%d\n", &x, x);
  printf("Adresse *y=%p, Wert *y=%d\n", &y, *y);
  printf("\nAdresse, auf die y zeigt, ist %p\n", y);
  printf("und das ist die Adresse von x = %p\n", &x);
  printf("\nACHTUNG!!!\n\n");
  *y = 10;
  printf("*y=10\n\n");
  printf("Adresse  x=%p, Wert  x=%d\n", &x, x);
  printf("Adresse *y=%p, Wert *y=%d\n", &y, *y);
  printf("\nAdresse, auf die y zeigt, ist %p\n", y);
  printf("weiterhin die Adresse von x (%p)\n", &x);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2eaa(%rip),%rax
mov    (%rax),%edi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <setbuf@plt>
movl   $0x5,-0x8(%rbp)
mov    -0x8(%rbp),%edx
lea    0xeae(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%edx
lea    0xeae(%rip),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xec0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%edx
lea    0xe6b(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%edx
lea    0xe98(%rip),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rsi
lea    0xe9d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xeb2(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xec4(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rax
movl   $0xa,(%rax)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%edx
lea    0xeb1(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%edx
lea    0xe21(%rip),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rsi
lea    0xe26(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe90(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2d7e(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    0x2e9c(%rip),%rax
mov    (%rax),%edi
xor    %esi,%esi
call   1040 <setbuf@plt>
movl   $0x5,0x4(%rsp)
lea    0xea4(%rip),%rbx
lea    0x4(%rsp),%r13
mov    %rbx,%rdi
mov    %r13,%rsi
mov    $0x5,%edx
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe9e(%rip),%rdi
lea    0x8(%rsp),%r14
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xf4b(%rip),%rdi
call   1030 <puts@plt>
mov    %r13,0x8(%rsp)
mov    0x4(%rsp),%edx
mov    %rbx,%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x8(%rsp),%rax
mov    (%rax),%edx
lea    0xe83(%rip),%r15
mov    %r15,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x8(%rsp),%rsi
lea    0xe85(%rip),%r12
mov    %r12,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe97(%rip),%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xeef(%rip),%rdi
call   1030 <puts@plt>
mov    0x8(%rsp),%rax
movl   $0xa,(%rax)
lea    0xee5(%rip),%rdi
call   1030 <puts@plt>
mov    0x4(%rsp),%edx
lea    0xe83(%rip),%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x8(%rsp),%rax
mov    (%rax),%edx
mov    %r15,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x8(%rsp),%rsi
mov    %r12,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe6a(%rip),%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x2d78(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@stdout = global i32 0
@.str = [24 x i8] c"Adresse x=%p Wert x=%d\0A\00"
@.str.1 = [36 x i8] c"Adresse *y=%p, Wert *y=%d (Unsinn)\0A\00"
@.str.2 = [9 x i8] c"\0Ay=&x;\0A\0A\00"
@.str.3 = [27 x i8] c"Adresse *y=%p, Wert *y=%d\0A\00"
@.str.4 = [35 x i8] c"\0AAdresse, auf die y zeigt, ist %p\0A\00"
@.str.5 = [36 x i8] c"und das ist die Adresse von x = %p\0A\00"
@.str.6 = [14 x i8] c"\0AACHTUNG!!!\0A\0A\00"
@.str.7 = [8 x i8] c"*y=10\0A\0A\00"
@.str.8 = [27 x i8] c"Adresse x=%p, Wert x=%d\0A\00"
@.str.9 = [34 x i8] c"weiterhin die Adresse von x (%p)\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32*
store i32 0, i32* %1
%4 = load i32, i32* @stdout
%5 = call i32 @setbuf(i32 %4, i32* null)
store i32 5, i32* %2
%6 = load i32, i32* %2
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32* %2, i32 %6)
%8 = load i32*, i32** %3
%9 = load i32, i32* %8
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0), i32** %3, i32 %9)
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
store i32* %2, i32** %3
%12 = load i32, i32* %2
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32* %2, i32 %12)
%14 = load i32*, i32** %3
%15 = load i32, i32* %14
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i32** %3, i32 %15)
%17 = load i32*, i32** %3
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.4, i64 0, i64 0), i32* %17)
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.5, i64 0, i64 0), i32* %2)
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0))
%21 = load i32*, i32** %3
store i32 10, i32* %21
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0))
%23 = load i32, i32* %2
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.8, i64 0, i64 0), i32* %2, i32 %23)
%25 = load i32*, i32** %3
%26 = load i32, i32* %25
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i32** %3, i32 %26)
%28 = load i32*, i32** %3
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.4, i64 0, i64 0), i32* %28)
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.9, i64 0, i64 0), i32* %2)
%31 = load i32, i32* @EXIT_SUCCESS
ret i32 %31
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [24 x i8] c"Adresse x=%p Wert x=%d\0A\00"
@.str.1 = [36 x i8] c"Adresse *y=%p, Wert *y=%d (Unsinn)\0A\00"
@.str.3 = [27 x i8] c"Adresse *y=%p, Wert *y=%d\0A\00"
@.str.4 = [35 x i8] c"\0AAdresse, auf die y zeigt, ist %p\0A\00"
@.str.5 = [36 x i8] c"und das ist die Adresse von x = %p\0A\00"
@.str.8 = [27 x i8] c"Adresse x=%p, Wert x=%d\0A\00"
@.str.9 = [34 x i8] c"weiterhin die Adresse von x (%p)\0A\00"
@EXIT_SUCCESS = global i32 0
@str = [8 x i8] c"\0Ay=&x;\0A\00"
@str.10 = [13 x i8] c"\0AACHTUNG!!!\0A\00"
@str.11 = [7 x i8] c"*y=10\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = load i32, i32* @stdout
%4 = tail call i32 @setbuf(i32 %3, i32* null)
%5 = bitcast i32* %1 to i8*
store i32 5, i32* %1
%6 = bitcast i32** %2 to i8*
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32* %1, i32 5)
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0), i32** %2, i32 undef)
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0))
store i32* %1, i32** %2
%10 = load i32, i32* %1
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32* %1, i32 %10)
%12 = load i32*, i32** %2
%13 = load i32, i32* %12
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i32** %2, i32 %13)
%15 = load i32*, i32** %2
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.4, i64 0, i64 0), i32* %15)
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.5, i64 0, i64 0), i32* %1)
%18 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.10, i64 0, i64 0))
%19 = load i32*, i32** %2
store i32 10, i32* %19
%20 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.11, i64 0, i64 0))
%21 = load i32, i32* %1
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.8, i64 0, i64 0), i32* %1, i32 %21)
%23 = load i32*, i32** %2
%24 = load i32, i32* %23
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i32** %2, i32 %24)
%26 = load i32*, i32** %2
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.4, i64 0, i64 0), i32* %26)
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.9, i64 0, i64 0), i32* %1)
%29 = load i32, i32* @EXIT_SUCCESS
ret i32 %29
}