#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*/ assert(int);
int /*<<< orphan*/ printf(char *, char *, unsigned char, unsigned char,
                          unsigned char, unsigned char);
void check_int(char *prefix, int v, int b3, int b2, int b1, int b0) {
  printf("%s: 0x%.2x%.2x%.2x%.2x\n", prefix, (((unsigned char *)&v)[0]),
         (((unsigned char *)&v)[1]), (((unsigned char *)&v)[2]),
         (((unsigned char *)&v)[3]));
  assert((v & 0xff000000) >> 24 == b3);
  assert((v & 0x00ff0000) >> 16 == b2);
  assert((v & 0x0000ff00) >> 8 == b1);
  assert((v & 0x000000ff) == b0);
}


x86 assembly (clang, -O0):
<check_int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8d,-0x18(%rbp)
mov    %r9d,-0x1c(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%dl
mov    -0xb(%rbp),%cl
mov    -0xa(%rbp),%al
lea    0xeaf(%rip),%rdi
movzbl %dl,%edx
movzbl %cl,%ecx
movzbl %al,%r8d
movzbl -0x9(%rbp),%r9d
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
and    $0xff000000,%eax
shr    $0x18,%eax
cmp    -0x10(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0xc(%rbp),%eax
and    $0xff0000,%eax
sar    $0x10,%eax
cmp    -0x14(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0xc(%rbp),%eax
and    $0xff00,%eax
sar    $0x8,%eax
cmp    -0x18(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0xc(%rbp),%eax
and    $0xff,%eax
cmp    -0x1c(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_int>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9d,0x4(%rsp)
mov    %r8d,(%rsp)
mov    %ecx,%r12d
mov    %edx,%r13d
mov    %esi,%eax
mov    %rdi,%rsi
mov    %eax,%ecx
shr    $0x10,%ecx
mov    %eax,%ebx
shr    $0x18,%ebx
lea    0xeb0(%rip),%rdi
movzbl %cl,%r14d
movzbl %ah,%ebp
movzbl %al,%r15d
mov    %r15d,%edx
mov    %ebp,%ecx
mov    %r14d,%r8d
mov    %ebx,%r9d
call   1030 <printf@plt>
xor    %edi,%edi
cmp    %r13d,%ebx
sete   %dil
call   1040 <assert@plt>
xor    %edi,%edi
cmp    %r12d,%r14d
sete   %dil
call   1040 <assert@plt>
xor    %edi,%edi
cmp    (%rsp),%ebp
sete   %dil
call   1040 <assert@plt>
xor    %edi,%edi
cmp    0x4(%rsp),%r15d
sete   %dil
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <assert@plt>

LLVM IR (-O0):
@.str = [24 x i8] c"%s: 0x%.2x%.2x%.2x%.2x\0A\00"
define void @check_int(i8* %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5) {
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store i8* %0, i8** %7
store i32 %1, i32* %8
store i32 %2, i32* %9
store i32 %3, i32* %10
store i32 %4, i32* %11
store i32 %5, i32* %12
%13 = load i8*, i8** %7
%14 = bitcast i32* %8 to i8*
%15 = getelementptr inbounds i8, i8* %14, i64 0
%16 = load i8, i8* %15
%17 = bitcast i32* %8 to i8*
%18 = getelementptr inbounds i8, i8* %17, i64 1
%19 = load i8, i8* %18
%20 = bitcast i32* %8 to i8*
%21 = getelementptr inbounds i8, i8* %20, i64 2
%22 = load i8, i8* %21
%23 = bitcast i32* %8 to i8*
%24 = getelementptr inbounds i8, i8* %23, i64 3
%25 = load i8, i8* %24
%26 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %13, i8 zeroext %16, i8 zeroext %19, i8 zeroext %22, i8 zeroext %25)
%27 = load i32, i32* %8
%28 = and i32 %27, -16777216
%29 = lshr i32 %28, 24
%30 = load i32, i32* %9
%31 = icmp eq i32 %29, %30
%32 = zext i1 %31 to i32
%33 = call i32 @assert(i32 %32)
%34 = load i32, i32* %8
%35 = and i32 %34, 16711680
%36 = ashr i32 %35, 16
%37 = load i32, i32* %10
%38 = icmp eq i32 %36, %37
%39 = zext i1 %38 to i32
%40 = call i32 @assert(i32 %39)
%41 = load i32, i32* %8
%42 = and i32 %41, 65280
%43 = ashr i32 %42, 8
%44 = load i32, i32* %11
%45 = icmp eq i32 %43, %44
%46 = zext i1 %45 to i32
%47 = call i32 @assert(i32 %46)
%48 = load i32, i32* %8
%49 = and i32 %48, 255
%50 = load i32, i32* %12
%51 = icmp eq i32 %49, %50
%52 = zext i1 %51 to i32
%53 = call i32 @assert(i32 %52)
ret void
}

LLVM IR (-O2):
@.str = [24 x i8] c"%s: 0x%.2x%.2x%.2x%.2x\0A\00"
define void @check_int(i8* %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5) {
%7 = trunc i32 %1 to i8
%8 = lshr i32 %1, 8
%9 = trunc i32 %8 to i8
%10 = lshr i32 %1, 16
%11 = trunc i32 %10 to i8
%12 = lshr i32 %1, 24
%13 = trunc i32 %12 to i8
%14 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %0, i8 zeroext %7, i8 zeroext %9, i8 zeroext %11, i8 zeroext %13)
%15 = icmp eq i32 %12, %2
%16 = zext i1 %15 to i32
%17 = tail call i32 @assert(i32 %16)
%18 = and i32 %10, 255
%19 = icmp eq i32 %18, %3
%20 = zext i1 %19 to i32
%21 = tail call i32 @assert(i32 %20)
%22 = and i32 %8, 255
%23 = icmp eq i32 %22, %4
%24 = zext i1 %23 to i32
%25 = tail call i32 @assert(i32 %24)
%26 = and i32 %1, 255
%27 = icmp eq i32 %26, %5
%28 = zext i1 %27 to i32
%29 = tail call i32 @assert(i32 %28)
ret void
}