#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);
int main(int argc, char **argv) {
  typedef int t;
  int a = 10;
  int b = 22;
  printf("a = %d, b = %d before swapping\n", a, b);
  {
    int tmp;
    tmp = a;
    a = b;
    b = tmp;
  };
  printf("after swapping a = %d, b = %d\n", a, b);
  double c = 12.0;
  double d = 24.0;
  printf("c = %.2lf, d = %.2lf before swapping\n", c, d);
  {
    double tmp;
    tmp = c;
    c = d;
    d = tmp;
  };
  printf("after swapping, c = %.2lf, d = %.2lf\n", c, d);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0xa,-0x14(%rbp)
movl   $0x16,-0x18(%rbp)
cvtsi2sdl -0x14(%rbp),%xmm0
cvtsi2sdl -0x18(%rbp),%xmm1
lea    0xecb(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x18(%rbp)
cvtsi2sdl -0x14(%rbp),%xmm0
cvtsi2sdl -0x18(%rbp),%xmm1
lea    0xec3(%rip),%rdi
call   1030 <printf@plt>
movsd  0xe8e(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xe79(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm1
lea    0xeb2(%rip),%rdi
call   1030 <printf@plt>
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm1
lea    0xea4(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xf08(%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    0xf0f(%rip),%rdi
movsd  0xeb8(%rip),%xmm0
movsd  0xeb8(%rip),%xmm1
call   1030 <printf@plt>
lea    0xf19(%rip),%rdi
movsd  0xea4(%rip),%xmm0
movsd  0xe94(%rip),%xmm1
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [32 x i8] c"a = %d, b = %d before swapping\0A\00"
@.str.1 = [31 x i8] c"after swapping a = %d, b = %d\0A\00"
@.str.2 = [38 x i8] c"c = %.2lf, d = %.2lf before swapping\0A\00"
@.str.3 = [38 x i8] c"after swapping, c = %.2lf, d = %.2lf\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca double
%10 = alloca double
%11 = alloca double
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 10, i32* %6
store i32 22, i32* %7
%12 = load i32, i32* %6
%13 = sitofp i32 %12 to double
%14 = load i32, i32* %7
%15 = sitofp i32 %14 to double
%16 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), double %13, double %15)
%17 = load i32, i32* %6
store i32 %17, i32* %8
%18 = load i32, i32* %7
store i32 %18, i32* %6
%19 = load i32, i32* %8
store i32 %19, i32* %7
%20 = load i32, i32* %6
%21 = sitofp i32 %20 to double
%22 = load i32, i32* %7
%23 = sitofp i32 %22 to double
%24 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), double %21, double %23)
store double 1.200000e+01, double* %9
store double 2.400000e+01, double* %10
%25 = load double, double* %9
%26 = load double, double* %10
%27 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0), double %25, double %26)
%28 = load double, double* %9
store double %28, double* %11
%29 = load double, double* %10
store double %29, double* %9
%30 = load double, double* %11
store double %30, double* %10
%31 = load double, double* %9
%32 = load double, double* %10
%33 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.3, i64 0, i64 0), double %31, double %32)
ret i32 0
}

LLVM IR (-O2):
@.str = [32 x i8] c"a = %d, b = %d before swapping\0A\00"
@.str.1 = [31 x i8] c"after swapping a = %d, b = %d\0A\00"
@.str.2 = [38 x i8] c"c = %.2lf, d = %.2lf before swapping\0A\00"
@.str.3 = [38 x i8] c"after swapping, c = %.2lf, d = %.2lf\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), double 1.000000e+01, double 2.200000e+01)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), double 2.200000e+01, double 1.000000e+01)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0), double 1.200000e+01, double 2.400000e+01)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.3, i64 0, i64 0), double 2.400000e+01, double 1.200000e+01)
ret i32 0
}