#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 */
typedef scalar_t__ uint8_t;
typedef int uint32_t;
typedef int /*<<< orphan*/ buf;
typedef scalar_t__ a;

/* Variables and functions */
int /*<<< orphan*/ evutil_snprintf(char *, int, char *, int, int, int, int);
int ntohl(int);
const char *evdns_debug_ntoa(uint32_t address) {
  static char buf[32];
  uint32_t a = ntohl(address);
  evutil_snprintf(buf, sizeof(buf), "%d.%d.%d.%d",
                  (int)(uint8_t)((a >> 24) & 0xff),
                  (int)(uint8_t)((a >> 16) & 0xff),
                  (int)(uint8_t)((a >> 8) & 0xff), (int)(uint8_t)((a)&0xff));
  return buf;
}


x86 assembly (clang, -O0):
<evdns_debug_ntoa>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <ntohl@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
sar    $0x18,%eax
and    $0xff,%eax
cltq
mov    %eax,%ecx
mov    -0x8(%rbp),%eax
sar    $0x10,%eax
and    $0xff,%eax
cltq
mov    %eax,%r8d
mov    -0x8(%rbp),%eax
sar    $0x8,%eax
and    $0xff,%eax
cltq
mov    %eax,%r9d
mov    -0x8(%rbp),%eax
and    $0xff,%eax
cltq
lea    0x2eca(%rip),%rdi
mov    $0x20,%esi
lea    0xe7e(%rip),%rdx
mov    %eax,(%rsp)
call   1030 <evutil_snprintf@plt>
lea    0x2eaf(%rip),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<evdns_debug_ntoa>:
push   %rbp
push   %rbx
push   %rax
call   1040 <ntohl@plt>
mov    %eax,%edx
movzbl %ah,%ebp
movzbl %al,%esi
mov    %eax,%ecx
shr    $0x18,%ecx
shr    $0x10,%edx
movzbl %dl,%r8d
mov    %esi,(%rsp)
lea    0x2efa(%rip),%rbx
lea    0xeb3(%rip),%rdx
mov    %rbx,%rdi
mov    $0x20,%esi
mov    %ebp,%r9d
call   1030 <evutil_snprintf@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@evdns_debug_ntoa.buf = internal global [32 x i8] zeroinitializer
@.str = [12 x i8] c"%d.%d.%d.%d\00"
define i8* @evdns_debug_ntoa(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i32 @ntohl(i32 %4)
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = ashr i32 %6, 24
%8 = and i32 %7, 255
%9 = sext i32 %8 to i64
%10 = trunc i64 %9 to i32
%11 = load i32, i32* %3
%12 = ashr i32 %11, 16
%13 = and i32 %12, 255
%14 = sext i32 %13 to i64
%15 = trunc i64 %14 to i32
%16 = load i32, i32* %3
%17 = ashr i32 %16, 8
%18 = and i32 %17, 255
%19 = sext i32 %18 to i64
%20 = trunc i64 %19 to i32
%21 = load i32, i32* %3
%22 = and i32 %21, 255
%23 = sext i32 %22 to i64
%24 = trunc i64 %23 to i32
%25 = call i32 @evutil_snprintf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @evdns_debug_ntoa.buf, i64 0, i64 0), i32 32, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %10, i32 %15, i32 %20, i32 %24)
ret i8* getelementptr inbounds ([32 x i8], [32 x i8]* @evdns_debug_ntoa.buf, i64 0, i64 0)
}

LLVM IR (-O2):
@evdns_debug_ntoa.buf = internal global [32 x i8] zeroinitializer
@.str = [12 x i8] c"%d.%d.%d.%d\00"
define i8* @evdns_debug_ntoa(i32 %0) {
%2 = tail call i32 @ntohl(i32 %0)
%3 = lshr i32 %2, 24
%4 = lshr i32 %2, 16
%5 = and i32 %4, 255
%6 = lshr i32 %2, 8
%7 = and i32 %6, 255
%8 = and i32 %2, 255
%9 = tail call i32 @evutil_snprintf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @evdns_debug_ntoa.buf, i64 0, i64 0), i32 32, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %3, i32 %5, i32 %7, i32 %8)
ret i8* getelementptr inbounds ([32 x i8], [32 x i8]* @evdns_debug_ntoa.buf, i64 0, i64 0)
}