#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;
};
typedef int /*<<< orphan*/ b;

/* Variables and functions */
int /*<<< orphan*/ snprintf(char *, int, char *, int, int, int, int);
char *inet_ntoa(struct in_addr in) {
  static char b[18];
  register char *p;
  p = (char *)&in;
  (void)snprintf(b, sizeof(b), "%d.%d.%d.%d", (((int)p[0]) & 0xff),
                 (((int)p[1]) & 0xff), (((int)p[2]) & 0xff),
                 (((int)p[3]) & 0xff));
  return (b);
}


x86 assembly (clang, -O0):
<inet_ntoa>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
lea    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%ecx
and    $0xff,%ecx
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%r8d
and    $0xff,%r8d
mov    -0x10(%rbp),%rax
movsbl 0x2(%rax),%r9d
and    $0xff,%r9d
mov    -0x10(%rbp),%rax
movsbl 0x3(%rax),%eax
and    $0xff,%eax
lea    0x2edc(%rip),%rdi
mov    $0x12,%esi
lea    0xe90(%rip),%rdx
mov    %eax,(%rsp)
call   1030 <snprintf@plt>
lea    0x2ec1(%rip),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<inet_ntoa>:
push   %rbx
sub    $0x10,%rsp
mov    %edi,%edx
movzbl %dl,%ecx
movzbl %dh,%eax
mov    %edi,%esi
shr    $0x10,%esi
movzbl %sil,%r9d
shr    $0x18,%edx
mov    %edx,(%rsp)
lea    0x2f0d(%rip),%rbx
lea    0xec6(%rip),%rdx
mov    %rbx,%rdi
mov    $0x12,%esi
mov    %eax,%r8d
call   1030 <snprintf@plt>
mov    %rbx,%rax
add    $0x10,%rsp
pop    %rbx
ret

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

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