#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 *, float, float);
int /*<<< orphan*/ swap_char(char *, char *);
int /*<<< orphan*/ swap_float(float *, float *);
int /*<<< orphan*/ swap_int(int *, int *);
int main() {
  char c = 'H', d = 'W';
  int a = 10, b = 20;
  float f = 1.1, g = 1.2;
  printf("c and d before swap is %c and %c\n", c, d);
  swap_char(&c, &d);
  printf("c and d after swap is %c and %c\n", c, d);
  printf("a and b before swap is %d and %d\n", a, b);
  swap_int(&a, &b);
  printf("a and b after swap is %d and %d\n", a, b);
  printf("f and g before swap is %f and %f\n", f, g);
  swap_float(&f, &g);
  printf("f and g after swap is %f and %f\n", f, g);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movb   $0x48,-0x5(%rbp)
movb   $0x57,-0x6(%rbp)
movl   $0xa,-0xc(%rbp)
movl   $0x14,-0x10(%rbp)
movl   $0x3f8ccccd,-0x14(%rbp)
movl   $0x3f99999a,-0x18(%rbp)
movsbl -0x5(%rbp),%eax
cvtsi2ss %eax,%xmm0
movsbl -0x6(%rbp),%eax
cvtsi2ss %eax,%xmm1
lea    0xe76(%rip),%rdi
call   1030 <printf@plt>
lea    -0x5(%rbp),%rdi
lea    -0x6(%rbp),%rsi
call   1060 <swap_char@plt>
movsbl -0x5(%rbp),%eax
cvtsi2ss %eax,%xmm0
movsbl -0x6(%rbp),%eax
cvtsi2ss %eax,%xmm1
lea    0xe6f(%rip),%rdi
call   1030 <printf@plt>
cvtsi2ssl -0xc(%rbp),%xmm0
cvtsi2ssl -0x10(%rbp),%xmm1
lea    0xe7a(%rip),%rdi
call   1030 <printf@plt>
lea    -0xc(%rbp),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <swap_int@plt>
cvtsi2ssl -0xc(%rbp),%xmm0
cvtsi2ssl -0x10(%rbp),%xmm1
lea    0xe79(%rip),%rdi
call   1030 <printf@plt>
movss  -0x14(%rbp),%xmm0
movss  -0x18(%rbp),%xmm1
lea    0xe84(%rip),%rdi
call   1030 <printf@plt>
lea    -0x14(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1050 <swap_float@plt>
movss  -0x14(%rbp),%xmm0
movss  -0x18(%rbp),%xmm1
lea    0xe83(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
movb   $0x48,0x7(%rsp)
movb   $0x57,0x6(%rsp)
movl   $0xa,0x14(%rsp)
movl   $0x14,0x10(%rsp)
movl   $0x3f8ccccd,0xc(%rsp)
3f
movl   $0x3f99999a,0x8(%rsp)
3f
lea    0xea3(%rip),%rdi
movss  0xe83(%rip),%xmm0
movss  0xe7f(%rip),%xmm1
call   1030 <printf@plt>
lea    0x7(%rsp),%rdi
lea    0x6(%rsp),%rsi
call   1060 <swap_char@plt>
movsbl 0x7(%rsp),%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
movsbl 0x6(%rsp),%eax
xorps  %xmm1,%xmm1
cvtsi2ss %eax,%xmm1
lea    0xe82(%rip),%rdi
call   1030 <printf@plt>
lea    0xe97(%rip),%rdi
movss  0xe3c(%rip),%xmm0
movss  0xe38(%rip),%xmm1
call   1030 <printf@plt>
lea    0x14(%rsp),%rdi
lea    0x10(%rsp),%rsi
call   1040 <swap_int@plt>
xorps  %xmm0,%xmm0
cvtsi2ssl 0x14(%rsp),%xmm0
xorps  %xmm1,%xmm1
cvtsi2ssl 0x10(%rsp),%xmm1
lea    0xe7c(%rip),%rdi
call   1030 <printf@plt>
lea    0xe91(%rip),%rdi
movss  0xdfb(%rip),%xmm0
movss  0xdf7(%rip),%xmm1
call   1030 <printf@plt>
lea    0xc(%rsp),%rdi
lea    0x8(%rsp),%rsi
call   1050 <swap_float@plt>
movss  0xc(%rsp),%xmm0
movss  0x8(%rsp),%xmm1
lea    0xe7c(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [34 x i8] c"c and d before swap is %c and %c\0A\00"
@.str.1 = [33 x i8] c"c and d after swap is %c and %c\0A\00"
@.str.2 = [34 x i8] c"a and b before swap is %d and %d\0A\00"
@.str.3 = [33 x i8] c"a and b after swap is %d and %d\0A\00"
@.str.4 = [34 x i8] c"f and g before swap is %f and %f\0A\00"
@.str.5 = [33 x i8] c"f and g after swap is %f and %f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca i8
%4 = alloca i32
%5 = alloca i32
%6 = alloca float
%7 = alloca float
store i32 0, i32* %1
store i8 72, i8* %2
store i8 87, i8* %3
store i32 10, i32* %4
store i32 20, i32* %5
store float 0x3FF19999A0000000, float* %6
store float 0x3FF3333340000000, float* %7
%8 = load i8, i8* %2
%9 = sitofp i8 %8 to float
%10 = load i8, i8* %3
%11 = sitofp i8 %10 to float
%12 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), float %9, float %11)
%13 = call i32 @swap_char(i8* %2, i8* %3)
%14 = load i8, i8* %2
%15 = sitofp i8 %14 to float
%16 = load i8, i8* %3
%17 = sitofp i8 %16 to float
%18 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0), float %15, float %17)
%19 = load i32, i32* %4
%20 = sitofp i32 %19 to float
%21 = load i32, i32* %5
%22 = sitofp i32 %21 to float
%23 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), float %20, float %22)
%24 = call i32 @swap_int(i32* %4, i32* %5)
%25 = load i32, i32* %4
%26 = sitofp i32 %25 to float
%27 = load i32, i32* %5
%28 = sitofp i32 %27 to float
%29 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0), float %26, float %28)
%30 = load float, float* %6
%31 = load float, float* %7
%32 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0), float %30, float %31)
%33 = call i32 @swap_float(float* %6, float* %7)
%34 = load float, float* %6
%35 = load float, float* %7
%36 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.5, i64 0, i64 0), float %34, float %35)
ret i32 0
}

LLVM IR (-O2):
@.str = [34 x i8] c"c and d before swap is %c and %c\0A\00"
@.str.1 = [33 x i8] c"c and d after swap is %c and %c\0A\00"
@.str.2 = [34 x i8] c"a and b before swap is %d and %d\0A\00"
@.str.3 = [33 x i8] c"a and b after swap is %d and %d\0A\00"
@.str.4 = [34 x i8] c"f and g before swap is %f and %f\0A\00"
@.str.5 = [33 x i8] c"f and g after swap is %f and %f\0A\00"
define i32 @main() {
%1 = alloca i8
%2 = alloca i8
%3 = alloca i32
%4 = alloca i32
%5 = alloca float
%6 = alloca float
store i8 72, i8* %1
store i8 87, i8* %2
%7 = bitcast i32* %3 to i8*
store i32 10, i32* %3
%8 = bitcast i32* %4 to i8*
store i32 20, i32* %4
%9 = bitcast float* %5 to i8*
store float 0x3FF19999A0000000, float* %5
%10 = bitcast float* %6 to i8*
store float 0x3FF3333340000000, float* %6
%11 = tail call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), float 7.200000e+01, float 8.700000e+01)
%12 = call i32 @swap_char(i8* %1, i8* %2)
%13 = load i8, i8* %1
%14 = sitofp i8 %13 to float
%15 = load i8, i8* %2
%16 = sitofp i8 %15 to float
%17 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0), float %14, float %16)
%18 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), float 1.000000e+01, float 2.000000e+01)
%19 = call i32 @swap_int(i32* %3, i32* %4)
%20 = load i32, i32* %3
%21 = sitofp i32 %20 to float
%22 = load i32, i32* %4
%23 = sitofp i32 %22 to float
%24 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0), float %21, float %23)
%25 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0), float 0x3FF19999A0000000, float 0x3FF3333340000000)
%26 = call i32 @swap_float(float* %5, float* %6)
%27 = load float, float* %5
%28 = load float, float* %6
%29 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.5, i64 0, i64 0), float %27, float %28)
ret i32 0
}