#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 */
typedef unsigned int i;

/* Variables and functions */
int /*<<< orphan*/ myputs(char *);
int /*<<< orphan*/ put_unsigned(unsigned int);
void check(unsigned i, unsigned found) {
  unsigned want = ((0 - ((i)&1)) ^ (((i) << 4) + 1));
  if (found != want) {
    myputs("FAILED at ");
    put_unsigned(i);
    myputs("! Got ");
    put_unsigned(found);
    myputs(" expected ");
    put_unsigned(want);
    myputs("\n");
  }
}


x86 assembly (clang, -O0):
<check>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%ecx
and    $0x1,%ecx
xor    %eax,%eax
sub    %ecx,%eax
mov    -0x4(%rbp),%ecx
shl    $0x4,%ecx
add    $0x1,%ecx
xor    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
je     119a <check+0x7a>
lea    0xea7(%rip),%rdi
call   1030 <myputs@plt>
mov    -0x4(%rbp),%edi
call   1040 <put_unsigned@plt>
lea    0xe9e(%rip),%rdi
call   1030 <myputs@plt>
mov    -0x8(%rbp),%edi
call   1040 <put_unsigned@plt>
lea    0xe91(%rip),%rdi
call   1030 <myputs@plt>
mov    -0xc(%rbp),%edi
call   1040 <put_unsigned@plt>
lea    0xe88(%rip),%rdi
call   1030 <myputs@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check>:
push   %rbp
push   %r14
push   %rbx
mov    %edi,%eax
and    $0x1,%eax
neg    %eax
mov    %edi,%ebx
shl    $0x4,%ebx
or     $0x1,%ebx
xor    %eax,%ebx
cmp    %esi,%ebx
jne    113e <check+0x1e>
pop    %rbx
pop    %r14
pop    %rbp
ret
mov    %esi,%r14d
mov    %edi,%ebp
lea    0xeb6(%rip),%rdi
call   1030 <myputs@plt>
mov    %ebp,%edi
call   1040 <put_unsigned@plt>
lea    0xeae(%rip),%rdi
call   1030 <myputs@plt>
mov    %r14d,%edi
call   1040 <put_unsigned@plt>
lea    0xea1(%rip),%rdi
call   1030 <myputs@plt>
mov    %ebx,%edi
call   1040 <put_unsigned@plt>
lea    0xe99(%rip),%rdi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <myputs@plt>

LLVM IR (-O0):
@.str = [11 x i8] c"FAILED at \00"
@.str.1 = [7 x i8] c"! Got \00"
@.str.2 = [11 x i8] c" expected \00"
@.str.3 = [2 x i8] c"\0A\00"
define void @check(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %3
%7 = and i32 %6, 1
%8 = sub i32 0, %7
%9 = load i32, i32* %3
%10 = shl i32 %9, 4
%11 = add i32 %10, 1
%12 = xor i32 %8, %11
store i32 %12, i32* %5
%13 = load i32, i32* %4
%14 = load i32, i32* %5
%15 = icmp ne i32 %13, %14
br i1 %15, label %16, label %27
16: ; preds = %2
%17 = call i32 @myputs(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%18 = load i32, i32* %3
%19 = call i32 @put_unsigned(i32 %18)
%20 = call i32 @myputs(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%21 = load i32, i32* %4
%22 = call i32 @put_unsigned(i32 %21)
%23 = call i32 @myputs(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
%24 = load i32, i32* %5
%25 = call i32 @put_unsigned(i32 %24)
%26 = call i32 @myputs(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %27
27: ; preds = %16, %2
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"FAILED at \00"
@.str.1 = [7 x i8] c"! Got \00"
@.str.2 = [11 x i8] c" expected \00"
@.str.3 = [2 x i8] c"\0A\00"
define void @check(i32 %0, i32 %1) {
%3 = and i32 %0, 1
%4 = sub nsw i32 0, %3
%5 = shl i32 %0, 4
%6 = or i32 %5, 1
%7 = xor i32 %6, %4
%8 = icmp eq i32 %7, %1
br i1 %8, label %17, label %9
9: ; preds = %2
%10 = tail call i32 @myputs(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%11 = tail call i32 @put_unsigned(i32 %0)
%12 = tail call i32 @myputs(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%13 = tail call i32 @put_unsigned(i32 %1)
%14 = tail call i32 @myputs(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
%15 = tail call i32 @put_unsigned(i32 %7)
%16 = tail call i32 @myputs(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %17
17: ; preds = %9, %2
ret void
}