#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 in6_addr {
  int *s6_addr32;
};

/* Variables and functions */
char *ebt_ip6_to_numeric(struct in6_addr const *);
int /*<<< orphan*/ sprintf(char *, char *, char *);
char *ebt_ip6_mask_to_string(const struct in6_addr *msk) {
  static char buf[51 + 1];
  if (msk->s6_addr32[0] == 0xFFFFFFFFL && msk->s6_addr32[1] == 0xFFFFFFFFL &&
      msk->s6_addr32[2] == 0xFFFFFFFFL && msk->s6_addr32[3] == 0xFFFFFFFFL)
    *buf = '\0';
  else
    sprintf(buf, "/%s", ebt_ip6_to_numeric(msk));
  return buf;
}


x86 assembly (clang, -O0):
<ebt_ip6_mask_to_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movslq (%rax),%rax
mov    $0xffffffff,%ecx
cmp    %rcx,%rax
jne    119b <ebt_ip6_mask_to_string+0x7b>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movslq 0x4(%rax),%rax
mov    $0xffffffff,%ecx
cmp    %rcx,%rax
jne    119b <ebt_ip6_mask_to_string+0x7b>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movslq 0x8(%rax),%rax
mov    $0xffffffff,%ecx
cmp    %rcx,%rax
jne    119b <ebt_ip6_mask_to_string+0x7b>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movslq 0xc(%rax),%rax
mov    $0xffffffff,%ecx
cmp    %rcx,%rax
jne    119b <ebt_ip6_mask_to_string+0x7b>
movb   $0x0,0x2eaa(%rip)
jmp    11ba <ebt_ip6_mask_to_string+0x9a>
mov    -0x8(%rbp),%rdi
call   1030 <ebt_ip6_to_numeric@plt>
mov    %rax,%rdx
lea    0x2e92(%rip),%rdi
lea    0xe4b(%rip),%rsi
call   1040 <sprintf@plt>
lea    0x2e7f(%rip),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ebt_ip6_mask_to_string>:
push   %rbx
call   1030 <ebt_ip6_to_numeric@plt>
lea    0x2f13(%rip),%rbx
lea    0xecc(%rip),%rsi
mov    %rbx,%rdi
mov    %rax,%rdx
call   1040 <sprintf@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
%struct.in6_addr = type { i32* }
@ebt_ip6_mask_to_string.buf = internal global [52 x i8] zeroinitializer
@.str = [4 x i8] c"/%s\00"
define i8* @ebt_ip6_mask_to_string(%struct.in6_addr* %0) {
%2 = alloca %struct.in6_addr*
store %struct.in6_addr* %0, %struct.in6_addr** %2
%3 = load %struct.in6_addr*, %struct.in6_addr** %2
%4 = getelementptr inbounds %struct.in6_addr, %struct.in6_addr* %3, i32 0, i32 0
%5 = load i32*, i32** %4
%6 = getelementptr inbounds i32, i32* %5, i64 0
%7 = load i32, i32* %6
%8 = sext i32 %7 to i64
%9 = icmp eq i64 %8, 4294967295
br i1 %9, label %10, label %35
10: ; preds = %1
%11 = load %struct.in6_addr*, %struct.in6_addr** %2
%12 = getelementptr inbounds %struct.in6_addr, %struct.in6_addr* %11, i32 0, i32 0
%13 = load i32*, i32** %12
%14 = getelementptr inbounds i32, i32* %13, i64 1
%15 = load i32, i32* %14
%16 = sext i32 %15 to i64
%17 = icmp eq i64 %16, 4294967295
br i1 %17, label %18, label %35
18: ; preds = %10
%19 = load %struct.in6_addr*, %struct.in6_addr** %2
%20 = getelementptr inbounds %struct.in6_addr, %struct.in6_addr* %19, i32 0, i32 0
%21 = load i32*, i32** %20
%22 = getelementptr inbounds i32, i32* %21, i64 2
%23 = load i32, i32* %22
%24 = sext i32 %23 to i64
%25 = icmp eq i64 %24, 4294967295
br i1 %25, label %26, label %35
26: ; preds = %18
%27 = load %struct.in6_addr*, %struct.in6_addr** %2
%28 = getelementptr inbounds %struct.in6_addr, %struct.in6_addr* %27, i32 0, i32 0
%29 = load i32*, i32** %28
%30 = getelementptr inbounds i32, i32* %29, i64 3
%31 = load i32, i32* %30
%32 = sext i32 %31 to i64
%33 = icmp eq i64 %32, 4294967295
br i1 %33, label %34, label %35
34: ; preds = %26
store i8 0, i8* getelementptr inbounds ([52 x i8], [52 x i8]* @ebt_ip6_mask_to_string.buf, i64 0, i64 0)
br label %39
35: ; preds = %26, %18, %10, %1
%36 = load %struct.in6_addr*, %struct.in6_addr** %2
%37 = call i8* @ebt_ip6_to_numeric(%struct.in6_addr* %36)
%38 = call i32 @sprintf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @ebt_ip6_mask_to_string.buf, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %37)
br label %39
39: ; preds = %35, %34
ret i8* getelementptr inbounds ([52 x i8], [52 x i8]* @ebt_ip6_mask_to_string.buf, i64 0, i64 0)
}

LLVM IR (-O2):
%struct.in6_addr = type { i32* }
@ebt_ip6_mask_to_string.buf = internal global [52 x i8] zeroinitializer
@.str = [4 x i8] c"/%s\00"
define i8* @ebt_ip6_mask_to_string(%struct.in6_addr* %0) {
%2 = tail call i8* @ebt_ip6_to_numeric(%struct.in6_addr* %0)
%3 = tail call i32 @sprintf(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @ebt_ip6_mask_to_string.buf, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %2)
ret i8* getelementptr inbounds ([52 x i8], [52 x i8]* @ebt_ip6_mask_to_string.buf, i64 0, i64 0)
}