#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 /*<<< orphan*/ addbyte(int);
void AND_HOST_REG_L(int dst_reg, int src_reg) {
  if (dst_reg & src_reg & 8) {
    addbyte(0x45);
    addbyte(0x21);
    addbyte(0xc0 | (dst_reg & 7) | ((src_reg & 7) << 3));
  } else if (dst_reg & 8) {
    addbyte(0x41);
    addbyte(0x21);
    addbyte(0xc0 | (dst_reg & 7) | ((src_reg & 7) << 3));
  } else if (src_reg & 8) {
    addbyte(0x44);
    addbyte(0x21);
    addbyte(0xc0 | (dst_reg & 7) | ((src_reg & 7) << 3));
  } else {
    addbyte(0x21);
    addbyte(0xc0 | (dst_reg & 7) | ((src_reg & 7) << 3));
  }
}


x86 assembly (clang, -O0):
<AND_HOST_REG_L>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
and    -0x8(%rbp),%eax
and    $0x8,%eax
cmp    $0x0,%eax
je     1165 <AND_HOST_REG_L+0x55>
mov    $0x45,%edi
call   1030 <addbyte@plt>
mov    $0x21,%edi
call   1030 <addbyte@plt>
mov    -0x4(%rbp),%edi
and    $0x7,%edi
or     $0xc0,%edi
mov    -0x8(%rbp),%eax
and    $0x7,%eax
shl    $0x3,%eax
or     %eax,%edi
call   1030 <addbyte@plt>
jmp    121d <AND_HOST_REG_L+0x10d>
mov    -0x4(%rbp),%eax
and    $0x8,%eax
cmp    $0x0,%eax
je     11a9 <AND_HOST_REG_L+0x99>
mov    $0x41,%edi
call   1030 <addbyte@plt>
mov    $0x21,%edi
call   1030 <addbyte@plt>
mov    -0x4(%rbp),%edi
and    $0x7,%edi
or     $0xc0,%edi
mov    -0x8(%rbp),%eax
and    $0x7,%eax
shl    $0x3,%eax
or     %eax,%edi
call   1030 <addbyte@plt>
jmp    1218 <AND_HOST_REG_L+0x108>
mov    -0x8(%rbp),%eax
and    $0x8,%eax
cmp    $0x0,%eax
je     11ed <AND_HOST_REG_L+0xdd>
mov    $0x44,%edi
call   1030 <addbyte@plt>
mov    $0x21,%edi
call   1030 <addbyte@plt>
mov    -0x4(%rbp),%edi
and    $0x7,%edi
or     $0xc0,%edi
mov    -0x8(%rbp),%eax
and    $0x7,%eax
shl    $0x3,%eax
or     %eax,%edi
call   1030 <addbyte@plt>
jmp    1213 <AND_HOST_REG_L+0x103>
mov    $0x21,%edi
call   1030 <addbyte@plt>
mov    -0x4(%rbp),%edi
and    $0x7,%edi
or     $0xc0,%edi
mov    -0x8(%rbp),%eax
and    $0x7,%eax
shl    $0x3,%eax
or     %eax,%edi
call   1030 <addbyte@plt>
jmp    1218 <AND_HOST_REG_L+0x108>
jmp    121d <AND_HOST_REG_L+0x10d>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<AND_HOST_REG_L>:
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%r14d
mov    %edi,%eax
and    $0x8,%eax
mov    $0x45,%edi
test   %esi,%eax
jne    113a <AND_HOST_REG_L+0x2a>
mov    $0x41,%edi
test   %eax,%eax
jne    113a <AND_HOST_REG_L+0x2a>
mov    $0x44,%edi
test   $0x8,%bl
je     113f <AND_HOST_REG_L+0x2f>
call   1030 <addbyte@plt>
mov    $0x21,%edi
call   1030 <addbyte@plt>
and    $0x7,%r14d
and    $0x1f,%ebx
lea    (%r14,%rbx,8),%edi
or     $0xc0,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <addbyte@plt>

LLVM IR (-O0):
define void @AND_HOST_REG_L(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = and i32 %5, %6
%8 = and i32 %7, 8
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %21
10: ; preds = %2
%11 = call i32 @addbyte(i32 69)
%12 = call i32 @addbyte(i32 33)
%13 = load i32, i32* %3
%14 = and i32 %13, 7
%15 = or i32 192, %14
%16 = load i32, i32* %4
%17 = and i32 %16, 7
%18 = shl i32 %17, 3
%19 = or i32 %15, %18
%20 = call i32 @addbyte(i32 %19)
br label %63
21: ; preds = %2
%22 = load i32, i32* %3
%23 = and i32 %22, 8
%24 = icmp ne i32 %23, 0
br i1 %24, label %25, label %36
25: ; preds = %21
%26 = call i32 @addbyte(i32 65)
%27 = call i32 @addbyte(i32 33)
%28 = load i32, i32* %3
%29 = and i32 %28, 7
%30 = or i32 192, %29
%31 = load i32, i32* %4
%32 = and i32 %31, 7
%33 = shl i32 %32, 3
%34 = or i32 %30, %33
%35 = call i32 @addbyte(i32 %34)
br label %62
36: ; preds = %21
%37 = load i32, i32* %4
%38 = and i32 %37, 8
%39 = icmp ne i32 %38, 0
br i1 %39, label %40, label %51
40: ; preds = %36
%41 = call i32 @addbyte(i32 68)
%42 = call i32 @addbyte(i32 33)
%43 = load i32, i32* %3
%44 = and i32 %43, 7
%45 = or i32 192, %44
%46 = load i32, i32* %4
%47 = and i32 %46, 7
%48 = shl i32 %47, 3
%49 = or i32 %45, %48
%50 = call i32 @addbyte(i32 %49)
br label %61
51: ; preds = %36
%52 = call i32 @addbyte(i32 33)
%53 = load i32, i32* %3
%54 = and i32 %53, 7
%55 = or i32 192, %54
%56 = load i32, i32* %4
%57 = and i32 %56, 7
%58 = shl i32 %57, 3
%59 = or i32 %55, %58
%60 = call i32 @addbyte(i32 %59)
br label %61
61: ; preds = %51, %40
br label %62
62: ; preds = %61, %25
br label %63
63: ; preds = %62, %10
ret void
}

LLVM IR (-O2):
define void @AND_HOST_REG_L(i32 %0, i32 %1) {
%3 = and i32 %0, 8
%4 = and i32 %3, %1
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %11
6: ; preds = %2
%7 = icmp eq i32 %3, 0
br i1 %7, label %8, label %11
8: ; preds = %6
%9 = and i32 %1, 8
%10 = icmp eq i32 %9, 0
br i1 %10, label %14, label %11
11: ; preds = %8, %6, %2
%12 = phi i32 [ 69, %2 ], [ 65, %6 ], [ 68, %8 ]
%13 = tail call i32 @addbyte(i32 %12)
br label %14
14: ; preds = %11, %8
%15 = tail call i32 @addbyte(i32 33)
%16 = and i32 %0, 7
%17 = shl i32 %1, 3
%18 = and i32 %17, 56
%19 = or i32 %16, %18
%20 = or i32 %19, 192
%21 = tail call i32 @addbyte(i32 %20)
ret void
}