#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*/ printf(char *, ...);
void print_quad(unsigned int x) {
  unsigned char b1, b2, b3, b4;
  b4 = (x & 0xFF000000) >> 24;
  b3 = (x & 0x00FF0000) >> 16;
  b2 = (x & 0x0000FF00) >> 8;
  b1 = (x & 0x000000FF);
  printf("%02x %02x %02x %02x", b1, b2, b3, b4);
  printf("   (%03d.%03d.%03d.%03d)", b1, b2, b3, b4);
  printf("\n");
}


x86 assembly (clang, -O0):
<print_quad>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xff000000,%eax
shr    $0x18,%eax
mov    %al,-0x8(%rbp)
mov    -0x4(%rbp),%eax
and    $0xff0000,%eax
shr    $0x10,%eax
mov    %al,-0x7(%rbp)
mov    -0x4(%rbp),%eax
and    $0xff00,%eax
shr    $0x8,%eax
mov    %al,-0x6(%rbp)
mov    -0x4(%rbp),%eax
and    $0xff,%eax
mov    %al,-0x5(%rbp)
movzbl -0x5(%rbp),%esi
movzbl -0x6(%rbp),%edx
movzbl -0x7(%rbp),%ecx
movzbl -0x8(%rbp),%r8d
lea    0xe98(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movzbl -0x5(%rbp),%esi
movzbl -0x6(%rbp),%edx
movzbl -0x7(%rbp),%ecx
movzbl -0x8(%rbp),%r8d
lea    0xe8d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe98(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_quad>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
mov    %edi,%eax
movzbl %bl,%r14d
movzbl %bh,%edx
shr    $0x18,%ebx
shr    $0x10,%eax
movzbl %al,%ebp
lea    0xebe(%rip),%rdi
mov    %r14d,%esi
mov    %edx,%r15d
mov    %ebp,%ecx
mov    %ebx,%r8d
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeb9(%rip),%rdi
mov    %r14d,%esi
mov    %r15d,%edx
mov    %ebp,%ecx
mov    %ebx,%r8d
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [20 x i8] c"%02x %02x %02x %02x\00"
@.str.1 = [25 x i8] c" (%03d.%03d.%03d.%03d)\00"
@.str.2 = [2 x i8] c"\0A\00"
define void @print_quad(i32 %0) {
%2 = alloca i32
%3 = alloca i8
%4 = alloca i8
%5 = alloca i8
%6 = alloca i8
store i32 %0, i32* %2
%7 = load i32, i32* %2
%8 = and i32 %7, -16777216
%9 = lshr i32 %8, 24
%10 = trunc i32 %9 to i8
store i8 %10, i8* %6
%11 = load i32, i32* %2
%12 = and i32 %11, 16711680
%13 = lshr i32 %12, 16
%14 = trunc i32 %13 to i8
store i8 %14, i8* %5
%15 = load i32, i32* %2
%16 = and i32 %15, 65280
%17 = lshr i32 %16, 8
%18 = trunc i32 %17 to i8
store i8 %18, i8* %4
%19 = load i32, i32* %2
%20 = and i32 %19, 255
%21 = trunc i32 %20 to i8
store i8 %21, i8* %3
%22 = load i8, i8* %3
%23 = zext i8 %22 to i32
%24 = load i8, i8* %4
%25 = zext i8 %24 to i32
%26 = load i8, i8* %5
%27 = zext i8 %26 to i32
%28 = load i8, i8* %6
%29 = zext i8 %28 to i32
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %23, i32 %25, i32 %27, i32 %29)
%31 = load i8, i8* %3
%32 = zext i8 %31 to i32
%33 = load i8, i8* %4
%34 = zext i8 %33 to i32
%35 = load i8, i8* %5
%36 = zext i8 %35 to i32
%37 = load i8, i8* %6
%38 = zext i8 %37 to i32
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i32 %32, i32 %34, i32 %36, i32 %38)
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [20 x i8] c"%02x %02x %02x %02x\00"
@.str.1 = [25 x i8] c" (%03d.%03d.%03d.%03d)\00"
define void @print_quad(i32 %0) {
%2 = lshr i32 %0, 24
%3 = lshr i32 %0, 16
%4 = lshr i32 %0, 8
%5 = and i32 %0, 255
%6 = and i32 %4, 255
%7 = and i32 %3, 255
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %5, i32 %6, i32 %7, i32 %2)
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i32 %5, i32 %6, i32 %7, i32 %2)
%10 = tail call i32 @putchar(i32 10)
ret void
}