#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 */
#define EAFNOSUPPORT 128
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stderr;
char *strerror(int);
void err_inet_pton(int err) {
  fprintf(stderr, "error: inet_pton(3) syscall failed\n");
  switch (err) {
  case 0:
    fprintf(stderr, "       Source host does not contain a character string "
                    "representing\n");
    fprintf(stderr,
            "       a valid network address in the specified address family\n");
    break;
  case EAFNOSUPPORT:
    fprintf(stderr, "       Domain does not contain a valid address family\n");
    fprintf(stderr, "       errno is: %d\n", err);
    ;
    fprintf(stderr, "       %s\n", strerror(err));
    ;
    break;
  default:
    fprintf(stderr, "       errno is: %d\n", err);
    ;
    fprintf(stderr, "       %s\n", strerror(err));
    ;
    break;
  }
  fflush(stderr);
}


x86 assembly (clang, -O0):
<err_inet_pton>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2e9e(%rip),%rax
mov    (%rax),%edi
lea    0xeb5(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
test   %eax,%eax
je     1178 <err_inet_pton+0x48>
jmp    1165 <err_inet_pton+0x35>
mov    -0x8(%rbp),%eax
sub    $0x80,%eax
je     11ab <err_inet_pton+0x7b>
jmp    1209 <err_inet_pton+0xd9>
mov    0x2e61(%rip),%rax
mov    (%rax),%edi
lea    0xe9c(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2e4a(%rip),%rax
mov    (%rax),%edi
lea    0xeca(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    124b <err_inet_pton+0x11b>
mov    0x2e2e(%rip),%rax
mov    (%rax),%edi
lea    0xeee(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2e17(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%edx
lea    0xf0b(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2dfd(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%edi
call   1050 <strerror@plt>
mov    -0xc(%rbp),%edi
mov    %rax,%rdx
lea    0xef8(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    124b <err_inet_pton+0x11b>
mov    0x2dd0(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%edx
lea    0xec4(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2db6(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%edi
call   1050 <strerror@plt>
mov    -0x10(%rbp),%edi
mov    %rax,%rdx
lea    0xeb1(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2d8e(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<err_inet_pton>:
push   %rbp
push   %r14
push   %rbx
mov    %edi,%ebx
mov    0x2ea3(%rip),%rbp
mov    0x0(%rbp),%edi
lea    0xeb9(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
cmp    $0x80,%ebx
je     117e <err_inet_pton+0x4e>
test   %ebx,%ebx
jne    11bd <err_inet_pton+0x8d>
mov    0x0(%rbp),%edi
lea    0xec0(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    0x0(%rbp),%edi
lea    0xef4(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
jmp    11ef <err_inet_pton+0xbf>
mov    0x0(%rbp),%edi
lea    0xf21(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    0x0(%rbp),%edi
lea    0xf47(%rip),%rsi
mov    $0x80,%edx
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    0x0(%rbp),%ebx
mov    $0x80,%edi
call   1050 <strerror@plt>
lea    0xf3c(%rip),%rsi
mov    %ebx,%edi
jmp    11e5 <err_inet_pton+0xb5>
mov    0x0(%rbp),%edi
lea    0xf19(%rip),%rsi
mov    %ebx,%edx
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    0x0(%rbp),%r14d
mov    %ebx,%edi
call   1050 <strerror@plt>
lea    0xf13(%rip),%rsi
mov    %r14d,%edi
mov    %rax,%rdx
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    0x0(%rbp),%edi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <fflush@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [36 x i8] c"error: inet_pton(3) syscall failed\0A\00"
@.str.1 = [69 x i8] c" Source host does not contain a character string representing\0A\00"
@.str.2 = [64 x i8] c" a valid network address in the specified address family\0A\00"
@.str.3 = [55 x i8] c" Domain does not contain a valid address family\0A\00"
@.str.4 = [21 x i8] c" errno is: %d\0A\00"
@.str.5 = [11 x i8] c" %s\0A\00"
define void @err_inet_pton(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* @stderr
%4 = call i32 (i32, i8*, ...) @fprintf(i32 %3, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%5 = load i32, i32* %2
switch i32 %5, label %21 [
i32 0, label %6
i32 128, label %11
]
6: ; preds = %1
%7 = load i32, i32* @stderr
%8 = call i32 (i32, i8*, ...) @fprintf(i32 %7, i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str.1, i64 0, i64 0))
%9 = load i32, i32* @stderr
%10 = call i32 (i32, i8*, ...) @fprintf(i32 %9, i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.2, i64 0, i64 0))
br label %29
11: ; preds = %1
%12 = load i32, i32* @stderr
%13 = call i32 (i32, i8*, ...) @fprintf(i32 %12, i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.3, i64 0, i64 0))
%14 = load i32, i32* @stderr
%15 = load i32, i32* %2
%16 = call i32 (i32, i8*, ...) @fprintf(i32 %14, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i32 %15)
%17 = load i32, i32* @stderr
%18 = load i32, i32* %2
%19 = call i8* @strerror(i32 %18)
%20 = call i32 (i32, i8*, ...) @fprintf(i32 %17, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0), i8* %19)
br label %29
21: ; preds = %1
%22 = load i32, i32* @stderr
%23 = load i32, i32* %2
%24 = call i32 (i32, i8*, ...) @fprintf(i32 %22, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i32 %23)
%25 = load i32, i32* @stderr
%26 = load i32, i32* %2
%27 = call i8* @strerror(i32 %26)
%28 = call i32 (i32, i8*, ...) @fprintf(i32 %25, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0), i8* %27)
br label %29
29: ; preds = %21, %11, %6
%30 = load i32, i32* @stderr
%31 = call i32 @fflush(i32 %30)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [36 x i8] c"error: inet_pton(3) syscall failed\0A\00"
@.str.1 = [69 x i8] c" Source host does not contain a character string representing\0A\00"
@.str.2 = [64 x i8] c" a valid network address in the specified address family\0A\00"
@.str.3 = [55 x i8] c" Domain does not contain a valid address family\0A\00"
@.str.4 = [21 x i8] c" errno is: %d\0A\00"
@.str.5 = [11 x i8] c" %s\0A\00"
define void @err_inet_pton(i32 %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 (i32, i8*, ...) @fprintf(i32 %2, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
switch i32 %0, label %17 [
i32 0, label %4
i32 128, label %9
]
4: ; preds = %1
%5 = load i32, i32* @stderr
%6 = tail call i32 (i32, i8*, ...) @fprintf(i32 %5, i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str.1, i64 0, i64 0))
%7 = load i32, i32* @stderr
%8 = tail call i32 (i32, i8*, ...) @fprintf(i32 %7, i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.2, i64 0, i64 0))
br label %23
9: ; preds = %1
%10 = load i32, i32* @stderr
%11 = tail call i32 (i32, i8*, ...) @fprintf(i32 %10, i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.3, i64 0, i64 0))
%12 = load i32, i32* @stderr
%13 = tail call i32 (i32, i8*, ...) @fprintf(i32 %12, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i32 128)
%14 = load i32, i32* @stderr
%15 = tail call i8* @strerror(i32 128)
%16 = tail call i32 (i32, i8*, ...) @fprintf(i32 %14, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0), i8* %15)
br label %23
17: ; preds = %1
%18 = load i32, i32* @stderr
%19 = tail call i32 (i32, i8*, ...) @fprintf(i32 %18, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i32 %0)
%20 = load i32, i32* @stderr
%21 = tail call i8* @strerror(i32 %0)
%22 = tail call i32 (i32, i8*, ...) @fprintf(i32 %20, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0), i8* %21)
br label %23
23: ; preds = %17, %9, %4
%24 = load i32, i32* @stderr
%25 = tail call i32 @fflush(i32 %24)
ret void
}