#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*/ assem_debug(char *, int, int, int);
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ output_w32(int);
void emit_fdivs(int s1, int s2, int d) {
  assert(s1 == 31);
  assert((s2 == 30) || (s2 == 31));
  assert(d == 31);
  assem_debug("fdivs s%d,s%d,s%d", d, s1, s2);
  output_w32(0x1e201800 | s2 << 16 | s1 << 5 | d);
}


x86 assembly (clang, -O0):
<emit_fdivs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
cmpl   $0x1f,-0x4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    $0x1,%al
cmpl   $0x1e,-0x8(%rbp)
mov    %al,-0xd(%rbp)
je     116b <emit_fdivs+0x3b>
cmpl   $0x1f,-0x8(%rbp)
sete   %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
cmpl   $0x1f,-0xc(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0xc(%rbp),%esi
mov    -0x4(%rbp),%edx
mov    -0x8(%rbp),%ecx
lea    0xe67(%rip),%rdi
call   1030 <assem_debug@plt>
mov    -0x8(%rbp),%edi
shl    $0x10,%edi
or     $0x1e201800,%edi
mov    -0x4(%rbp),%eax
shl    $0x5,%eax
or     %eax,%edi
or     -0xc(%rbp),%edi
call   1040 <output_w32@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<emit_fdivs>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %esi,%ebp
mov    %edi,%ebx
xor    %edi,%edi
cmp    $0x1f,%ebx
sete   %dil
call   1050 <assert@plt>
mov    %ebp,%eax
and    $0xfffffffe,%eax
xor    %edi,%edi
cmp    $0x1e,%eax
sete   %dil
call   1050 <assert@plt>
xor    %edi,%edi
cmp    $0x1f,%r14d
sete   %dil
call   1050 <assert@plt>
lea    0xe8e(%rip),%rdi
mov    %r14d,%esi
mov    %ebx,%edx
mov    %ebp,%ecx
call   1030 <assem_debug@plt>
shl    $0x10,%ebp
shl    $0x5,%ebx
or     %ebp,%ebx
or     %r14d,%ebx
or     $0x1e201800,%ebx
mov    %ebx,%edi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <output_w32@plt>

LLVM IR (-O0):
@.str = [18 x i8] c"fdivs s%d,s%d,s%d\00"
define void @emit_fdivs(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = icmp eq i32 %7, 31
%9 = zext i1 %8 to i32
%10 = call i32 @assert(i32 %9)
%11 = load i32, i32* %5
%12 = icmp eq i32 %11, 30
br i1 %12, label %16, label %13
13: ; preds = %3
%14 = load i32, i32* %5
%15 = icmp eq i32 %14, 31
br label %16
16: ; preds = %13, %3
%17 = phi i1 [ true, %3 ], [ %15, %13 ]
%18 = zext i1 %17 to i32
%19 = call i32 @assert(i32 %18)
%20 = load i32, i32* %6
%21 = icmp eq i32 %20, 31
%22 = zext i1 %21 to i32
%23 = call i32 @assert(i32 %22)
%24 = load i32, i32* %6
%25 = load i32, i32* %4
%26 = load i32, i32* %5
%27 = call i32 @assem_debug(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %24, i32 %25, i32 %26)
%28 = load i32, i32* %5
%29 = shl i32 %28, 16
%30 = or i32 505419776, %29
%31 = load i32, i32* %4
%32 = shl i32 %31, 5
%33 = or i32 %30, %32
%34 = load i32, i32* %6
%35 = or i32 %33, %34
%36 = call i32 @output_w32(i32 %35)
ret void
}

LLVM IR (-O2):
@.str = [18 x i8] c"fdivs s%d,s%d,s%d\00"
define void @emit_fdivs(i32 %0, i32 %1, i32 %2) {
%4 = icmp eq i32 %0, 31
%5 = zext i1 %4 to i32
%6 = tail call i32 @assert(i32 %5)
%7 = and i32 %1, -2
%8 = icmp eq i32 %7, 30
%9 = zext i1 %8 to i32
%10 = tail call i32 @assert(i32 %9)
%11 = icmp eq i32 %2, 31
%12 = zext i1 %11 to i32
%13 = tail call i32 @assert(i32 %12)
%14 = tail call i32 @assem_debug(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %2, i32 %0, i32 %1)
%15 = shl i32 %1, 16
%16 = shl i32 %0, 5
%17 = or i32 %16, %15
%18 = or i32 %17, %2
%19 = or i32 %18, 505419776
%20 = tail call i32 @output_w32(i32 %19)
ret void
}