#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*/ sprintf(char *, char *, unsigned int, unsigned int,
                           unsigned int, unsigned int);
int /*<<< orphan*/ sscanf(char *, char *, unsigned int *, unsigned int *,
                          unsigned int *, unsigned int *);
char *IPNumber(char *cInput) {
  unsigned a = 0, b = 0, c = 0, d = 0;
  sscanf(cInput, "%u.%u.%u.%u", &a, &b, &c, &d);
  if (a > 255)
    a = 0;
  if (b > 255)
    b = 0;
  if (c > 255)
    c = 0;
  if (d > 255)
    d = 0;
  sprintf(cInput, "%u.%u.%u.%u", a, b, c, d);
  return (cInput);
}


x86 assembly (clang, -O0):
<IPNumber>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xead(%rip),%rsi
lea    -0xc(%rbp),%rdx
lea    -0x10(%rbp),%rcx
lea    -0x14(%rbp),%r8
lea    -0x18(%rbp),%r9
call   1030 <sscanf@plt>
cmpl   $0xff,-0xc(%rbp)
jbe    117c <IPNumber+0x5c>
movl   $0x0,-0xc(%rbp)
cmpl   $0xff,-0x10(%rbp)
jbe    1190 <IPNumber+0x70>
movl   $0x0,-0x10(%rbp)
cmpl   $0xff,-0x14(%rbp)
jbe    11a4 <IPNumber+0x84>
movl   $0x0,-0x14(%rbp)
cmpl   $0xff,-0x18(%rbp)
jbe    11b8 <IPNumber+0x98>
movl   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
mov    -0x14(%rbp),%r8d
mov    -0x18(%rbp),%r9d
lea    0xe2f(%rip),%rsi
call   1040 <sprintf@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<IPNumber>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
movl   $0x0,0xc(%rsp)
movl   $0x0,0x8(%rsp)
movl   $0x0,0x4(%rsp)
movl   $0x0,(%rsp)
lea    0xeb2(%rip),%rsi
lea    0xc(%rsp),%rdx
lea    0x8(%rsp),%rcx
lea    0x4(%rsp),%r8
mov    %rsp,%r9
call   1030 <sscanf@plt>
mov    0xc(%rsp),%edx
cmp    $0x100,%edx
jb     117b <IPNumber+0x5b>
movl   $0x0,0xc(%rsp)
xor    %edx,%edx
mov    0x8(%rsp),%ecx
cmp    $0x100,%ecx
jb     1191 <IPNumber+0x71>
movl   $0x0,0x8(%rsp)
xor    %ecx,%ecx
mov    0x4(%rsp),%r8d
cmp    $0x100,%r8d
jb     11aa <IPNumber+0x8a>
movl   $0x0,0x4(%rsp)
xor    %r8d,%r8d
mov    (%rsp),%r9d
cmp    $0x100,%r9d
jb     11c1 <IPNumber+0xa1>
movl   $0x0,(%rsp)
xor    %r9d,%r9d
lea    0xe38(%rip),%rsi
mov    %rbx,%rdi
call   1040 <sprintf@plt>
mov    %rbx,%rax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [12 x i8] c"%u.%u.%u.%u\00"
define i8* @IPNumber(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
store i32 0, i32* %4
store i32 0, i32* %5
store i32 0, i32* %6
%7 = load i8*, i8** %2
%8 = call i32 @sscanf(i8* %7, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32* %3, i32* %4, i32* %5, i32* %6)
%9 = load i32, i32* %3
%10 = icmp ugt i32 %9, 255
br i1 %10, label %11, label %12
11: ; preds = %1
store i32 0, i32* %3
br label %12
12: ; preds = %11, %1
%13 = load i32, i32* %4
%14 = icmp ugt i32 %13, 255
br i1 %14, label %15, label %16
15: ; preds = %12
store i32 0, i32* %4
br label %16
16: ; preds = %15, %12
%17 = load i32, i32* %5
%18 = icmp ugt i32 %17, 255
br i1 %18, label %19, label %20
19: ; preds = %16
store i32 0, i32* %5
br label %20
20: ; preds = %19, %16
%21 = load i32, i32* %6
%22 = icmp ugt i32 %21, 255
br i1 %22, label %23, label %24
23: ; preds = %20
store i32 0, i32* %6
br label %24
24: ; preds = %23, %20
%25 = load i8*, i8** %2
%26 = load i32, i32* %3
%27 = load i32, i32* %4
%28 = load i32, i32* %5
%29 = load i32, i32* %6
%30 = call i32 @sprintf(i8* %25, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %26, i32 %27, i32 %28, i32 %29)
%31 = load i8*, i8** %2
ret i8* %31
}

LLVM IR (-O2):
@.str = [12 x i8] c"%u.%u.%u.%u\00"
define i8* @IPNumber(i8* returned %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%7 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%8 = bitcast i32* %4 to i8*
store i32 0, i32* %4
%9 = bitcast i32* %5 to i8*
store i32 0, i32* %5
%10 = call i32 @sscanf(i8* %0, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32* %2, i32* %3, i32* %4, i32* %5)
%11 = load i32, i32* %2
%12 = icmp ugt i32 %11, 255
br i1 %12, label %13, label %14
13: ; preds = %1
store i32 0, i32* %2
br label %14
14: ; preds = %13, %1
%15 = phi i32 [ 0, %13 ], [ %11, %1 ]
%16 = load i32, i32* %3
%17 = icmp ugt i32 %16, 255
br i1 %17, label %18, label %19
18: ; preds = %14
store i32 0, i32* %3
br label %19
19: ; preds = %18, %14
%20 = phi i32 [ 0, %18 ], [ %16, %14 ]
%21 = load i32, i32* %4
%22 = icmp ugt i32 %21, 255
br i1 %22, label %23, label %24
23: ; preds = %19
store i32 0, i32* %4
br label %24
24: ; preds = %23, %19
%25 = phi i32 [ 0, %23 ], [ %21, %19 ]
%26 = load i32, i32* %5
%27 = icmp ugt i32 %26, 255
br i1 %27, label %28, label %29
28: ; preds = %24
store i32 0, i32* %5
br label %29
29: ; preds = %28, %24
%30 = phi i32 [ 0, %28 ], [ %26, %24 ]
%31 = call i32 @sprintf(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %15, i32 %20, i32 %25, i32 %30)
ret i8* %0
}