#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 INT_MIN;
int threefourths(int x) {
  int last2bits_mask = 0x3;
  int high_bits_of_x = x & ~last2bits_mask;
  int high_div4 = high_bits_of_x >> 2;
  int high_div4_mul3 = high_div4 + (high_div4 << 1);
  int low_bits_of_x = x & last2bits_mask;
  int low_mul3 = low_bits_of_x + (low_bits_of_x << 1);
  int is_negative = x & INT_MIN;
  int bias = 4 - 1;
  is_negative && (low_mul3 = low_mul3 + bias);
  int low_mul3_div4 = low_mul3 >> 2;
  return high_div4_mul3 + low_mul3_div4;
}


x86 assembly (clang, -O0):
<threefourths>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x3,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
sar    $0x2,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    -0x10(%rbp),%ecx
shl    $0x1,%ecx
add    %ecx,%eax
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%eax
and    -0x8(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    -0x18(%rbp),%ecx
shl    $0x1,%ecx
add    %ecx,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x4(%rbp),%eax
mov    0x2e94(%rip),%rcx
and    (%rcx),%eax
mov    %eax,-0x20(%rbp)
movl   $0x3,-0x24(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x20(%rbp)
mov    %al,-0x29(%rbp)
je     1181 <threefourths+0x81>
mov    -0x1c(%rbp),%eax
add    -0x24(%rbp),%eax
mov    %eax,-0x1c(%rbp)
cmp    $0x0,%eax
setne  %al
mov    %al,-0x29(%rbp)
mov    -0x29(%rbp),%al
mov    -0x1c(%rbp),%eax
sar    $0x2,%eax
mov    %eax,-0x28(%rbp)
mov    -0x14(%rbp),%eax
add    -0x28(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<threefourths>:
mov    %edi,%eax
and    $0x3,%eax
mov    0x2edc(%rip),%rcx
test   %edi,(%rcx)
lea    (%rax,%rax,2),%ecx
lea    0x3(%rax,%rax,2),%eax
cmove  %ecx,%eax
sar    $0x2,%edi
lea    (%rdi,%rdi,2),%ecx
shr    $0x2,%eax
add    %ecx,%eax
ret

LLVM IR (-O0):
@INT_MIN = global i32 0
define i32 @threefourths(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i32 %0, i32* %2
store i32 3, i32* %3
%12 = load i32, i32* %2
%13 = load i32, i32* %3
%14 = xor i32 %13, -1
%15 = and i32 %12, %14
store i32 %15, i32* %4
%16 = load i32, i32* %4
%17 = ashr i32 %16, 2
store i32 %17, i32* %5
%18 = load i32, i32* %5
%19 = load i32, i32* %5
%20 = shl i32 %19, 1
%21 = add nsw i32 %18, %20
store i32 %21, i32* %6
%22 = load i32, i32* %2
%23 = load i32, i32* %3
%24 = and i32 %22, %23
store i32 %24, i32* %7
%25 = load i32, i32* %7
%26 = load i32, i32* %7
%27 = shl i32 %26, 1
%28 = add nsw i32 %25, %27
store i32 %28, i32* %8
%29 = load i32, i32* %2
%30 = load i32, i32* @INT_MIN
%31 = and i32 %29, %30
store i32 %31, i32* %9
store i32 3, i32* %10
%32 = load i32, i32* %9
%33 = icmp ne i32 %32, 0
br i1 %33, label %34, label %39
34: ; preds = %1
%35 = load i32, i32* %8
%36 = load i32, i32* %10
%37 = add nsw i32 %35, %36
store i32 %37, i32* %8
%38 = icmp ne i32 %37, 0
br label %39
39: ; preds = %34, %1
%40 = phi i1 [ false, %1 ], [ %38, %34 ]
%41 = zext i1 %40 to i32
%42 = load i32, i32* %8
%43 = ashr i32 %42, 2
store i32 %43, i32* %11
%44 = load i32, i32* %6
%45 = load i32, i32* %11
%46 = add nsw i32 %44, %45
ret i32 %46
}

LLVM IR (-O2):
@INT_MIN = global i32 0
define i32 @threefourths(i32 %0) {
%2 = and i32 %0, 3
%3 = mul nuw nsw i32 %2, 3
%4 = load i32, i32* @INT_MIN
%5 = and i32 %4, %0
%6 = icmp eq i32 %5, 0
%7 = add nuw nsw i32 %3, 3
%8 = select i1 %6, i32 %3, i32 %7
%9 = ashr i32 %0, 2
%10 = mul nsw i32 %9, 3
%11 = lshr i32 %8, 2
%12 = add nsw i32 %11, %10
ret i32 %12
}