void ultoe(lp, y) unsigned long *lp;
unsigned short *y;
{
  unsigned short yi[(6 + 3)];
  unsigned long ll;
  int k;
  ecleaz(yi);
  ll = *lp;
  if (sizeof(long) == 8) {
    yi[2] = (unsigned short)(ll >> ((8 * sizeof(long)) - 16));
    yi[2 + 1] = (unsigned short)(ll >> ((8 * sizeof(long)) - 32));
    yi[2 + 2] = (unsigned short)(ll >> 16);
    yi[2 + 3] = (unsigned short)ll;
    yi[1] = (0x3fff) + 47;
  } else {
    yi[2] = (unsigned short)(ll >> 16);
    yi[2 + 1] = (unsigned short)ll;
    yi[1] = (0x3fff) + 15;
  }
  if ((k = enormlz(yi)) > (((6 + 3) - 4) * 16))
    ecleaz(yi);
  else
    yi[1] -= (unsigned short)k;
  emovo(yi, y);
}


x86 assembly (clang, -O0):
<ultoe>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x30(%rbp),%rdi
mov    $0x0,%al
call   1050 <ecleaz@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
shr    $0x30,%rax
mov    %ax,-0x2c(%rbp)
mov    -0x38(%rbp),%rax
shr    $0x20,%rax
mov    %ax,-0x2a(%rbp)
mov    -0x38(%rbp),%rax
shr    $0x10,%rax
mov    %ax,-0x28(%rbp)
mov    -0x38(%rbp),%rax
mov    %ax,-0x26(%rbp)
movw   $0x402e,-0x2e(%rbp)
lea    -0x30(%rbp),%rdi
mov    $0x0,%al
call   1040 <enormlz@plt>
mov    %eax,-0x3c(%rbp)
cmp    $0x50,%eax
jle    11af <ultoe+0x7f>
lea    -0x30(%rbp),%rdi
mov    $0x0,%al
call   1050 <ecleaz@plt>
jmp    11bf <ultoe+0x8f>
mov    -0x3c(%rbp),%eax
movzwl %ax,%ecx
movzwl -0x2e(%rbp),%eax
sub    %ecx,%eax
mov    %ax,-0x2e(%rbp)
lea    -0x30(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1030 <emovo@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ultoe>:
push   %r15
push   %r14
push   %rbx
sub    $0x20,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
mov    %rsp,%r15
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <ecleaz@plt>
mov    (%rbx),%rax
mov    %rax,%rcx
shr    $0x30,%rcx
mov    %cx,0x4(%rsp)
mov    %rax,%rcx
shr    $0x20,%rcx
mov    %cx,0x6(%rsp)
mov    %rax,%rcx
shr    $0x10,%rcx
mov    %cx,0x8(%rsp)
mov    %ax,0xa(%rsp)
movw   $0x402e,0x2(%rsp)
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <enormlz@plt>
cmp    $0x51,%eax
jl     119a <ultoe+0x6a>
mov    %rsp,%rdi
xor    %eax,%eax
call   1050 <ecleaz@plt>
jmp    119f <ultoe+0x6f>
sub    %ax,0x2(%rsp)
mov    %rsp,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <emovo@plt>
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @ultoe(i64* %0, i16* %1) {
%3 = alloca i64*
%4 = alloca i16*
%5 = alloca [9 x i16]
%6 = alloca i64
%7 = alloca i32
store i64* %0, i64** %3
store i16* %1, i16** %4
%8 = getelementptr inbounds [9 x i16], [9 x i16]* %5, i64 0, i64 0
%9 = call i32 (i16*, ...) bitcast (i32 (...)* @ecleaz to i32 (i16*, ...)*)(i16* %8)
%10 = load i64*, i64** %3
%11 = load i64, i64* %10
store i64 %11, i64* %6
%12 = load i64, i64* %6
%13 = lshr i64 %12, 48
%14 = trunc i64 %13 to i16
%15 = getelementptr inbounds [9 x i16], [9 x i16]* %5, i64 0, i64 2
store i16 %14, i16* %15
%16 = load i64, i64* %6
%17 = lshr i64 %16, 32
%18 = trunc i64 %17 to i16
%19 = getelementptr inbounds [9 x i16], [9 x i16]* %5, i64 0, i64 3
store i16 %18, i16* %19
%20 = load i64, i64* %6
%21 = lshr i64 %20, 16
%22 = trunc i64 %21 to i16
%23 = getelementptr inbounds [9 x i16], [9 x i16]* %5, i64 0, i64 4
store i16 %22, i16* %23
%24 = load i64, i64* %6
%25 = trunc i64 %24 to i16
%26 = getelementptr inbounds [9 x i16], [9 x i16]* %5, i64 0, i64 5
store i16 %25, i16* %26
%27 = getelementptr inbounds [9 x i16], [9 x i16]* %5, i64 0, i64 1
store i16 16430, i16* %27
%28 = getelementptr inbounds [9 x i16], [9 x i16]* %5, i64 0, i64 0
%29 = call i32 (i16*, ...) bitcast (i32 (...)* @enormlz to i32 (i16*, ...)*)(i16* %28)
store i32 %29, i32* %7
%30 = icmp sgt i32 %29, 80
br i1 %30, label %31, label %34
31: ; preds = %2
%32 = getelementptr inbounds [9 x i16], [9 x i16]* %5, i64 0, i64 0
%33 = call i32 (i16*, ...) bitcast (i32 (...)* @ecleaz to i32 (i16*, ...)*)(i16* %32)
br label %43
34: ; preds = %2
%35 = load i32, i32* %7
%36 = trunc i32 %35 to i16
%37 = zext i16 %36 to i32
%38 = getelementptr inbounds [9 x i16], [9 x i16]* %5, i64 0, i64 1
%39 = load i16, i16* %38
%40 = zext i16 %39 to i32
%41 = sub nsw i32 %40, %37
%42 = trunc i32 %41 to i16
store i16 %42, i16* %38
br label %43
43: ; preds = %34, %31
%44 = getelementptr inbounds [9 x i16], [9 x i16]* %5, i64 0, i64 0
%45 = load i16*, i16** %4
%46 = call i32 (i16*, i16*, ...) bitcast (i32 (...)* @emovo to i32 (i16*, i16*, ...)*)(i16* %44, i16* %45)
ret void
}

LLVM IR (-O2):
define void @ultoe(i64* nocapture %0, i16* %1) {
%3 = alloca [9 x i16]
%4 = bitcast [9 x i16]* %3 to i8*
%5 = getelementptr inbounds [9 x i16], [9 x i16]* %3, i64 0, i64 0
%6 = call i32 (i16*, ...) bitcast (i32 (...)* @ecleaz to i32 (i16*, ...)*)(i16* %5)
%7 = load i64, i64* %0
%8 = lshr i64 %7, 48
%9 = trunc i64 %8 to i16
%10 = getelementptr inbounds [9 x i16], [9 x i16]* %3, i64 0, i64 2
store i16 %9, i16* %10
%11 = lshr i64 %7, 32
%12 = trunc i64 %11 to i16
%13 = getelementptr inbounds [9 x i16], [9 x i16]* %3, i64 0, i64 3
store i16 %12, i16* %13
%14 = lshr i64 %7, 16
%15 = trunc i64 %14 to i16
%16 = getelementptr inbounds [9 x i16], [9 x i16]* %3, i64 0, i64 4
store i16 %15, i16* %16
%17 = trunc i64 %7 to i16
%18 = getelementptr inbounds [9 x i16], [9 x i16]* %3, i64 0, i64 5
store i16 %17, i16* %18
%19 = getelementptr inbounds [9 x i16], [9 x i16]* %3, i64 0, i64 1
store i16 16430, i16* %19
%20 = call i32 (i16*, ...) bitcast (i32 (...)* @enormlz to i32 (i16*, ...)*)(i16* %5)
%21 = icmp sgt i32 %20, 80
br i1 %21, label %22, label %24
22: ; preds = %2
%23 = call i32 (i16*, ...) bitcast (i32 (...)* @ecleaz to i32 (i16*, ...)*)(i16* %5)
br label %28
24: ; preds = %2
%25 = load i16, i16* %19
%26 = trunc i32 %20 to i16
%27 = sub i16 %25, %26
store i16 %27, i16* %19
br label %28
28: ; preds = %24, %22
%29 = call i32 (i16*, i16*, ...) bitcast (i32 (...)* @emovo to i32 (i16*, i16*, ...)*)(i16* %5, i16* %1)
ret void
}