#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 and_i16(int, int);
int and_i32(int, int);
int and_i64(int, int);
int and_i8(int, int);
int fail_real(int /*<<< orphan*/, int);
int test_and(void) {
  if (and_i8(0x5a, 0x0f) != 0xa)
    return fail_real(0, 485);
  if (and_i16(0x5abc, 0xf000) != 0x5000)
    return fail_real(0, 487);
  if (and_i32(0x5abc1234, 0x0f000000) != 0x0a000000)
    return fail_real(0, 489);
  if (and_i64(0x5abc123456781234LL, 0x0f000000) != 0x06000000)
    return fail_real(0, 491);
  return 0x40000;
}


x86 assembly (clang, -O0):
<test_and>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x5a,%edi
mov    $0xf,%esi
call   1070 <and_i8@plt>
cmp    $0xa,%eax
je     1184 <test_and+0x34>
xor    %edi,%edi
mov    $0x1e5,%esi
call   1040 <fail_real@plt>
mov    %eax,-0x4(%rbp)
jmp    1215 <test_and+0xc5>
mov    $0x5abc,%edi
mov    $0xf000,%esi
call   1030 <and_i16@plt>
cmp    $0x5000,%eax
je     11b2 <test_and+0x62>
xor    %edi,%edi
mov    $0x1e7,%esi
call   1040 <fail_real@plt>
mov    %eax,-0x4(%rbp)
jmp    1215 <test_and+0xc5>
mov    $0x5abc1234,%edi
mov    $0xf000000,%esi
call   1060 <and_i32@plt>
cmp    $0xa000000,%eax
je     11e0 <test_and+0x90>
xor    %edi,%edi
mov    $0x1e9,%esi
call   1040 <fail_real@plt>
mov    %eax,-0x4(%rbp)
jmp    1215 <test_and+0xc5>
mov    $0x56781234,%edi
mov    $0xf000000,%esi
call   1050 <and_i64@plt>
cmp    $0x6000000,%eax
je     120e <test_and+0xbe>
xor    %edi,%edi
mov    $0x1eb,%esi
call   1040 <fail_real@plt>
mov    %eax,-0x4(%rbp)
jmp    1215 <test_and+0xc5>
movl   $0x40000,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_and>:
push   %rax
mov    $0x5a,%edi
mov    $0xf,%esi
call   1070 <and_i8@plt>
mov    $0x1e5,%esi
cmp    $0xa,%eax
jne    11c2 <test_and+0x72>
mov    $0x5abc,%edi
mov    $0xf000,%esi
call   1030 <and_i16@plt>
mov    $0x1e7,%esi
cmp    $0x5000,%eax
jne    11c2 <test_and+0x72>
mov    $0x5abc1234,%edi
mov    $0xf000000,%esi
call   1060 <and_i32@plt>
mov    $0x1e9,%esi
cmp    $0xa000000,%eax
jne    11c2 <test_and+0x72>
mov    $0x56781234,%edi
mov    $0xf000000,%esi
call   1050 <and_i64@plt>
mov    $0x1eb,%esi
cmp    $0x6000000,%eax
jne    11c2 <test_and+0x72>
mov    $0x40000,%eax
pop    %rcx
ret
xor    %edi,%edi
pop    %rax
jmp    1040 <fail_real@plt>

LLVM IR (-O0):
define i32 @test_and() {
%1 = alloca i32
%2 = call i32 @and_i8(i32 90, i32 15)
%3 = icmp ne i32 %2, 10
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = call i32 @fail_real(i32 0, i32 485)
store i32 %5, i32* %1
br label %22
6: ; preds = %0
%7 = call i32 @and_i16(i32 23228, i32 61440)
%8 = icmp ne i32 %7, 20480
br i1 %8, label %9, label %11
9: ; preds = %6
%10 = call i32 @fail_real(i32 0, i32 487)
store i32 %10, i32* %1
br label %22
11: ; preds = %6
%12 = call i32 @and_i32(i32 1522274868, i32 251658240)
%13 = icmp ne i32 %12, 167772160
br i1 %13, label %14, label %16
14: ; preds = %11
%15 = call i32 @fail_real(i32 0, i32 489)
store i32 %15, i32* %1
br label %22
16: ; preds = %11
%17 = call i32 @and_i64(i32 1450709556, i32 251658240)
%18 = icmp ne i32 %17, 100663296
br i1 %18, label %19, label %21
19: ; preds = %16
%20 = call i32 @fail_real(i32 0, i32 491)
store i32 %20, i32* %1
br label %22
21: ; preds = %16
store i32 262144, i32* %1
br label %22
22: ; preds = %21, %19, %14, %9, %4
%23 = load i32, i32* %1
ret i32 %23
}

LLVM IR (-O2):
define i32 @test_and() {
%1 = tail call i32 @and_i8(i32 90, i32 15)
%2 = icmp eq i32 %1, 10
br i1 %2, label %3, label %12
3: ; preds = %0
%4 = tail call i32 @and_i16(i32 23228, i32 61440)
%5 = icmp eq i32 %4, 20480
br i1 %5, label %6, label %12
6: ; preds = %3
%7 = tail call i32 @and_i32(i32 1522274868, i32 251658240)
%8 = icmp eq i32 %7, 167772160
br i1 %8, label %9, label %12
9: ; preds = %6
%10 = tail call i32 @and_i64(i32 1450709556, i32 251658240)
%11 = icmp eq i32 %10, 100663296
br i1 %11, label %15, label %12
12: ; preds = %9, %6, %3, %0
%13 = phi i32 [ 485, %0 ], [ 487, %3 ], [ 489, %6 ], [ 491, %9 ]
%14 = tail call i32 @fail_real(i32 0, i32 %13)
br label %15
15: ; preds = %12, %9
%16 = phi i32 [ 262144, %9 ], [ %14, %12 ]
ret i32 %16
}