#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 EXIT_SUCCESS;
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  int val = 0xA1B1C1FF;
  int mask = 0xFF;
  int result = !(~val & mask);
  int res = !!(val & mask);
  assert(result == 1);
  assert(res == 1);
  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   $0xa1b1c1ff,-0x8(%rbp)
movl   $0xff,-0xc(%rbp)
mov    -0x8(%rbp),%eax
xor    $0xffffffff,%eax
and    -0xc(%rbp),%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%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   $0x1,-0x14(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x10(%rbp),%esi
lea    0xe66(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%esi
lea    0xe57(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e2b(%rip),%rax
mov    (%rax),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x1,%edi
call   1040 <assert@plt>
mov    $0x1,%edi
call   1040 <assert@plt>
lea    0xec4(%rip),%rbx
mov    %rbx,%rdi
mov    $0x1,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
call   1030 <printf@plt>
mov    0x2e83(%rip),%rax
mov    (%rax),%eax
pop    %rbx
ret

LLVM IR (-O0):
@.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 -1582185985, i32* %2
store i32 255, i32* %3
%6 = load i32, i32* %2
%7 = xor i32 %6, -1
%8 = load i32, i32* %3
%9 = and i32 %7, %8
%10 = icmp ne i32 %9, 0
%11 = xor i1 %10, true
%12 = zext i1 %11 to i32
store i32 %12, i32* %4
%13 = load i32, i32* %2
%14 = load i32, i32* %3
%15 = and i32 %13, %14
%16 = icmp ne i32 %15, 0
%17 = xor i1 %16, true
%18 = xor i1 %17, true
%19 = zext i1 %18 to i32
store i32 %19, i32* %5
%20 = load i32, i32* %4
%21 = icmp eq i32 %20, 1
%22 = zext i1 %21 to i32
%23 = call i32 @assert(i32 %22)
%24 = load i32, i32* %5
%25 = icmp eq i32 %24, 1
%26 = zext i1 %25 to i32
%27 = call i32 @assert(i32 %26)
%28 = load i32, i32* %4
%29 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %28)
%30 = load i32, i32* %5
%31 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %30)
%32 = load i32, i32* @EXIT_SUCCESS
ret i32 %32
}

LLVM IR (-O2):
@.str = [12 x i8] c"result: %d\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = tail call i32 @assert(i32 1)
%2 = tail call i32 @assert(i32 1)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 1)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 1)
%5 = load i32, i32* @EXIT_SUCCESS
ret i32 %5
}