#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*/ checkchar(char);
int /*<<< orphan*/ error(char *);
int /*<<< orphan*/ putbyte(int);
int /*<<< orphan*/ putcode(int /*<<< orphan*/, int /*<<< orphan*/);
int regno();
int /*<<< orphan*/ skipspace();
transfer() {
  int r1, r2;
  skipspace();
  putcode(0, 0);
  if ((r1 = regno()) < 0)
    error("register required");
  if (!checkchar(','))
    error("missing ','");
  if ((r2 = regno()) < 0)
    error("register required");
  if ((r1 ^ r2) & 0x08)
    error("invalid register combination");
  putbyte((r1 << 4) | r2);
}


x86 assembly (clang, -O0):
<transfer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1070 <skipspace@plt>
xor    %esi,%esi
mov    %esi,%edi
call   1050 <putcode@plt>
mov    $0x0,%al
call   1030 <regno@plt>
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
jge    1197 <transfer+0x37>
lea    0xe6e(%rip),%rdi
call   1060 <error@plt>
mov    $0x2c,%edi
call   1040 <checkchar@plt>
cmp    $0x0,%eax
jne    11b6 <transfer+0x56>
lea    0xe61(%rip),%rdi
call   1060 <error@plt>
mov    $0x0,%al
call   1030 <regno@plt>
mov    %eax,-0xc(%rbp)
cmp    $0x0,%eax
jge    11d5 <transfer+0x75>
lea    0xe30(%rip),%rdi
call   1060 <error@plt>
mov    -0x8(%rbp),%eax
xor    -0xc(%rbp),%eax
and    $0x8,%eax
cmp    $0x0,%eax
je     11f3 <transfer+0x93>
lea    0xe30(%rip),%rdi
call   1060 <error@plt>
mov    -0x8(%rbp),%edi
shl    $0x4,%edi
or     -0xc(%rbp),%edi
call   1080 <putbyte@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<transfer>:
push   %rbp
push   %rbx
push   %rax
xor    %eax,%eax
call   1070 <skipspace@plt>
xor    %edi,%edi
xor    %esi,%esi
call   1050 <putcode@plt>
xor    %eax,%eax
call   1030 <regno@plt>
mov    %eax,%ebx
test   %eax,%eax
jns    118c <transfer+0x2c>
lea    0xe79(%rip),%rdi
call   1060 <error@plt>
mov    $0x2c,%edi
call   1040 <checkchar@plt>
test   %eax,%eax
jne    11a6 <transfer+0x46>
lea    0xe71(%rip),%rdi
call   1060 <error@plt>
xor    %eax,%eax
call   1030 <regno@plt>
mov    %eax,%ebp
test   %eax,%eax
jns    11bf <transfer+0x5f>
lea    0xe46(%rip),%rdi
call   1060 <error@plt>
mov    %ebp,%eax
xor    %ebx,%eax
test   $0x8,%al
je     11d3 <transfer+0x73>
lea    0xe50(%rip),%rdi
call   1060 <error@plt>
shl    $0x4,%ebx
or     %ebx,%ebp
mov    %ebp,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1080 <putbyte@plt>

LLVM IR (-O0):
@.str = [18 x i8] c"register required\00"
@.str.1 = [12 x i8] c"missing ','\00"
@.str.2 = [29 x i8] c"invalid register combination\00"
define i32 @transfer() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = call i32 (...) @skipspace()
%5 = call i32 @putcode(i32 0, i32 0)
%6 = call i32 (...) @regno()
store i32 %6, i32* %2
%7 = icmp slt i32 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %0
%9 = call i32 @error(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %8, %0
%11 = call i32 @checkchar(i8 signext 44)
%12 = icmp ne i32 %11, 0
br i1 %12, label %15, label %13
13: ; preds = %10
%14 = call i32 @error(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
br label %15
15: ; preds = %13, %10
%16 = call i32 (...) @regno()
store i32 %16, i32* %3
%17 = icmp slt i32 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %15
%19 = call i32 @error(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
br label %20
20: ; preds = %18, %15
%21 = load i32, i32* %2
%22 = load i32, i32* %3
%23 = xor i32 %21, %22
%24 = and i32 %23, 8
%25 = icmp ne i32 %24, 0
br i1 %25, label %26, label %28
26: ; preds = %20
%27 = call i32 @error(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
br label %28
28: ; preds = %26, %20
%29 = load i32, i32* %2
%30 = shl i32 %29, 4
%31 = load i32, i32* %3
%32 = or i32 %30, %31
%33 = call i32 @putbyte(i32 %32)
%34 = load i32, i32* %1
ret i32 %34
}

LLVM IR (-O2):
@.str = [18 x i8] c"register required\00"
@.str.1 = [12 x i8] c"missing ','\00"
@.str.2 = [29 x i8] c"invalid register combination\00"
define i32 @transfer() {
%1 = tail call i32 (...) @skipspace()
%2 = tail call i32 @putcode(i32 0, i32 0)
%3 = tail call i32 (...) @regno()
%4 = icmp slt i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %0
%6 = tail call i32 @error(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %5, %0
%8 = tail call i32 @checkchar(i8 signext 44)
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %7
%11 = tail call i32 @error(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
br label %12
12: ; preds = %10, %7
%13 = tail call i32 (...) @regno()
%14 = icmp slt i32 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %12
%16 = tail call i32 @error(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
br label %17
17: ; preds = %15, %12
%18 = xor i32 %13, %3
%19 = and i32 %18, 8
%20 = icmp eq i32 %19, 0
br i1 %20, label %23, label %21
21: ; preds = %17
%22 = tail call i32 @error(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
br label %23
23: ; preds = %21, %17
%24 = shl i32 %3, 4
%25 = or i32 %13, %24
%26 = tail call i32 @putbyte(i32 %25)
ret i32 undef
}