#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, int);
int main(void) {
  int liczba = 80;
  int *wskaznik = &liczba;
  printf("wartość zmiennej: %d, jej adres: %p.\n", liczba, (void *)&liczba);
  printf("adres zapisany we wskazniku: %p, wskazywana wartosc: %d.\n",
         (void *)wskaznik, *wskaznik);
  *wskaznik = 42;
  printf("wartosc zmiennej: %d, wartosc wskazywana: %d\n", liczba, *wskaznik);
  liczba = 0x42;
  printf("wartosc zmiennej: %d, wartosc wskazywana: %d\n", liczba, *wskaznik);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x50,-0x8(%rbp)
lea    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%esi
lea    -0x8(%rbp),%rax
mov    %eax,%edx
lea    0xec2(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    %eax,%esi
mov    -0x10(%rbp),%rax
mov    (%rax),%edx
lea    0xed2(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
movl   $0x2a,(%rax)
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%rax
mov    (%rax),%edx
lea    0xeed(%rip),%rdi
call   1030 <printf@plt>
movl   $0x42,-0x8(%rbp)
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%rax
mov    (%rax),%edx
lea    0xed1(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movl   $0x50,0xc(%rsp)
lea    0xc(%rsp),%rbx
lea    0xed7(%rip),%rdi
mov    $0x50,%esi
mov    %ebx,%edx
call   1030 <printf@plt>
mov    0xc(%rsp),%edx
lea    0xee8(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
movl   $0x2a,0xc(%rsp)
lea    0xf0c(%rip),%rbx
mov    %rbx,%rdi
mov    $0x2a,%esi
mov    $0x2a,%edx
call   1030 <printf@plt>
movl   $0x42,0xc(%rsp)
mov    %rbx,%rdi
mov    $0x42,%esi
mov    $0x42,%edx
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [40 x i8] c"warto\C5\9B\C4\87 zmiennej: %d, jej adres: %p.\0A\00"
@.str.1 = [58 x i8] c"adres zapisany we wskazniku: %p, wskazywana wartosc: %d.\0A\00"
@.str.2 = [46 x i8] c"wartosc zmiennej: %d, wartosc wskazywana: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32*
store i32 0, i32* %1
store i32 80, i32* %2
store i32* %2, i32** %3
%4 = load i32, i32* %2
%5 = bitcast i32* %2 to i8*
%6 = ptrtoint i8* %5 to i32
%7 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i32 %4, i32 %6)
%8 = load i32*, i32** %3
%9 = bitcast i32* %8 to i8*
%10 = ptrtoint i8* %9 to i32
%11 = load i32*, i32** %3
%12 = load i32, i32* %11
%13 = call i32 @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.1, i64 0, i64 0), i32 %10, i32 %12)
%14 = load i32*, i32** %3
store i32 42, i32* %14
%15 = load i32, i32* %2
%16 = load i32*, i32** %3
%17 = load i32, i32* %16
%18 = call i32 @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.2, i64 0, i64 0), i32 %15, i32 %17)
store i32 66, i32* %2
%19 = load i32, i32* %2
%20 = load i32*, i32** %3
%21 = load i32, i32* %20
%22 = call i32 @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.2, i64 0, i64 0), i32 %19, i32 %21)
ret i32 0
}

LLVM IR (-O2):
@.str = [40 x i8] c"warto\C5\9B\C4\87 zmiennej: %d, jej adres: %p.\0A\00"
@.str.1 = [58 x i8] c"adres zapisany we wskazniku: %p, wskazywana wartosc: %d.\0A\00"
@.str.2 = [46 x i8] c"wartosc zmiennej: %d, wartosc wskazywana: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 80, i32* %1
%3 = ptrtoint i32* %1 to i64
%4 = trunc i64 %3 to i32
%5 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i32 80, i32 %4)
%6 = load i32, i32* %1
%7 = call i32 @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.1, i64 0, i64 0), i32 %4, i32 %6)
store i32 42, i32* %1
%8 = call i32 @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.2, i64 0, i64 0), i32 42, i32 42)
store i32 66, i32* %1
%9 = call i32 @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.2, i64 0, i64 0), i32 66, i32 66)
ret i32 0
}