#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 */
scalar_t__ getTransformationBit(int, int);
int transformXY(int *x, int *y, int transformations) {
  if (getTransformationBit(1, transformations)) {
    *x *= -1;
  }
  if (getTransformationBit(2, transformations)) {
    *y *= -1;
  }
  if (getTransformationBit(3, transformations)) {
    int tmp = *x;
    *x = *y;
    *y = tmp;
  }
}


x86 assembly (clang, -O0):
<transformXY>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    -0x1c(%rbp),%esi
mov    $0x1,%edi
call   1030 <getTransformationBit@plt>
cmp    $0x0,%rax
je     1143 <transformXY+0x33>
mov    -0x10(%rbp),%rax
imul   $0xffffffff,(%rax),%ecx
mov    %ecx,(%rax)
mov    -0x1c(%rbp),%esi
mov    $0x2,%edi
call   1030 <getTransformationBit@plt>
cmp    $0x0,%rax
je     1163 <transformXY+0x53>
mov    -0x18(%rbp),%rax
imul   $0xffffffff,(%rax),%ecx
mov    %ecx,(%rax)
mov    -0x1c(%rbp),%esi
mov    $0x3,%edi
call   1030 <getTransformationBit@plt>
cmp    $0x0,%rax
je     1198 <transformXY+0x88>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x20(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<transformXY>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%ebp
mov    %rsi,%r14
mov    %rdi,%rbx
mov    $0x1,%edi
mov    %edx,%esi
call   1030 <getTransformationBit@plt>
test   %rax,%rax
je     112f <transformXY+0x1f>
negl   (%rbx)
mov    $0x2,%edi
mov    %ebp,%esi
call   1030 <getTransformationBit@plt>
test   %rax,%rax
je     1143 <transformXY+0x33>
negl   (%r14)
mov    $0x3,%edi
mov    %ebp,%esi
call   1030 <getTransformationBit@plt>
test   %rax,%rax
je     115e <transformXY+0x4e>
mov    (%rbx),%eax
mov    (%r14),%ecx
mov    %ecx,(%rbx)
mov    %eax,(%r14)
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @transformXY(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** %5
store i32* %1, i32** %6
store i32 %2, i32* %7
%9 = load i32, i32* %7
%10 = call i64 @getTransformationBit(i32 1, i32 %9)
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %16
12: ; preds = %3
%13 = load i32*, i32** %5
%14 = load i32, i32* %13
%15 = mul nsw i32 %14, -1
store i32 %15, i32* %13
br label %16
16: ; preds = %12, %3
%17 = load i32, i32* %7
%18 = call i64 @getTransformationBit(i32 2, i32 %17)
%19 = icmp ne i64 %18, 0
br i1 %19, label %20, label %24
20: ; preds = %16
%21 = load i32*, i32** %6
%22 = load i32, i32* %21
%23 = mul nsw i32 %22, -1
store i32 %23, i32* %21
br label %24
24: ; preds = %20, %16
%25 = load i32, i32* %7
%26 = call i64 @getTransformationBit(i32 3, i32 %25)
%27 = icmp ne i64 %26, 0
br i1 %27, label %28, label %36
28: ; preds = %24
%29 = load i32*, i32** %5
%30 = load i32, i32* %29
store i32 %30, i32* %8
%31 = load i32*, i32** %6
%32 = load i32, i32* %31
%33 = load i32*, i32** %5
store i32 %32, i32* %33
%34 = load i32, i32* %8
%35 = load i32*, i32** %6
store i32 %34, i32* %35
br label %36
36: ; preds = %28, %24
%37 = load i32, i32* %4
ret i32 %37
}

LLVM IR (-O2):
define i32 @transformXY(i32* nocapture %0, i32* nocapture %1, i32 %2) {
%4 = tail call i64 @getTransformationBit(i32 1, i32 %2)
%5 = icmp eq i64 %4, 0
br i1 %5, label %9, label %6
6: ; preds = %3
%7 = load i32, i32* %0
%8 = sub nsw i32 0, %7
store i32 %8, i32* %0
br label %9
9: ; preds = %6, %3
%10 = tail call i64 @getTransformationBit(i32 2, i32 %2)
%11 = icmp eq i64 %10, 0
br i1 %11, label %15, label %12
12: ; preds = %9
%13 = load i32, i32* %1
%14 = sub nsw i32 0, %13
store i32 %14, i32* %1
br label %15
15: ; preds = %12, %9
%16 = tail call i64 @getTransformationBit(i32 3, i32 %2)
%17 = icmp eq i64 %16, 0
br i1 %17, label %21, label %18
18: ; preds = %15
%19 = load i32, i32* %0
%20 = load i32, i32* %1
store i32 %20, i32* %0
store i32 %19, i32* %1
br label %21
21: ; preds = %18, %15
ret i32 undef
}