#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*/ basic_pointer(int);
int /*<<< orphan*/ basic_pointer2(int);
int /*<<< orphan*/ basic_pointer_changeValue(int);
int /*<<< orphan*/ call_by_reference(int *);
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  int x = 5;
  basic_pointer(x);
  basic_pointer2(x);
  basic_pointer_changeValue(x);
  printf("Wert von x vor der Funktion call_by_reference: %d\n", x);
  call_by_reference(&x);
  printf("Wert von x nach der Funktion call_by_reference: %d\n", x);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x5,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1070 <basic_pointer@plt>
mov    -0x8(%rbp),%edi
call   1030 <basic_pointer2@plt>
mov    -0x8(%rbp),%edi
call   1060 <basic_pointer_changeValue@plt>
mov    -0x8(%rbp),%esi
lea    0xe78(%rip),%rdi
call   1040 <printf@plt>
lea    -0x8(%rbp),%rdi
call   1050 <call_by_reference@plt>
mov    -0x8(%rbp),%esi
lea    0xe93(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movl   $0x5,0x4(%rsp)
mov    $0x5,%edi
call   1070 <basic_pointer@plt>
mov    $0x5,%edi
call   1030 <basic_pointer2@plt>
mov    $0x5,%edi
call   1060 <basic_pointer_changeValue@plt>
lea    0xe82(%rip),%rdi
mov    $0x5,%esi
call   1040 <printf@plt>
lea    0x4(%rsp),%rdi
call   1050 <call_by_reference@plt>
mov    0x4(%rsp),%esi
lea    0xe96(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [51 x i8] c"Wert von x vor der Funktion call_by_reference: %d\0A\00"
@.str.1 = [52 x i8] c"Wert von x nach der Funktion call_by_reference: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 5, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @basic_pointer(i32 %3)
%5 = load i32, i32* %2
%6 = call i32 @basic_pointer2(i32 %5)
%7 = load i32, i32* %2
%8 = call i32 @basic_pointer_changeValue(i32 %7)
%9 = load i32, i32* %2
%10 = call i32 @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = call i32 @call_by_reference(i32* %2)
%12 = load i32, i32* %2
%13 = call i32 @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.1, i64 0, i64 0), i32 %12)
ret i32 0
}

LLVM IR (-O2):
@.str = [51 x i8] c"Wert von x vor der Funktion call_by_reference: %d\0A\00"
@.str.1 = [52 x i8] c"Wert von x nach der Funktion call_by_reference: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 5, i32* %1
%3 = tail call i32 @basic_pointer(i32 5)
%4 = tail call i32 @basic_pointer2(i32 5)
%5 = tail call i32 @basic_pointer_changeValue(i32 5)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0), i32 5)
%7 = call i32 @call_by_reference(i32* %1)
%8 = load i32, i32* %1
%9 = call i32 @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.1, i64 0, i64 0), i32 %8)
ret i32 0
}