void putint(struct _IO_FILE$link42 *outf, unsigned int val) {
  unsigned char buf[4l];
  buf[(signed long int)0] = (unsigned char)(val >> 24);
  buf[(signed long int)1] = (unsigned char)(val >> 16);
  buf[(signed long int)2] = (unsigned char)(val >> 8);
  buf[(signed long int)3] = (unsigned char)(val & (unsigned int)255);
  fwrite((const void *)buf, (unsigned long int)4, (unsigned long int)1, outf);
}


x86 assembly (clang, -O0):
<putint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
shr    $0x18,%eax
mov    %al,-0x10(%rbp)
mov    -0xc(%rbp),%eax
shr    $0x10,%eax
mov    %al,-0xf(%rbp)
mov    -0xc(%rbp),%eax
shr    $0x8,%eax
mov    %al,-0xe(%rbp)
mov    -0xc(%rbp),%eax
and    $0xff,%eax
mov    %al,-0xd(%rbp)
lea    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rcx
mov    $0x4,%esi
mov    $0x1,%edx
mov    $0x0,%al
call   1030 <fwrite@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<putint>:
push   %rax
mov    %rdi,%rcx
bswap  %esi
mov    %esi,0x4(%rsp)
lea    0x4(%rsp),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
xor    %eax,%eax
call   1030 <fwrite@plt>
pop    %rax
ret

LLVM IR (-O0):
%"struct._IO_FILE$link42" = type opaque
define void @putint(%"struct._IO_FILE$link42"* %0, i32 %1) {
%3 = alloca %"struct._IO_FILE$link42"*
%4 = alloca i32
%5 = alloca [4 x i8]
store %"struct._IO_FILE$link42"* %0, %"struct._IO_FILE$link42"** %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = lshr i32 %6, 24
%8 = trunc i32 %7 to i8
%9 = getelementptr inbounds [4 x i8], [4 x i8]* %5, i64 0, i64 0
store i8 %8, i8* %9
%10 = load i32, i32* %4
%11 = lshr i32 %10, 16
%12 = trunc i32 %11 to i8
%13 = getelementptr inbounds [4 x i8], [4 x i8]* %5, i64 0, i64 1
store i8 %12, i8* %13
%14 = load i32, i32* %4
%15 = lshr i32 %14, 8
%16 = trunc i32 %15 to i8
%17 = getelementptr inbounds [4 x i8], [4 x i8]* %5, i64 0, i64 2
store i8 %16, i8* %17
%18 = load i32, i32* %4
%19 = and i32 %18, 255
%20 = trunc i32 %19 to i8
%21 = getelementptr inbounds [4 x i8], [4 x i8]* %5, i64 0, i64 3
store i8 %20, i8* %21
%22 = getelementptr inbounds [4 x i8], [4 x i8]* %5, i64 0, i64 0
%23 = load %"struct._IO_FILE$link42"*, %"struct._IO_FILE$link42"** %3
%24 = call i32 (i8*, i64, i64, %"struct._IO_FILE$link42"*, ...) bitcast (i32 (...)* @fwrite to i32 (i8*, i64, i64, %"struct._IO_FILE$link42"*, ...)*)(i8* %22, i64 4, i64 1, %"struct._IO_FILE$link42"* %23)
ret void
}

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