#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*/ md5_write_hexnumber(char *, unsigned int);
void md5_write_string(char *outstr, unsigned x) {
  unsigned a, b, c, d;
  a = x & 0xff;
  b = (x >> 8) & 0xff;
  c = (x >> 16) & 0xff;
  d = x >> 24;
  md5_write_hexnumber(outstr, a);
  md5_write_hexnumber(outstr + 2, b);
  md5_write_hexnumber(outstr + 4, c);
  md5_write_hexnumber(outstr + 6, d);
}


x86 assembly (clang, -O0):
<md5_write_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
and    $0xff,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
shr    $0x8,%eax
and    $0xff,%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
shr    $0x10,%eax
and    $0xff,%eax
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
shr    $0x18,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%esi
call   1030 <md5_write_hexnumber@plt>
mov    -0x8(%rbp),%rdi
add    $0x2,%rdi
mov    -0x14(%rbp),%esi
call   1030 <md5_write_hexnumber@plt>
mov    -0x8(%rbp),%rdi
add    $0x4,%rdi
mov    -0x18(%rbp),%esi
call   1030 <md5_write_hexnumber@plt>
mov    -0x8(%rbp),%rdi
add    $0x6,%rdi
mov    -0x1c(%rbp),%esi
call   1030 <md5_write_hexnumber@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<md5_write_string>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %esi,%ecx
mov    %rdi,%rbx
movzbl %cl,%esi
movzbl %ch,%ebp
mov    %ecx,%eax
shr    $0x10,%eax
movzbl %al,%r14d
shr    $0x18,%ecx
mov    %ecx,%r15d
call   1030 <md5_write_hexnumber@plt>
lea    0x2(%rbx),%rdi
mov    %ebp,%esi
call   1030 <md5_write_hexnumber@plt>
lea    0x4(%rbx),%rdi
mov    %r14d,%esi
call   1030 <md5_write_hexnumber@plt>
add    $0x6,%rbx
mov    %rbx,%rdi
mov    %r15d,%esi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <md5_write_hexnumber@plt>

LLVM IR (-O0):
define void @md5_write_string(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%9 = load i32, i32* %4
%10 = and i32 %9, 255
store i32 %10, i32* %5
%11 = load i32, i32* %4
%12 = lshr i32 %11, 8
%13 = and i32 %12, 255
store i32 %13, i32* %6
%14 = load i32, i32* %4
%15 = lshr i32 %14, 16
%16 = and i32 %15, 255
store i32 %16, i32* %7
%17 = load i32, i32* %4
%18 = lshr i32 %17, 24
store i32 %18, i32* %8
%19 = load i8*, i8** %3
%20 = load i32, i32* %5
%21 = call i32 @md5_write_hexnumber(i8* %19, i32 %20)
%22 = load i8*, i8** %3
%23 = getelementptr inbounds i8, i8* %22, i64 2
%24 = load i32, i32* %6
%25 = call i32 @md5_write_hexnumber(i8* %23, i32 %24)
%26 = load i8*, i8** %3
%27 = getelementptr inbounds i8, i8* %26, i64 4
%28 = load i32, i32* %7
%29 = call i32 @md5_write_hexnumber(i8* %27, i32 %28)
%30 = load i8*, i8** %3
%31 = getelementptr inbounds i8, i8* %30, i64 6
%32 = load i32, i32* %8
%33 = call i32 @md5_write_hexnumber(i8* %31, i32 %32)
ret void
}

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