#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 */
unsigned int nth_position(unsigned int, int);
unsigned int zero_nth_position(unsigned int, int);
unsigned int exchange_bits(unsigned int number, int bitFrom, int bitTo) {
  unsigned int positionThree_Five, positionTwntyFour_TwentySix;
  positionThree_Five = nth_position(number, bitFrom);
  positionTwntyFour_TwentySix = nth_position(number, bitTo);
  number = zero_nth_position(number, bitTo);
  number = number | (positionThree_Five << bitTo);
  number = zero_nth_position(number, bitFrom);
  number = number | (positionTwntyFour_TwentySix << bitFrom);
  return number;
}


x86 assembly (clang, -O0):
<exchange_bits>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1040 <nth_position@plt>
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1040 <nth_position@plt>
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1030 <zero_nth_position@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x10(%rbp),%edx
mov    -0xc(%rbp),%ecx
shl    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <zero_nth_position@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x14(%rbp),%edx
mov    -0x8(%rbp),%ecx
shl    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<exchange_bits>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %edx,%r15d
mov    %esi,%r14d
mov    %edi,%ebx
call   1040 <nth_position@plt>
mov    %eax,%ebp
mov    %ebx,%edi
mov    %r15d,%esi
call   1040 <nth_position@plt>
mov    %eax,%r12d
mov    %ebx,%edi
mov    %r15d,%esi
call   1030 <zero_nth_position@plt>
mov    %r15d,%ecx
shl    %cl,%ebp
or     %eax,%ebp
mov    %ebp,%edi
mov    %r14d,%esi
call   1030 <zero_nth_position@plt>
mov    %r14d,%ecx
shl    %cl,%r12d
or     %r12d,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @exchange_bits(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%9 = load i32, i32* %4
%10 = load i32, i32* %5
%11 = call i32 @nth_position(i32 %9, i32 %10)
store i32 %11, i32* %7
%12 = load i32, i32* %4
%13 = load i32, i32* %6
%14 = call i32 @nth_position(i32 %12, i32 %13)
store i32 %14, i32* %8
%15 = load i32, i32* %4
%16 = load i32, i32* %6
%17 = call i32 @zero_nth_position(i32 %15, i32 %16)
store i32 %17, i32* %4
%18 = load i32, i32* %4
%19 = load i32, i32* %7
%20 = load i32, i32* %6
%21 = shl i32 %19, %20
%22 = or i32 %18, %21
store i32 %22, i32* %4
%23 = load i32, i32* %4
%24 = load i32, i32* %5
%25 = call i32 @zero_nth_position(i32 %23, i32 %24)
store i32 %25, i32* %4
%26 = load i32, i32* %4
%27 = load i32, i32* %8
%28 = load i32, i32* %5
%29 = shl i32 %27, %28
%30 = or i32 %26, %29
store i32 %30, i32* %4
%31 = load i32, i32* %4
ret i32 %31
}

LLVM IR (-O2):
define i32 @exchange_bits(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 @nth_position(i32 %0, i32 %1)
%5 = tail call i32 @nth_position(i32 %0, i32 %2)
%6 = tail call i32 @zero_nth_position(i32 %0, i32 %2)
%7 = shl i32 %4, %2
%8 = or i32 %6, %7
%9 = tail call i32 @zero_nth_position(i32 %8, i32 %1)
%10 = shl i32 %5, %1
%11 = or i32 %9, %10
ret i32 %11
}