#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*/ write(int, char **, int);
void fprint_quartet(int fd, unsigned int i) {
  char data[4];
  data[0] = (char)i % 0x100;
  i /= 0x100;
  data[1] = (char)i % 0x100;
  i /= 0x100;
  data[2] = (char)i % 0x100;
  i /= 0x100;
  data[3] = (char)i % 0x100;
  write(fd, &data, 4);
}


x86 assembly (clang, -O0):
<fprint_quartet>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
movsbl %al,%eax
mov    $0x100,%ecx
cltd
idiv   %ecx
mov    %dl,%al
mov    %al,-0xc(%rbp)
mov    -0x8(%rbp),%eax
shr    $0x8,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
movsbl %al,%eax
mov    $0x100,%ecx
cltd
idiv   %ecx
mov    %dl,%al
mov    %al,-0xb(%rbp)
mov    -0x8(%rbp),%eax
shr    $0x8,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
movsbl %al,%eax
mov    $0x100,%ecx
cltd
idiv   %ecx
mov    %dl,%al
mov    %al,-0xa(%rbp)
mov    -0x8(%rbp),%eax
shr    $0x8,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
movsbl %al,%eax
mov    $0x100,%ecx
cltd
idiv   %ecx
mov    %dl,%al
mov    %al,-0x9(%rbp)
mov    -0x4(%rbp),%edi
lea    -0xc(%rbp),%rsi
mov    $0x4,%edx
call   1030 <write@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fprint_quartet>:
push   %rax
mov    %esi,0x4(%rsp)
lea    0x4(%rsp),%rsi
mov    $0x4,%edx
call   1030 <write@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @fprint_quartet(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca [4 x i8]
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = trunc i32 %6 to i8
%8 = sext i8 %7 to i32
%9 = srem i32 %8, 256
%10 = trunc i32 %9 to i8
%11 = getelementptr inbounds [4 x i8], [4 x i8]* %5, i64 0, i64 0
store i8 %10, i8* %11
%12 = load i32, i32* %4
%13 = udiv i32 %12, 256
store i32 %13, i32* %4
%14 = load i32, i32* %4
%15 = trunc i32 %14 to i8
%16 = sext i8 %15 to i32
%17 = srem i32 %16, 256
%18 = trunc i32 %17 to i8
%19 = getelementptr inbounds [4 x i8], [4 x i8]* %5, i64 0, i64 1
store i8 %18, i8* %19
%20 = load i32, i32* %4
%21 = udiv i32 %20, 256
store i32 %21, i32* %4
%22 = load i32, i32* %4
%23 = trunc i32 %22 to i8
%24 = sext i8 %23 to i32
%25 = srem i32 %24, 256
%26 = trunc i32 %25 to i8
%27 = getelementptr inbounds [4 x i8], [4 x i8]* %5, i64 0, i64 2
store i8 %26, i8* %27
%28 = load i32, i32* %4
%29 = udiv i32 %28, 256
store i32 %29, i32* %4
%30 = load i32, i32* %4
%31 = trunc i32 %30 to i8
%32 = sext i8 %31 to i32
%33 = srem i32 %32, 256
%34 = trunc i32 %33 to i8
%35 = getelementptr inbounds [4 x i8], [4 x i8]* %5, i64 0, i64 3
store i8 %34, i8* %35
%36 = load i32, i32* %3
%37 = bitcast [4 x i8]* %5 to i8**
%38 = call i32 @write(i32 %36, i8** %37, i32 4)
ret void
}

LLVM IR (-O2):
define void @fprint_quartet(i32 %0, i32 %1) {
%3 = alloca [4 x i8]
%4 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 0
%5 = trunc i32 %1 to i8
store i8 %5, i8* %4
%6 = lshr i32 %1, 8
%7 = trunc i32 %6 to i8
%8 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 1
store i8 %7, i8* %8
%9 = lshr i32 %1, 16
%10 = trunc i32 %9 to i8
%11 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 2
store i8 %10, i8* %11
%12 = lshr i32 %1, 24
%13 = trunc i32 %12 to i8
%14 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 3
store i8 %13, i8* %14
%15 = bitcast [4 x i8]* %3 to i8**
%16 = call i32 @write(i32 %0, i8** %15, i32 4)
ret void
}