#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*/ generic_swap(void *, void *, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ swap(void *, void *);
int two_two_five() {
  int a = 6;
  int b = 9;
  float c = 3.14159;
  float d = 2.71828;
  void *ptrA = &a;
  void *ptrB = &b;
  printf("%d %d\n", *(int *)ptrA, *(int *)ptrB);
  swap(ptrA, ptrB);
  printf("%d %d\n", *(int *)ptrA, *(int *)ptrB);
  printf("\n\n");
  printf("%d %d\n", *(int *)ptrA, *(int *)ptrB);
  generic_swap(ptrA, ptrB, sizeof(int));
  printf("%d %d\n", *(int *)ptrA, *(int *)ptrB);
  printf("\n\n");
  ptrA = &c;
  ptrB = &d;
  printf("%f %f\n", *(float *)ptrA, *(float *)ptrB);
  generic_swap(ptrA, ptrB, sizeof(float));
  printf("%f %f\n", *(float *)ptrA, *(float *)ptrB);
  printf("\n\n");
  return 0;
}


x86 assembly (clang, -O0):
<two_two_five>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x6,-0x4(%rbp)
movl   $0x9,-0x8(%rbp)
movss  0xeb6(%rip),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  0xea5(%rip),%xmm0
movss  %xmm0,-0x10(%rbp)
lea    -0x4(%rbp),%rax
mov    %rax,-0x18(%rbp)
lea    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%esi
mov    -0x20(%rbp),%rax
mov    (%rax),%edx
lea    0xe85(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1050 <swap@plt>
mov    -0x18(%rbp),%rax
mov    (%rax),%esi
mov    -0x20(%rbp),%rax
mov    (%rax),%edx
lea    0xe5e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe57(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%rax
mov    (%rax),%esi
mov    -0x20(%rbp),%rax
mov    (%rax),%edx
lea    0xe36(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    $0x4,%edx
call   1030 <generic_swap@plt>
mov    -0x18(%rbp),%rax
mov    (%rax),%esi
mov    -0x20(%rbp),%rax
mov    (%rax),%edx
lea    0xe0a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe03(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0xc(%rbp),%rax
mov    %rax,-0x18(%rbp)
lea    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
movss  (%rax),%xmm0
cvtss2sd %xmm0,%xmm0
mov    -0x20(%rbp),%rax
movss  (%rax),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xdd0(%rip),%rdi
mov    $0x2,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    $0x4,%edx
call   1030 <generic_swap@plt>
mov    -0x18(%rbp),%rax
movss  (%rax),%xmm0
cvtss2sd %xmm0,%xmm0
mov    -0x20(%rbp),%rax
movss  (%rax),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xd98(%rip),%rdi
mov    $0x2,%al
call   1040 <printf@plt>
lea    0xd87(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<two_two_five>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
movl   $0x6,0xc(%rsp)
movl   $0x9,0x8(%rsp)
movl   $0x40490fd0,0x14(%rsp)
40
movl   $0x402df84d,0x10(%rsp)
40
lea    0xe9e(%rip),%rbx
mov    %rbx,%rdi
mov    $0x6,%esi
mov    $0x9,%edx
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xc(%rsp),%r15
lea    0x8(%rsp),%r12
mov    %r15,%rdi
mov    %r12,%rsi
call   1060 <swap@plt>
mov    0xc(%rsp),%esi
mov    0x8(%rsp),%edx
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe61(%rip),%r14
mov    %r14,%rdi
call   1040 <puts@plt>
mov    0xc(%rsp),%esi
mov    0x8(%rsp),%edx
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
mov    $0x4,%edx
call   1030 <generic_swap@plt>
mov    0xc(%rsp),%esi
mov    0x8(%rsp),%edx
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r14,%rdi
call   1040 <puts@plt>
lea    0xe18(%rip),%rbx
movsd  0xdf9(%rip),%xmm0
movsd  0xdf9(%rip),%xmm1
mov    %rbx,%rdi
mov    $0x2,%al
call   1050 <printf@plt>
lea    0x14(%rsp),%rdi
lea    0x10(%rsp),%rsi
mov    $0x4,%edx
call   1030 <generic_swap@plt>
movss  0x14(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  0x10(%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
mov    %rbx,%rdi
mov    $0x2,%al
call   1050 <printf@plt>
mov    %r14,%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [7 x i8] c"%d %d\0A\00"
@.str.1 = [3 x i8] c"\0A\0A\00"
@.str.2 = [7 x i8] c"%f %f\0A\00"
define i32 @two_two_five() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca float
%4 = alloca float
%5 = alloca i8*
%6 = alloca i8*
store i32 6, i32* %1
store i32 9, i32* %2
store float 0x400921FA00000000, float* %3
store float 0x4005BF09A0000000, float* %4
%7 = bitcast i32* %1 to i8*
store i8* %7, i8** %5
%8 = bitcast i32* %2 to i8*
store i8* %8, i8** %6
%9 = load i8*, i8** %5
%10 = bitcast i8* %9 to i32*
%11 = load i32, i32* %10
%12 = load i8*, i8** %6
%13 = bitcast i8* %12 to i32*
%14 = load i32, i32* %13
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %11, i32 %14)
%16 = load i8*, i8** %5
%17 = load i8*, i8** %6
%18 = call i32 @swap(i8* %16, i8* %17)
%19 = load i8*, i8** %5
%20 = bitcast i8* %19 to i32*
%21 = load i32, i32* %20
%22 = load i8*, i8** %6
%23 = bitcast i8* %22 to i32*
%24 = load i32, i32* %23
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %21, i32 %24)
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%27 = load i8*, i8** %5
%28 = bitcast i8* %27 to i32*
%29 = load i32, i32* %28
%30 = load i8*, i8** %6
%31 = bitcast i8* %30 to i32*
%32 = load i32, i32* %31
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %29, i32 %32)
%34 = load i8*, i8** %5
%35 = load i8*, i8** %6
%36 = call i32 @generic_swap(i8* %34, i8* %35, i32 4)
%37 = load i8*, i8** %5
%38 = bitcast i8* %37 to i32*
%39 = load i32, i32* %38
%40 = load i8*, i8** %6
%41 = bitcast i8* %40 to i32*
%42 = load i32, i32* %41
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %39, i32 %42)
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%45 = bitcast float* %3 to i8*
store i8* %45, i8** %5
%46 = bitcast float* %4 to i8*
store i8* %46, i8** %6
%47 = load i8*, i8** %5
%48 = bitcast i8* %47 to float*
%49 = load float, float* %48
%50 = fpext float %49 to double
%51 = load i8*, i8** %6
%52 = bitcast i8* %51 to float*
%53 = load float, float* %52
%54 = fpext float %53 to double
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), double %50, double %54)
%56 = load i8*, i8** %5
%57 = load i8*, i8** %6
%58 = call i32 @generic_swap(i8* %56, i8* %57, i32 4)
%59 = load i8*, i8** %5
%60 = bitcast i8* %59 to float*
%61 = load float, float* %60
%62 = fpext float %61 to double
%63 = load i8*, i8** %6
%64 = bitcast i8* %63 to float*
%65 = load float, float* %64
%66 = fpext float %65 to double
%67 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), double %62, double %66)
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [7 x i8] c"%d %d\0A\00"
@.str.2 = [7 x i8] c"%f %f\0A\00"
@str.4 = [2 x i8] c"\0A\00"
define i32 @two_two_five() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca float
%4 = alloca float
%5 = bitcast i32* %1 to i8*
store i32 6, i32* %1
%6 = bitcast i32* %2 to i8*
store i32 9, i32* %2
%7 = bitcast float* %3 to i8*
store float 0x400921FA00000000, float* %3
%8 = bitcast float* %4 to i8*
store float 0x4005BF09A0000000, float* %4
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 6, i32 9)
%10 = call i32 @swap(i8* %5, i8* %6)
%11 = load i32, i32* %1
%12 = load i32, i32* %2
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %11, i32 %12)
%14 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.4, i64 0, i64 0))
%15 = load i32, i32* %1
%16 = load i32, i32* %2
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %15, i32 %16)
%18 = call i32 @generic_swap(i8* %5, i8* %6, i32 4)
%19 = load i32, i32* %1
%20 = load i32, i32* %2
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %19, i32 %20)
%22 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.4, i64 0, i64 0))
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), double 0x400921FA00000000, double 0x4005BF09A0000000)
%24 = call i32 @generic_swap(i8* %7, i8* %8, i32 4)
%25 = load float, float* %3
%26 = fpext float %25 to double
%27 = load float, float* %4
%28 = fpext float %27 to double
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), double %26, double %28)
%30 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.4, i64 0, i64 0))
ret i32 0
}