#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 */
struct in_addr {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, char, char, char, char);
char *in_ntop(struct in_addr *in, char *buff) {
  char *p = (char *)in;
  sprintf(buff, "%d.%d.%d.%d", (p[0] & 255), (p[1] & 255), (p[2] & 255),
          (p[3] & 255));
  return buff;
}


x86 assembly (clang, -O0):
<in_ntop>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
and    $0xff,%eax
mov    %al,%dl
mov    -0x18(%rbp),%rax
movsbl 0x1(%rax),%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x18(%rbp),%rax
movsbl 0x2(%rax),%eax
and    $0xff,%eax
mov    %al,%r8b
mov    -0x18(%rbp),%rax
movsbl 0x3(%rax),%eax
and    $0xff,%eax
lea    0xe93(%rip),%rsi
movsbl %dl,%edx
movsbl %cl,%ecx
movsbl %r8b,%r8d
movsbl %al,%r9d
call   1030 <sprintf@plt>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<in_ntop>:
push   %rbx
mov    %rsi,%rbx
movsbl (%rdi),%edx
movsbl 0x1(%rdi),%ecx
movsbl 0x2(%rdi),%r8d
movsbl 0x3(%rdi),%r9d
lea    0xed4(%rip),%rsi
mov    %rbx,%rdi
call   1030 <sprintf@plt>
mov    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
%struct.in_addr = type { i32 }
@.str = [12 x i8] c"%d.%d.%d.%d\00"
define i8* @in_ntop(%struct.in_addr* nocapture %0, i8* returned writeonly %1) {
%3 = bitcast %struct.in_addr* %0 to i8*
%4 = load i8, i8* %3
%5 = getelementptr inbounds i8, i8* %3, i64 1
%6 = load i8, i8* %5
%7 = getelementptr inbounds i8, i8* %3, i64 2
%8 = load i8, i8* %7
%9 = getelementptr inbounds i8, i8* %3, i64 3
%10 = load i8, i8* %9
%11 = tail call i32 @sprintf(i8* dereferenceable(1) %1, i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8 signext %4, i8 signext %6, i8 signext %8, i8 signext %10)
ret i8* %1
}