#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 */
struct io_file {
  int dummy;
};

/* Variables and functions */
int io_out(struct io_file *, int, unsigned char *, int);
int io_out_i4(struct io_file *f, int pos, int o) {
  unsigned char x[4];
  x[0] = o >> 24;
  x[1] = o >> 16;
  x[2] = o >> 8;
  x[3] = o;
  return io_out(f, pos, x, sizeof x);
}


x86 assembly (clang, -O0):
<io_out_i4>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x10(%rbp),%eax
sar    $0x18,%eax
mov    %al,-0x14(%rbp)
mov    -0x10(%rbp),%eax
sar    $0x10,%eax
mov    %al,-0x13(%rbp)
mov    -0x10(%rbp),%eax
sar    $0x8,%eax
mov    %al,-0x12(%rbp)
mov    -0x10(%rbp),%eax
mov    %al,-0x11(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
lea    -0x14(%rbp),%rdx
mov    $0x4,%ecx
call   1030 <io_out@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<io_out_i4>:
push   %rax
bswap  %edx
mov    %edx,0x4(%rsp)
lea    0x4(%rsp),%rdx
mov    $0x4,%ecx
call   1030 <io_out@plt>
pop    %rcx
ret

LLVM IR (-O0):
%struct.io_file = type { i32 }
define i32 @io_out_i4(%struct.io_file* %0, i32 %1, i32 %2) {
%4 = alloca %struct.io_file*
%5 = alloca i32
%6 = alloca i32
%7 = alloca [4 x i8]
store %struct.io_file* %0, %struct.io_file** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i32, i32* %6
%9 = ashr i32 %8, 24
%10 = trunc i32 %9 to i8
%11 = getelementptr inbounds [4 x i8], [4 x i8]* %7, i64 0, i64 0
store i8 %10, i8* %11
%12 = load i32, i32* %6
%13 = ashr i32 %12, 16
%14 = trunc i32 %13 to i8
%15 = getelementptr inbounds [4 x i8], [4 x i8]* %7, i64 0, i64 1
store i8 %14, i8* %15
%16 = load i32, i32* %6
%17 = ashr i32 %16, 8
%18 = trunc i32 %17 to i8
%19 = getelementptr inbounds [4 x i8], [4 x i8]* %7, i64 0, i64 2
store i8 %18, i8* %19
%20 = load i32, i32* %6
%21 = trunc i32 %20 to i8
%22 = getelementptr inbounds [4 x i8], [4 x i8]* %7, i64 0, i64 3
store i8 %21, i8* %22
%23 = load %struct.io_file*, %struct.io_file** %4
%24 = load i32, i32* %5
%25 = getelementptr inbounds [4 x i8], [4 x i8]* %7, i64 0, i64 0
%26 = call i32 @io_out(%struct.io_file* %23, i32 %24, i8* %25, i32 4)
ret i32 %26
}

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