#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 *, double, double);
main() {
  int i1 = 1, i2 = 2;
  float f1 = 0.1, f2 = 0.2;
  double d1 = 1.1, d2 = 9.9;
  printf("Before: %d, %d\n", i1, i2);
  {
    int var_t;
    var_t = i1;
    i1 = i2;
    i2 = var_t;
  };
  printf("Swapped: %d, %d\n", i1, i2);
  printf("Before: %f, %f\n", f1, f2);
  {
    float var_t;
    var_t = f1;
    f1 = f2;
    f2 = var_t;
  };
  printf("Swapped: %f, %f\n", f1, f2);
  printf("Before: %lf, %lf\n", d1, d2);
  {
    double var_t;
    var_t = d1;
    d1 = d2;
    d2 = var_t;
  };
  printf("Swapped: %lf, %lf\n", d1, d2);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
movl   $0x2,-0xc(%rbp)
movss  0xedf(%rip),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  0xece(%rip),%xmm0
movss  %xmm0,-0x14(%rbp)
movsd  0xeb9(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xea4(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
cvtsi2sdl -0x8(%rbp),%xmm0
cvtsi2sdl -0xc(%rbp),%xmm1
lea    0xea6(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x2c(%rbp),%eax
mov    %eax,-0xc(%rbp)
cvtsi2sdl -0x8(%rbp),%xmm0
cvtsi2sdl -0xc(%rbp),%xmm1
lea    0xe8e(%rip),%rdi
call   1030 <printf@plt>
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x14(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xe81(%rip),%rdi
call   1030 <printf@plt>
movss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x30(%rbp)
movss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x30(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x14(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xe55(%rip),%rdi
call   1030 <printf@plt>
movsd  -0x20(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
lea    0xe50(%rip),%rdi
call   1030 <printf@plt>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
lea    0xe2e(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xf18(%rip),%rdi
movsd  0xee0(%rip),%xmm0
movsd  0xee0(%rip),%xmm1
call   1030 <printf@plt>
lea    0xf0c(%rip),%rdi
movsd  0xecc(%rip),%xmm0
movsd  0xebc(%rip),%xmm1
call   1030 <printf@plt>
lea    0xf01(%rip),%rdi
movsd  0xeb8(%rip),%xmm0
movsd  0xeb8(%rip),%xmm1
call   1030 <printf@plt>
lea    0xef5(%rip),%rdi
movsd  0xea4(%rip),%xmm0
movsd  0xe94(%rip),%xmm1
call   1030 <printf@plt>
lea    0xeea(%rip),%rdi
movsd  0xe90(%rip),%xmm0
movsd  0xe90(%rip),%xmm1
call   1030 <printf@plt>
lea    0xee0(%rip),%rdi
movsd  0xe7c(%rip),%xmm0
movsd  0xe6c(%rip),%xmm1
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [16 x i8] c"Before: %d, %d\0A\00"
@.str.1 = [17 x i8] c"Swapped: %d, %d\0A\00"
@.str.2 = [16 x i8] c"Before: %f, %f\0A\00"
@.str.3 = [17 x i8] c"Swapped: %f, %f\0A\00"
@.str.4 = [18 x i8] c"Before: %lf, %lf\0A\00"
@.str.5 = [19 x i8] c"Swapped: %lf, %lf\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca float
%5 = alloca float
%6 = alloca double
%7 = alloca double
%8 = alloca i32
%9 = alloca float
%10 = alloca double
store i32 0, i32* %1
store i32 1, i32* %2
store i32 2, i32* %3
store float 0x3FB99999A0000000, float* %4
store float 0x3FC99999A0000000, float* %5
store double 1.100000e+00, double* %6
store double 9.900000e+00, double* %7
%11 = load i32, i32* %2
%12 = sitofp i32 %11 to double
%13 = load i32, i32* %3
%14 = sitofp i32 %13 to double
%15 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), double %12, double %14)
%16 = load i32, i32* %2
store i32 %16, i32* %8
%17 = load i32, i32* %3
store i32 %17, i32* %2
%18 = load i32, i32* %8
store i32 %18, i32* %3
%19 = load i32, i32* %2
%20 = sitofp i32 %19 to double
%21 = load i32, i32* %3
%22 = sitofp i32 %21 to double
%23 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), double %20, double %22)
%24 = load float, float* %4
%25 = fpext float %24 to double
%26 = load float, float* %5
%27 = fpext float %26 to double
%28 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), double %25, double %27)
%29 = load float, float* %4
store float %29, float* %9
%30 = load float, float* %5
store float %30, float* %4
%31 = load float, float* %9
store float %31, float* %5
%32 = load float, float* %4
%33 = fpext float %32 to double
%34 = load float, float* %5
%35 = fpext float %34 to double
%36 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), double %33, double %35)
%37 = load double, double* %6
%38 = load double, double* %7
%39 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), double %37, double %38)
%40 = load double, double* %6
store double %40, double* %10
%41 = load double, double* %7
store double %41, double* %6
%42 = load double, double* %10
store double %42, double* %7
%43 = load double, double* %6
%44 = load double, double* %7
%45 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), double %43, double %44)
ret i32 0
}

LLVM IR (-O2):
@.str = [16 x i8] c"Before: %d, %d\0A\00"
@.str.1 = [17 x i8] c"Swapped: %d, %d\0A\00"
@.str.2 = [16 x i8] c"Before: %f, %f\0A\00"
@.str.3 = [17 x i8] c"Swapped: %f, %f\0A\00"
@.str.4 = [18 x i8] c"Before: %lf, %lf\0A\00"
@.str.5 = [19 x i8] c"Swapped: %lf, %lf\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), double 1.000000e+00, double 2.000000e+00)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), double 2.000000e+00, double 1.000000e+00)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), double 0x3FB99999A0000000, double 0x3FC99999A0000000)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), double 0x3FC99999A0000000, double 0x3FB99999A0000000)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), double 1.100000e+00, double 9.900000e+00)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), double 9.900000e+00, double 1.100000e+00)
ret i32 0
}