#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 */
unsigned long inet_addr(char *);
int random_int(int, int);
int /*<<< orphan*/ sprintf(char *, char *, int, int, int, int);
unsigned long random_lip(void) {
  char convi[16];
  sprintf(convi, "%d.%d.%d.%d", random_int(1, 254), random_int(1, 254),
          random_int(1, 254), random_int(1, 254));
  return inet_addr(convi);
}


x86 assembly (clang, -O0):
<random_lip>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
lea    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    $0x1,%edi
mov    $0xfe,%esi
call   1040 <random_int@plt>
mov    %eax,-0x1c(%rbp)
mov    $0x1,%edi
mov    $0xfe,%esi
call   1040 <random_int@plt>
mov    %eax,-0x18(%rbp)
mov    $0x1,%edi
mov    $0xfe,%esi
call   1040 <random_int@plt>
mov    %eax,-0x14(%rbp)
mov    $0x1,%edi
mov    $0xfe,%esi
call   1040 <random_int@plt>
mov    -0x28(%rbp),%rdi
mov    -0x1c(%rbp),%edx
mov    -0x18(%rbp),%ecx
mov    -0x14(%rbp),%r8d
mov    %eax,%r9d
lea    0xe63(%rip),%rsi
call   1050 <sprintf@plt>
lea    -0x10(%rbp),%rdi
call   1030 <inet_addr@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<random_lip>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    $0x1,%edi
mov    $0xfe,%esi
call   1040 <random_int@plt>
mov    %eax,%r14d
mov    $0x1,%edi
mov    $0xfe,%esi
call   1040 <random_int@plt>
mov    %eax,%ebp
mov    $0x1,%edi
mov    $0xfe,%esi
call   1040 <random_int@plt>
mov    %eax,%ebx
mov    $0x1,%edi
mov    $0xfe,%esi
call   1040 <random_int@plt>
lea    0xe7c(%rip),%rsi
mov    %rsp,%r15
mov    %r15,%rdi
mov    %r14d,%edx
mov    %ebp,%ecx
mov    %ebx,%r8d
mov    %eax,%r9d
call   1050 <sprintf@plt>
mov    %r15,%rdi
call   1030 <inet_addr@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [12 x i8] c"%d.%d.%d.%d\00"
define i64 @random_lip() {
%1 = alloca [16 x i8]
%2 = getelementptr inbounds [16 x i8], [16 x i8]* %1, i64 0, i64 0
%3 = call i32 @random_int(i32 1, i32 254)
%4 = call i32 @random_int(i32 1, i32 254)
%5 = call i32 @random_int(i32 1, i32 254)
%6 = call i32 @random_int(i32 1, i32 254)
%7 = call i32 @sprintf(i8* %2, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %3, i32 %4, i32 %5, i32 %6)
%8 = getelementptr inbounds [16 x i8], [16 x i8]* %1, i64 0, i64 0
%9 = call i64 @inet_addr(i8* %8)
ret i64 %9
}

LLVM IR (-O2):
@.str = [12 x i8] c"%d.%d.%d.%d\00"
define i64 @random_lip() {
%1 = alloca [16 x i8]
%2 = getelementptr inbounds [16 x i8], [16 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @random_int(i32 1, i32 254)
%4 = tail call i32 @random_int(i32 1, i32 254)
%5 = tail call i32 @random_int(i32 1, i32 254)
%6 = tail call i32 @random_int(i32 1, i32 254)
%7 = call i32 @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %3, i32 %4, i32 %5, i32 %6)
%8 = call i64 @inet_addr(i8* %2)
ret i64 %8
}