#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 *, ...);
void vymen(double *p1, double *p2) {
  printf("Hodnota p1 je %p\n", p1);
  printf("Hodnota p2 je %p\n", p2);
  printf("p1 ukazuje na %lf\n", *p1);
  printf("p2 ukazuje na %lf\n", *p2);
  double tmp = *p1;
  *p1 = *p2;
  *p2 = tmp;
}


x86 assembly (clang, -O0):
<vymen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xed5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rsi
lea    0xed5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
lea    0xed1(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
lea    0xece(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x18(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vymen>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xedf(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xee0(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
movsd  (%rbx),%xmm0
lea    0xedd(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  (%r14),%xmm0
lea    0xedd(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  (%rbx),%xmm0
movsd  (%r14),%xmm1
movsd  %xmm1,(%rbx)
movsd  %xmm0,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [18 x i8] c"Hodnota p1 je %p\0A\00"
@.str.1 = [18 x i8] c"Hodnota p2 je %p\0A\00"
@.str.2 = [19 x i8] c"p1 ukazuje na %lf\0A\00"
@.str.3 = [19 x i8] c"p2 ukazuje na %lf\0A\00"
define void @vymen(double* %0, double* %1) {
%3 = alloca double*
%4 = alloca double*
%5 = alloca double
store double* %0, double** %3
store double* %1, double** %4
%6 = load double*, double** %3
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), double* %6)
%8 = load double*, double** %4
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), double* %8)
%10 = load double*, double** %3
%11 = load double, double* %10
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), double %11)
%13 = load double*, double** %4
%14 = load double, double* %13
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), double %14)
%16 = load double*, double** %3
%17 = load double, double* %16
store double %17, double* %5
%18 = load double*, double** %4
%19 = load double, double* %18
%20 = load double*, double** %3
store double %19, double* %20
%21 = load double, double* %5
%22 = load double*, double** %4
store double %21, double* %22
ret void
}

LLVM IR (-O2):
@.str = [18 x i8] c"Hodnota p1 je %p\0A\00"
@.str.1 = [18 x i8] c"Hodnota p2 je %p\0A\00"
@.str.2 = [19 x i8] c"p1 ukazuje na %lf\0A\00"
@.str.3 = [19 x i8] c"p2 ukazuje na %lf\0A\00"
define void @vymen(double* %0, double* %1) {
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), double* %0)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), double* %1)
%5 = load double, double* %0
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), double %5)
%7 = load double, double* %1
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), double %7)
%9 = load double, double* %0
%10 = load double, double* %1
store double %10, double* %0
store double %9, double* %1
ret void
}