#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 sprintf(char *, char *, char, int, int, int);
char *print_vfpu_reg(int reg, int offset, char one, char two, char *output) {
  int len;
  if ((reg >> 5) & 1) {
    len = sprintf(output, "%c%d%d%d", two, (reg >> 2) & 7, offset, reg & 3);
  } else {
    len = sprintf(output, "%c%d%d%d", one, (reg >> 2) & 7, reg & 3, offset);
  }
  return output + len;
}


x86 assembly (clang, -O0):
<print_vfpu_reg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %cl,%al
mov    %dl,%cl
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %cl,-0x9(%rbp)
mov    %al,-0xa(%rbp)
mov    %r8,-0x18(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x5,%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     1171 <print_vfpu_reg+0x61>
mov    -0x18(%rbp),%rdi
mov    -0xa(%rbp),%al
mov    -0x4(%rbp),%ecx
sar    $0x2,%ecx
and    $0x7,%ecx
mov    -0x8(%rbp),%r8d
mov    -0x4(%rbp),%r9d
and    $0x3,%r9d
lea    0xe9f(%rip),%rsi
movsbl %al,%edx
call   1030 <sprintf@plt>
mov    %eax,-0x1c(%rbp)
jmp    119f <print_vfpu_reg+0x8f>
mov    -0x18(%rbp),%rdi
mov    -0x9(%rbp),%al
mov    -0x4(%rbp),%ecx
sar    $0x2,%ecx
and    $0x7,%ecx
mov    -0x4(%rbp),%r8d
and    $0x3,%r8d
mov    -0x8(%rbp),%r9d
lea    0xe6c(%rip),%rsi
movsbl %al,%edx
call   1030 <sprintf@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
add    %rcx,%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_vfpu_reg>:
push   %rbx
mov    %r8,%rbx
mov    %ecx,%r8d
mov    %esi,%r9d
mov    %edi,%ecx
shr    $0x2,%ecx
and    $0x7,%ecx
mov    %edi,%eax
and    $0x3,%eax
test   $0x20,%dil
jne    113f <print_vfpu_reg+0x2f>
movsbl %dl,%edx
lea    0xec9(%rip),%rsi
mov    %rbx,%rdi
mov    %eax,%r8d
jmp    1153 <print_vfpu_reg+0x43>
movsbl %r8b,%edx
lea    0xeb6(%rip),%rsi
mov    %rbx,%rdi
mov    %r9d,%r8d
mov    %eax,%r9d
call   1030 <sprintf@plt>
cltq
add    %rax,%rbx
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [9 x i8] c"%c%d%d%d\00"
define i8* @print_vfpu_reg(i32 %0, i32 %1, i8 signext %2, i8 signext %3, i8* %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8
%9 = alloca i8
%10 = alloca i8*
%11 = alloca i32
store i32 %0, i32* %6
store i32 %1, i32* %7
store i8 %2, i8* %8
store i8 %3, i8* %9
store i8* %4, i8** %10
%12 = load i32, i32* %6
%13 = ashr i32 %12, 5
%14 = and i32 %13, 1
%15 = icmp ne i32 %14, 0
br i1 %15, label %16, label %26
16: ; preds = %5
%17 = load i8*, i8** %10
%18 = load i8, i8* %9
%19 = load i32, i32* %6
%20 = ashr i32 %19, 2
%21 = and i32 %20, 7
%22 = load i32, i32* %7
%23 = load i32, i32* %6
%24 = and i32 %23, 3
%25 = call i32 @sprintf(i8* %17, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8 signext %18, i32 %21, i32 %22, i32 %24)
store i32 %25, i32* %11
br label %36
26: ; preds = %5
%27 = load i8*, i8** %10
%28 = load i8, i8* %8
%29 = load i32, i32* %6
%30 = ashr i32 %29, 2
%31 = and i32 %30, 7
%32 = load i32, i32* %6
%33 = and i32 %32, 3
%34 = load i32, i32* %7
%35 = call i32 @sprintf(i8* %27, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8 signext %28, i32 %31, i32 %33, i32 %34)
store i32 %35, i32* %11
br label %36
36: ; preds = %26, %16
%37 = load i8*, i8** %10
%38 = load i32, i32* %11
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds i8, i8* %37, i64 %39
ret i8* %40
}

LLVM IR (-O2):
@.str = [9 x i8] c"%c%d%d%d\00"
define i8* @print_vfpu_reg(i32 %0, i32 %1, i8 signext %2, i8 signext %3, i8* writeonly %4) {
%6 = and i32 %0, 32
%7 = icmp eq i32 %6, 0
%8 = lshr i32 %0, 2
%9 = and i32 %8, 7
%10 = and i32 %0, 3
br i1 %7, label %13, label %11
11: ; preds = %5
%12 = tail call i32 @sprintf(i8* dereferenceable(1) %4, i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8 signext %3, i32 %9, i32 %1, i32 %10)
br label %15
13: ; preds = %5
%14 = tail call i32 @sprintf(i8* dereferenceable(1) %4, i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8 signext %2, i32 %9, i32 %10, i32 %1)
br label %15
15: ; preds = %13, %11
%16 = phi i32 [ %12, %11 ], [ %14, %13 ]
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8, i8* %4, i64 %17
ret i8* %18
}