#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*/ binPrint(unsigned char *);
int /*<<< orphan*/ printf(char *, unsigned char, unsigned char, unsigned char,
                          unsigned char);
void print_num_to_ip_string(unsigned int num) {
  unsigned char ip[4];
  ip[0] = num & 0xff;
  ip[1] = num >> 8 & 0xff;
  ip[2] = num >> 16 & 0xff;
  ip[3] = num >> 24 & 0xff;
  printf("%d.%d.%d.%d ", ip[3], ip[2], ip[1], ip[0]);
  binPrint(ip);
}


x86 assembly (clang, -O0):
<print_num_to_ip_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xff,%eax
mov    %al,-0x8(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x8,%eax
and    $0xff,%eax
mov    %al,-0x7(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x10,%eax
and    $0xff,%eax
mov    %al,-0x6(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x18,%eax
and    $0xff,%eax
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%dl
mov    -0x6(%rbp),%cl
mov    -0x7(%rbp),%al
lea    0xe90(%rip),%rdi
movzbl %dl,%esi
movzbl %cl,%edx
movzbl %al,%ecx
movzbl -0x8(%rbp),%r8d
call   1030 <printf@plt>
lea    -0x8(%rbp),%rdi
call   1040 <binPrint@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_num_to_ip_string>:
push   %rax
mov    %edi,%edx
mov    %edi,%esi
shr    $0x10,%esi
mov    %edi,%eax
shr    $0x18,%eax
mov    %edi,0x4(%rsp)
movzbl %dh,%ecx
movzbl %dl,%r8d
movzbl %sil,%edx
lea    0xebd(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
lea    0x4(%rsp),%rdi
call   1040 <binPrint@plt>
pop    %rax
ret

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

LLVM IR (-O2):
@.str = [13 x i8] c"%d.%d.%d.%d \00"
define void @print_num_to_ip_string(i32 %0) {
%2 = alloca [4 x i8]
%3 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 0
%4 = trunc i32 %0 to i8
store i8 %4, i8* %3
%5 = lshr i32 %0, 8
%6 = trunc i32 %5 to i8
%7 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 1
store i8 %6, i8* %7
%8 = lshr i32 %0, 16
%9 = trunc i32 %8 to i8
%10 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 2
store i8 %9, i8* %10
%11 = lshr i32 %0, 24
%12 = trunc i32 %11 to i8
%13 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 3
store i8 %12, i8* %13
%14 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8 zeroext %12, i8 zeroext %9, i8 zeroext %6, i8 zeroext %4)
%15 = call i32 @binPrint(i8* %3)
ret void
}