#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__ in_addr_t;

/* Variables and functions */
scalar_t__ INADDR_NONE;
scalar_t__ inet_addr(char const *);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  const char *string1 = "192.168.130.60";
  const char *string2 = "192.168.130.256";
  in_addr_t network_address1 = inet_addr(string1);
  if (network_address1 == INADDR_NONE) {
    printf("错误");
  } else {
    printf("网络字节序为：%#x\n", network_address1);
  }
  in_addr_t network_address2 = inet_addr(string2);
  if (network_address2 == INADDR_NONE) {
    printf("错误");
  } else {
    printf("网络字节序为：%#x\n", network_address2);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xece(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <inet_addr@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    0x2e8b(%rip),%rcx
cmp    (%rcx),%rax
jne    1179 <main+0x59>
lea    0xeb2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    118b <main+0x6b>
mov    -0x20(%rbp),%rsi
lea    0xea2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1040 <inet_addr@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    0x2e45(%rip),%rcx
cmp    (%rcx),%rax
jne    11bf <main+0x9f>
lea    0xe6c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11d1 <main+0xb1>
mov    -0x28(%rbp),%rsi
lea    0xe5c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xed8(%rip),%rdi
call   1040 <inet_addr@plt>
mov    0x2eb4(%rip),%rbx
cmp    (%rbx),%rax
jne    1149 <main+0x29>
lea    0xedf(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    115a <main+0x3a>
lea    0xed6(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeae(%rip),%rdi
call   1040 <inet_addr@plt>
cmp    (%rbx),%rax
jne    117b <main+0x5b>
lea    0xead(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    118c <main+0x6c>
lea    0xea4(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [15 x i8] c"192.168.130.60\00"
@.str.1 = [16 x i8] c"192.168.130.256\00"
@INADDR_NONE = global i64 0
@.str.2 = [7 x i8] c"\E9\94\99\E8\AF\AF\00"
@.str.3 = [26 x i8] c"\E7\BD\91\E7\BB\9C\E5\AD\97\E8\8A\82\E5\BA\8F\E4\B8\BA\EF\BC\9A%#x\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i64
store i32 0, i32* %1
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8** %2
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8** %3
%6 = load i8*, i8** %2
%7 = call i64 @inet_addr(i8* %6)
store i64 %7, i64* %4
%8 = load i64, i64* %4
%9 = load i64, i64* @INADDR_NONE
%10 = icmp eq i64 %8, %9
br i1 %10, label %11, label %13
11: ; preds = %0
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
br label %16
13: ; preds = %0
%14 = load i64, i64* %4
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0), i64 %14)
br label %16
16: ; preds = %13, %11
%17 = load i8*, i8** %3
%18 = call i64 @inet_addr(i8* %17)
store i64 %18, i64* %5
%19 = load i64, i64* %5
%20 = load i64, i64* @INADDR_NONE
%21 = icmp eq i64 %19, %20
br i1 %21, label %22, label %24
22: ; preds = %16
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
br label %27
24: ; preds = %16
%25 = load i64, i64* %5
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0), i64 %25)
br label %27
27: ; preds = %24, %22
ret i32 0
}

LLVM IR (-O2):
@.str = [15 x i8] c"192.168.130.60\00"
@.str.1 = [16 x i8] c"192.168.130.256\00"
@INADDR_NONE = global i64 0
@.str.2 = [7 x i8] c"\E9\94\99\E8\AF\AF\00"
@.str.3 = [26 x i8] c"\E7\BD\91\E7\BB\9C\E5\AD\97\E8\8A\82\E5\BA\8F\E4\B8\BA\EF\BC\9A%#x\0A\00"
define i32 @main() {
%1 = tail call i64 @inet_addr(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%2 = load i64, i64* @INADDR_NONE
%3 = icmp eq i64 %1, %2
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
br label %8
6: ; preds = %0
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0), i64 %1)
br label %8
8: ; preds = %6, %4
%9 = tail call i64 @inet_addr(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%10 = load i64, i64* @INADDR_NONE
%11 = icmp eq i64 %9, %10
br i1 %11, label %12, label %14
12: ; preds = %8
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
br label %16
14: ; preds = %8
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0), i64 %9)
br label %16
16: ; preds = %14, %12
ret i32 0
}