#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*/ gcspy_arrayOutputBaseWrite(char *, int);
void gcspy_arrayOutputWriteInt(char *buffer, int v) {
  gcspy_arrayOutputBaseWrite(buffer, (int)(v >> 24));
  gcspy_arrayOutputBaseWrite(buffer + 1, (int)((v >> 16) & ((1 << 8) - 1)));
  gcspy_arrayOutputBaseWrite(buffer + 2, (int)((v >> 8) & ((1 << 8) - 1)));
  gcspy_arrayOutputBaseWrite(buffer + 3, (int)(v & ((1 << 8) - 1)));
}


x86 assembly (clang, -O0):
<gcspy_arrayOutputWriteInt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
sar    $0x18,%esi
call   1030 <gcspy_arrayOutputBaseWrite@plt>
mov    -0x8(%rbp),%rdi
add    $0x1,%rdi
mov    -0xc(%rbp),%esi
sar    $0x10,%esi
and    $0xff,%esi
call   1030 <gcspy_arrayOutputBaseWrite@plt>
mov    -0x8(%rbp),%rdi
add    $0x2,%rdi
mov    -0xc(%rbp),%esi
sar    $0x8,%esi
and    $0xff,%esi
call   1030 <gcspy_arrayOutputBaseWrite@plt>
mov    -0x8(%rbp),%rdi
add    $0x3,%rdi
mov    -0xc(%rbp),%esi
and    $0xff,%esi
call   1030 <gcspy_arrayOutputBaseWrite@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gcspy_arrayOutputWriteInt>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    %esi,%eax
mov    %esi,%ebp
sar    $0x18,%eax
mov    %eax,%esi
call   1030 <gcspy_arrayOutputBaseWrite@plt>
lea    0x1(%rbx),%rdi
mov    %ebp,%eax
shr    $0x10,%eax
movzbl %al,%esi
call   1030 <gcspy_arrayOutputBaseWrite@plt>
lea    0x2(%rbx),%rdi
mov    %ebp,%eax
movzbl %ah,%esi
call   1030 <gcspy_arrayOutputBaseWrite@plt>
add    $0x3,%rbx
movzbl %bpl,%esi
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <gcspy_arrayOutputBaseWrite@plt>

LLVM IR (-O0):
define void @gcspy_arrayOutputWriteInt(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i8*, i8** %3
%6 = load i32, i32* %4
%7 = ashr i32 %6, 24
%8 = call i32 @gcspy_arrayOutputBaseWrite(i8* %5, i32 %7)
%9 = load i8*, i8** %3
%10 = getelementptr inbounds i8, i8* %9, i64 1
%11 = load i32, i32* %4
%12 = ashr i32 %11, 16
%13 = and i32 %12, 255
%14 = call i32 @gcspy_arrayOutputBaseWrite(i8* %10, i32 %13)
%15 = load i8*, i8** %3
%16 = getelementptr inbounds i8, i8* %15, i64 2
%17 = load i32, i32* %4
%18 = ashr i32 %17, 8
%19 = and i32 %18, 255
%20 = call i32 @gcspy_arrayOutputBaseWrite(i8* %16, i32 %19)
%21 = load i8*, i8** %3
%22 = getelementptr inbounds i8, i8* %21, i64 3
%23 = load i32, i32* %4
%24 = and i32 %23, 255
%25 = call i32 @gcspy_arrayOutputBaseWrite(i8* %22, i32 %24)
ret void
}

LLVM IR (-O2):
define void @gcspy_arrayOutputWriteInt(i8* %0, i32 %1) {
%3 = ashr i32 %1, 24
%4 = tail call i32 @gcspy_arrayOutputBaseWrite(i8* %0, i32 %3)
%5 = getelementptr inbounds i8, i8* %0, i64 1
%6 = lshr i32 %1, 16
%7 = and i32 %6, 255
%8 = tail call i32 @gcspy_arrayOutputBaseWrite(i8* %5, i32 %7)
%9 = getelementptr inbounds i8, i8* %0, i64 2
%10 = lshr i32 %1, 8
%11 = and i32 %10, 255
%12 = tail call i32 @gcspy_arrayOutputBaseWrite(i8* %9, i32 %11)
%13 = getelementptr inbounds i8, i8* %0, i64 3
%14 = and i32 %1, 255
%15 = tail call i32 @gcspy_arrayOutputBaseWrite(i8* %13, i32 %14)
ret void
}