#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 */
typedef int uint32_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fwrite(char *, int, int, int /*<<< orphan*/ *);
void lz68k_out_number(uint32_t number, FILE *dst) {
  if (number < 128) {
    char n = (char)number;
    fwrite(&n, 1, 1, dst);
    return;
  }
  char dn[2];
  dn[0] = (char)(number >> 8 | 0x80);
  dn[1] = (char)(number & 0xFF);
  fwrite(dn, 1, 2, dst);
}


x86 assembly (clang, -O0):
<lz68k_out_number>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x80,-0x4(%rbp)
jge    114b <lz68k_out_number+0x3b>
mov    -0x4(%rbp),%eax
mov    %al,-0x11(%rbp)
mov    -0x10(%rbp),%rcx
lea    -0x11(%rbp),%rdi
mov    $0x1,%edx
mov    %edx,%esi
call   1030 <fwrite@plt>
jmp    117b <lz68k_out_number+0x6b>
mov    -0x4(%rbp),%eax
sar    $0x8,%eax
or     $0x80,%eax
mov    %al,-0x13(%rbp)
mov    -0x4(%rbp),%eax
and    $0xff,%eax
mov    %al,-0x12(%rbp)
lea    -0x13(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    $0x1,%esi
mov    $0x2,%edx
call   1030 <fwrite@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lz68k_out_number>:
mov    %rsi,%rcx
cmp    $0x7f,%edi
jg     1134 <lz68k_out_number+0x14>
movsbl %dil,%edi
mov    %rcx,%rsi
jmp    1030 <fputc@plt>
push   %rax
mov    %edi,%eax
shr    $0x8,%eax
or     $0x80,%al
mov    %al,0x6(%rsp)
mov    %dil,0x7(%rsp)
lea    0x6(%rsp),%rdi
mov    $0x1,%esi
mov    $0x2,%edx
call   1040 <fwrite@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @lz68k_out_number(i32 %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i8
%6 = alloca [2 x i8]
store i32 %0, i32* %3
store i32* %1, i32** %4
%7 = load i32, i32* %3
%8 = icmp slt i32 %7, 128
br i1 %8, label %9, label %14
9: ; preds = %2
%10 = load i32, i32* %3
%11 = trunc i32 %10 to i8
store i8 %11, i8* %5
%12 = load i32*, i32** %4
%13 = call i32 @fwrite(i8* %5, i32 1, i32 1, i32* %12)
br label %27
14: ; preds = %2
%15 = load i32, i32* %3
%16 = ashr i32 %15, 8
%17 = or i32 %16, 128
%18 = trunc i32 %17 to i8
%19 = getelementptr inbounds [2 x i8], [2 x i8]* %6, i64 0, i64 0
store i8 %18, i8* %19
%20 = load i32, i32* %3
%21 = and i32 %20, 255
%22 = trunc i32 %21 to i8
%23 = getelementptr inbounds [2 x i8], [2 x i8]* %6, i64 0, i64 1
store i8 %22, i8* %23
%24 = getelementptr inbounds [2 x i8], [2 x i8]* %6, i64 0, i64 0
%25 = load i32*, i32** %4
%26 = call i32 @fwrite(i8* %24, i32 1, i32 2, i32* %25)
br label %27
27: ; preds = %14, %9
ret void
}

LLVM IR (-O2):
define void @lz68k_out_number(i32 %0, i32* nocapture %1) {
%3 = alloca [2 x i8]
%4 = icmp slt i32 %0, 128
br i1 %4, label %5, label %9
5: ; preds = %2
%6 = shl i32 %0, 24
%7 = ashr exact i32 %6, 24
%8 = tail call i32 @fputc(i32 %7, i32* %1)
br label %17
9: ; preds = %2
%10 = getelementptr inbounds [2 x i8], [2 x i8]* %3, i64 0, i64 0
%11 = lshr i32 %0, 8
%12 = trunc i32 %11 to i8
%13 = or i8 %12, -128
store i8 %13, i8* %10
%14 = trunc i32 %0 to i8
%15 = getelementptr inbounds [2 x i8], [2 x i8]* %3, i64 0, i64 1
store i8 %14, i8* %15
%16 = call i32 @fwrite(i8* %10, i32 1, i32 2, i32* %1)
br label %17
17: ; preds = %9, %5
ret void
}