#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 CHAR_BIT;
int EXIT_SUCCESS;
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  int val = 0x00FFFFFF;
  int mask = 0xFF;
  int result = !(val & (mask << CHAR_BIT * 3));
  int res = !!(~val & mask);
  assert(result == 1);
  assert(res == 0);
  printf("result: %d\n", result);
  printf("result: %d\n", res);
  return (EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xffffff,-0x8(%rbp)
movl   $0xff,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    -0xc(%rbp),%edx
mov    0x2e96(%rip),%rcx
imul   $0x3,(%rcx),%ecx
shl    %cl,%edx
mov    %edx,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
xor    $0xffffffff,%eax
and    -0xc(%rbp),%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x1,-0x10(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
cmpl   $0x0,-0x14(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x10(%rbp),%esi
lea    0xe56(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%esi
lea    0xe47(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e13(%rip),%rax
mov    (%rax),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    0x2eb5(%rip),%rax
mov    (%rax),%eax
lea    (%rax,%rax,2),%ecx
mov    $0xff,%eax
shl    %cl,%eax
xor    %ebx,%ebx
test   $0xffffff,%eax
sete   %bl
mov    %ebx,%edi
call   1040 <assert@plt>
mov    $0x1,%edi
call   1040 <assert@plt>
lea    0xea7(%rip),%r14
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
mov    %r14,%rdi
xor    %esi,%esi
call   1030 <printf@plt>
mov    0x2e64(%rip),%rax
mov    (%rax),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@CHAR_BIT = global i32 0
@.str = [12 x i8] c"result: %d\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 16777215, i32* %2
store i32 255, i32* %3
%6 = load i32, i32* %2
%7 = load i32, i32* %3
%8 = load i32, i32* @CHAR_BIT
%9 = mul nsw i32 %8, 3
%10 = shl i32 %7, %9
%11 = and i32 %6, %10
%12 = icmp ne i32 %11, 0
%13 = xor i1 %12, true
%14 = zext i1 %13 to i32
store i32 %14, i32* %4
%15 = load i32, i32* %2
%16 = xor i32 %15, -1
%17 = load i32, i32* %3
%18 = and i32 %16, %17
%19 = icmp ne i32 %18, 0
%20 = xor i1 %19, true
%21 = xor i1 %20, true
%22 = zext i1 %21 to i32
store i32 %22, i32* %5
%23 = load i32, i32* %4
%24 = icmp eq i32 %23, 1
%25 = zext i1 %24 to i32
%26 = call i32 @assert(i32 %25)
%27 = load i32, i32* %5
%28 = icmp eq i32 %27, 0
%29 = zext i1 %28 to i32
%30 = call i32 @assert(i32 %29)
%31 = load i32, i32* %4
%32 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %31)
%33 = load i32, i32* %5
%34 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %33)
%35 = load i32, i32* @EXIT_SUCCESS
ret i32 %35
}

LLVM IR (-O2):
@CHAR_BIT = global i32 0
@.str = [12 x i8] c"result: %d\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = load i32, i32* @CHAR_BIT
%2 = mul nsw i32 %1, 3
%3 = shl i32 255, %2
%4 = and i32 %3, 16777215
%5 = icmp eq i32 %4, 0
%6 = zext i1 %5 to i32
%7 = tail call i32 @assert(i32 %6)
%8 = tail call i32 @assert(i32 1)
%9 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %6)
%10 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 0)
%11 = load i32, i32* @EXIT_SUCCESS
ret i32 %11
}