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

/* Variables and functions */
int /*<<< orphan*/ putc(unsigned long long, int /*<<< orphan*/ *);
void write8LE(FILE *fp, unsigned long long val) {
  putc(val & 0xff, fp);
  putc((val >> 8) & 0xff, fp);
  putc((val >> 16) & 0xff, fp);
  putc((val >> 24) & 0xff, fp);
  putc((val >> 32) & 0xff, fp);
  putc((val >> 40) & 0xff, fp);
  putc((val >> 48) & 0xff, fp);
  putc((val >> 56) & 0xff, fp);
}


x86 assembly (clang, -O0):
<write8LE>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
and    $0xff,%rdi
mov    -0x8(%rbp),%rsi
call   1030 <putc@plt>
mov    -0x10(%rbp),%rdi
shr    $0x8,%rdi
and    $0xff,%rdi
mov    -0x8(%rbp),%rsi
call   1030 <putc@plt>
mov    -0x10(%rbp),%rdi
shr    $0x10,%rdi
and    $0xff,%rdi
mov    -0x8(%rbp),%rsi
call   1030 <putc@plt>
mov    -0x10(%rbp),%rdi
shr    $0x18,%rdi
and    $0xff,%rdi
mov    -0x8(%rbp),%rsi
call   1030 <putc@plt>
mov    -0x10(%rbp),%rdi
shr    $0x20,%rdi
and    $0xff,%rdi
mov    -0x8(%rbp),%rsi
call   1030 <putc@plt>
mov    -0x10(%rbp),%rdi
shr    $0x28,%rdi
and    $0xff,%rdi
mov    -0x8(%rbp),%rsi
call   1030 <putc@plt>
mov    -0x10(%rbp),%rdi
shr    $0x30,%rdi
and    $0xff,%rdi
mov    -0x8(%rbp),%rsi
call   1030 <putc@plt>
mov    -0x10(%rbp),%rdi
shr    $0x38,%rdi
and    $0xff,%rdi
mov    -0x8(%rbp),%rsi
call   1030 <putc@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write8LE>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
movzbl %bl,%edi
mov    %r14,%rsi
call   1030 <putc@plt>
movzbl %bh,%edi
mov    %r14,%rsi
call   1030 <putc@plt>
mov    %ebx,%eax
shr    $0x10,%eax
movzbl %al,%edi
mov    %r14,%rsi
call   1030 <putc@plt>
mov    %ebx,%edi
shr    $0x18,%edi
mov    %r14,%rsi
call   1030 <putc@plt>
mov    %rbx,%rax
shr    $0x20,%rax
movzbl %al,%edi
mov    %r14,%rsi
call   1030 <putc@plt>
mov    %rbx,%rax
shr    $0x28,%rax
movzbl %al,%edi
mov    %r14,%rsi
call   1030 <putc@plt>
mov    %rbx,%rax
shr    $0x30,%rax
movzbl %al,%edi
mov    %r14,%rsi
call   1030 <putc@plt>
shr    $0x38,%rbx
mov    %rbx,%rdi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <putc@plt>

LLVM IR (-O0):
define void @write8LE(i32* %0, i64 %1) {
%3 = alloca i32*
%4 = alloca i64
store i32* %0, i32** %3
store i64 %1, i64* %4
%5 = load i64, i64* %4
%6 = and i64 %5, 255
%7 = load i32*, i32** %3
%8 = call i32 @putc(i64 %6, i32* %7)
%9 = load i64, i64* %4
%10 = lshr i64 %9, 8
%11 = and i64 %10, 255
%12 = load i32*, i32** %3
%13 = call i32 @putc(i64 %11, i32* %12)
%14 = load i64, i64* %4
%15 = lshr i64 %14, 16
%16 = and i64 %15, 255
%17 = load i32*, i32** %3
%18 = call i32 @putc(i64 %16, i32* %17)
%19 = load i64, i64* %4
%20 = lshr i64 %19, 24
%21 = and i64 %20, 255
%22 = load i32*, i32** %3
%23 = call i32 @putc(i64 %21, i32* %22)
%24 = load i64, i64* %4
%25 = lshr i64 %24, 32
%26 = and i64 %25, 255
%27 = load i32*, i32** %3
%28 = call i32 @putc(i64 %26, i32* %27)
%29 = load i64, i64* %4
%30 = lshr i64 %29, 40
%31 = and i64 %30, 255
%32 = load i32*, i32** %3
%33 = call i32 @putc(i64 %31, i32* %32)
%34 = load i64, i64* %4
%35 = lshr i64 %34, 48
%36 = and i64 %35, 255
%37 = load i32*, i32** %3
%38 = call i32 @putc(i64 %36, i32* %37)
%39 = load i64, i64* %4
%40 = lshr i64 %39, 56
%41 = and i64 %40, 255
%42 = load i32*, i32** %3
%43 = call i32 @putc(i64 %41, i32* %42)
ret void
}

LLVM IR (-O2):
define void @write8LE(i32* nocapture %0, i64 %1) {
%3 = and i64 %1, 255
%4 = tail call i32 @putc(i64 %3, i32* %0)
%5 = lshr i64 %1, 8
%6 = and i64 %5, 255
%7 = tail call i32 @putc(i64 %6, i32* %0)
%8 = lshr i64 %1, 16
%9 = and i64 %8, 255
%10 = tail call i32 @putc(i64 %9, i32* %0)
%11 = lshr i64 %1, 24
%12 = and i64 %11, 255
%13 = tail call i32 @putc(i64 %12, i32* %0)
%14 = lshr i64 %1, 32
%15 = and i64 %14, 255
%16 = tail call i32 @putc(i64 %15, i32* %0)
%17 = lshr i64 %1, 40
%18 = and i64 %17, 255
%19 = tail call i32 @putc(i64 %18, i32* %0)
%20 = lshr i64 %1, 48
%21 = and i64 %20, 255
%22 = tail call i32 @putc(i64 %21, i32* %0)
%23 = lshr i64 %1, 56
%24 = tail call i32 @putc(i64 %23, i32* %0)
ret void
}