#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*/ strncpy(char *, char *, int);
void get_full_netmask(char *buf, int short_mask) {
  switch (short_mask) {
  case 30:
    strncpy(buf, "255.255.255.252", 15);
    break;
  case 29:
    strncpy(buf, "255.255.255.248", 15);
    break;
  case 28:
    strncpy(buf, "255.255.255.240", 15);
    break;
  case 27:
    strncpy(buf, "255.255.255.224", 15);
    break;
  case 26:
    strncpy(buf, "255.255.255.192", 15);
    break;
  case 25:
    strncpy(buf, "255.255.255.128", 15);
    break;
  case 24:
    strncpy(buf, "255.255.255.0", 13);
    break;
  case 23:
    strncpy(buf, "255.255.254.0", 13);
    break;
  case 22:
    strncpy(buf, "255.255.252.0", 13);
    break;
  case 21:
    strncpy(buf, "255.255.248.0", 13);
    break;
  case 20:
    strncpy(buf, "255.255.240.0", 13);
    break;
  case 19:
    strncpy(buf, "255.255.224.0", 13);
    break;
  case 18:
    strncpy(buf, "255.255.192.0", 13);
    break;
  case 17:
    strncpy(buf, "255.255.128.0", 13);
    break;
  case 16:
    strncpy(buf, "255.255.0.0", 13);
    break;
  }
}


x86 assembly (clang, -O0):
<get_full_netmask>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0xfffffff0,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0xe,%eax
ja     12c9 <get_full_netmask+0x1b9>
mov    -0x18(%rbp),%rax
lea    0xec1(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x8(%rbp),%rdi
lea    0xee9(%rip),%rsi
mov    $0xf,%edx
call   1030 <strncpy@plt>
jmp    12c9 <get_full_netmask+0x1b9>
mov    -0x8(%rbp),%rdi
lea    0xedf(%rip),%rsi
mov    $0xf,%edx
call   1030 <strncpy@plt>
jmp    12c9 <get_full_netmask+0x1b9>
mov    -0x8(%rbp),%rdi
lea    0xed5(%rip),%rsi
mov    $0xf,%edx
call   1030 <strncpy@plt>
jmp    12c9 <get_full_netmask+0x1b9>
mov    -0x8(%rbp),%rdi
lea    0xecb(%rip),%rsi
mov    $0xf,%edx
call   1030 <strncpy@plt>
jmp    12c9 <get_full_netmask+0x1b9>
mov    -0x8(%rbp),%rdi
lea    0xec1(%rip),%rsi
mov    $0xf,%edx
call   1030 <strncpy@plt>
jmp    12c9 <get_full_netmask+0x1b9>
mov    -0x8(%rbp),%rdi
lea    0xeb7(%rip),%rsi
mov    $0xf,%edx
call   1030 <strncpy@plt>
jmp    12c9 <get_full_netmask+0x1b9>
mov    -0x8(%rbp),%rdi
lea    0xead(%rip),%rsi
mov    $0xd,%edx
call   1030 <strncpy@plt>
jmp    12c9 <get_full_netmask+0x1b9>
mov    -0x8(%rbp),%rdi
lea    0xea1(%rip),%rsi
mov    $0xd,%edx
call   1030 <strncpy@plt>
jmp    12c9 <get_full_netmask+0x1b9>
mov    -0x8(%rbp),%rdi
lea    0xe95(%rip),%rsi
mov    $0xd,%edx
call   1030 <strncpy@plt>
jmp    12c9 <get_full_netmask+0x1b9>
mov    -0x8(%rbp),%rdi
lea    0xe89(%rip),%rsi
mov    $0xd,%edx
call   1030 <strncpy@plt>
jmp    12c9 <get_full_netmask+0x1b9>
mov    -0x8(%rbp),%rdi
lea    0xe7d(%rip),%rsi
mov    $0xd,%edx
call   1030 <strncpy@plt>
jmp    12c9 <get_full_netmask+0x1b9>
mov    -0x8(%rbp),%rdi
lea    0xe71(%rip),%rsi
mov    $0xd,%edx
call   1030 <strncpy@plt>
jmp    12c9 <get_full_netmask+0x1b9>
mov    -0x8(%rbp),%rdi
lea    0xe65(%rip),%rsi
mov    $0xd,%edx
call   1030 <strncpy@plt>
jmp    12c9 <get_full_netmask+0x1b9>
mov    -0x8(%rbp),%rdi
lea    0xe59(%rip),%rsi
mov    $0xd,%edx
call   1030 <strncpy@plt>
jmp    12c9 <get_full_netmask+0x1b9>
mov    -0x8(%rbp),%rdi
lea    0xe4d(%rip),%rsi
mov    $0xd,%edx
call   1030 <strncpy@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_full_netmask>:
add    $0xfffffff0,%esi
cmp    $0xe,%esi
ja     1139 <get_full_netmask+0x29>
lea    0xee1(%rip),%rax
movslq (%rax,%rsi,4),%rcx
add    %rax,%rcx
jmp    *%rcx
lea    0xfdd(%rip),%rsi
mov    $0xd,%edx
jmp    1030 <strncpy@plt>
ret
lea    0xfbd(%rip),%rsi
mov    $0xd,%edx
jmp    1030 <strncpy@plt>
lea    0xf9e(%rip),%rsi
mov    $0xd,%edx
jmp    1030 <strncpy@plt>
lea    0xf7f(%rip),%rsi
mov    $0xd,%edx
jmp    1030 <strncpy@plt>
lea    0xf60(%rip),%rsi
mov    $0xd,%edx
jmp    1030 <strncpy@plt>
lea    0xf41(%rip),%rsi
mov    $0xd,%edx
jmp    1030 <strncpy@plt>
lea    0xf22(%rip),%rsi
mov    $0xd,%edx
jmp    1030 <strncpy@plt>
lea    0xf03(%rip),%rsi
mov    $0xd,%edx
jmp    1030 <strncpy@plt>
lea    0xee4(%rip),%rsi
mov    $0xd,%edx
jmp    1030 <strncpy@plt>
lea    0xec3(%rip),%rsi
mov    $0xf,%edx
jmp    1030 <strncpy@plt>
lea    0xea2(%rip),%rsi
mov    $0xf,%edx
jmp    1030 <strncpy@plt>
lea    0xe81(%rip),%rsi
mov    $0xf,%edx
jmp    1030 <strncpy@plt>
lea    0xe60(%rip),%rsi
mov    $0xf,%edx
jmp    1030 <strncpy@plt>
lea    0xe3f(%rip),%rsi
mov    $0xf,%edx
jmp    1030 <strncpy@plt>
lea    0xe1e(%rip),%rsi
mov    $0xf,%edx
jmp    1030 <strncpy@plt>

LLVM IR (-O0):
@.str = [16 x i8] c"255.255.255.252\00"
@.str.1 = [16 x i8] c"255.255.255.248\00"
@.str.2 = [16 x i8] c"255.255.255.240\00"
@.str.3 = [16 x i8] c"255.255.255.224\00"
@.str.4 = [16 x i8] c"255.255.255.192\00"
@.str.5 = [16 x i8] c"255.255.255.128\00"
@.str.6 = [14 x i8] c"255.255.255.0\00"
@.str.7 = [14 x i8] c"255.255.254.0\00"
@.str.8 = [14 x i8] c"255.255.252.0\00"
@.str.9 = [14 x i8] c"255.255.248.0\00"
@.str.10 = [14 x i8] c"255.255.240.0\00"
@.str.11 = [14 x i8] c"255.255.224.0\00"
@.str.12 = [14 x i8] c"255.255.192.0\00"
@.str.13 = [14 x i8] c"255.255.128.0\00"
@.str.14 = [12 x i8] c"255.255.0.0\00"
define void @get_full_netmask(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
switch i32 %5, label %51 [
i32 30, label %6
i32 29, label %9
i32 28, label %12
i32 27, label %15
i32 26, label %18
i32 25, label %21
i32 24, label %24
i32 23, label %27
i32 22, label %30
i32 21, label %33
i32 20, label %36
i32 19, label %39
i32 18, label %42
i32 17, label %45
i32 16, label %48
]
6: ; preds = %2
%7 = load i8*, i8** %3
%8 = call i32 @strncpy(i8* %7, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 15)
br label %51
9: ; preds = %2
%10 = load i8*, i8** %3
%11 = call i32 @strncpy(i8* %10, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 15)
br label %51
12: ; preds = %2
%13 = load i8*, i8** %3
%14 = call i32 @strncpy(i8* %13, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i32 15)
br label %51
15: ; preds = %2
%16 = load i8*, i8** %3
%17 = call i32 @strncpy(i8* %16, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i32 15)
br label %51
18: ; preds = %2
%19 = load i8*, i8** %3
%20 = call i32 @strncpy(i8* %19, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i32 15)
br label %51
21: ; preds = %2
%22 = load i8*, i8** %3
%23 = call i32 @strncpy(i8* %22, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), i32 15)
br label %51
24: ; preds = %2
%25 = load i8*, i8** %3
%26 = call i32 @strncpy(i8* %25, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0), i32 13)
br label %51
27: ; preds = %2
%28 = load i8*, i8** %3
%29 = call i32 @strncpy(i8* %28, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0), i32 13)
br label %51
30: ; preds = %2
%31 = load i8*, i8** %3
%32 = call i32 @strncpy(i8* %31, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.8, i64 0, i64 0), i32 13)
br label %51
33: ; preds = %2
%34 = load i8*, i8** %3
%35 = call i32 @strncpy(i8* %34, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.9, i64 0, i64 0), i32 13)
br label %51
36: ; preds = %2
%37 = load i8*, i8** %3
%38 = call i32 @strncpy(i8* %37, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.10, i64 0, i64 0), i32 13)
br label %51
39: ; preds = %2
%40 = load i8*, i8** %3
%41 = call i32 @strncpy(i8* %40, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.11, i64 0, i64 0), i32 13)
br label %51
42: ; preds = %2
%43 = load i8*, i8** %3
%44 = call i32 @strncpy(i8* %43, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.12, i64 0, i64 0), i32 13)
br label %51
45: ; preds = %2
%46 = load i8*, i8** %3
%47 = call i32 @strncpy(i8* %46, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.13, i64 0, i64 0), i32 13)
br label %51
48: ; preds = %2
%49 = load i8*, i8** %3
%50 = call i32 @strncpy(i8* %49, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.14, i64 0, i64 0), i32 13)
br label %51
51: ; preds = %2, %48, %45, %42, %39, %36, %33, %30, %27, %24, %21, %18, %15, %12, %9, %6
ret void
}

LLVM IR (-O2):
@.str = [16 x i8] c"255.255.255.252\00"
@.str.1 = [16 x i8] c"255.255.255.248\00"
@.str.2 = [16 x i8] c"255.255.255.240\00"
@.str.3 = [16 x i8] c"255.255.255.224\00"
@.str.4 = [16 x i8] c"255.255.255.192\00"
@.str.5 = [16 x i8] c"255.255.255.128\00"
@.str.6 = [14 x i8] c"255.255.255.0\00"
@.str.7 = [14 x i8] c"255.255.254.0\00"
@.str.8 = [14 x i8] c"255.255.252.0\00"
@.str.9 = [14 x i8] c"255.255.248.0\00"
@.str.10 = [14 x i8] c"255.255.240.0\00"
@.str.11 = [14 x i8] c"255.255.224.0\00"
@.str.12 = [14 x i8] c"255.255.192.0\00"
@.str.13 = [14 x i8] c"255.255.128.0\00"
@.str.14 = [12 x i8] c"255.255.0.0\00"
define void @get_full_netmask(i8* %0, i32 %1) {
switch i32 %1, label %33 [
i32 30, label %3
i32 29, label %5
i32 28, label %7
i32 27, label %9
i32 26, label %11
i32 25, label %13
i32 24, label %15
i32 23, label %17
i32 22, label %19
i32 21, label %21
i32 20, label %23
i32 19, label %25
i32 18, label %27
i32 17, label %29
i32 16, label %31
]
3: ; preds = %2
%4 = tail call i32 @strncpy(i8* %0, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 15)
br label %33
5: ; preds = %2
%6 = tail call i32 @strncpy(i8* %0, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 15)
br label %33
7: ; preds = %2
%8 = tail call i32 @strncpy(i8* %0, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i32 15)
br label %33
9: ; preds = %2
%10 = tail call i32 @strncpy(i8* %0, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i32 15)
br label %33
11: ; preds = %2
%12 = tail call i32 @strncpy(i8* %0, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i32 15)
br label %33
13: ; preds = %2
%14 = tail call i32 @strncpy(i8* %0, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), i32 15)
br label %33
15: ; preds = %2
%16 = tail call i32 @strncpy(i8* %0, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0), i32 13)
br label %33
17: ; preds = %2
%18 = tail call i32 @strncpy(i8* %0, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0), i32 13)
br label %33
19: ; preds = %2
%20 = tail call i32 @strncpy(i8* %0, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.8, i64 0, i64 0), i32 13)
br label %33
21: ; preds = %2
%22 = tail call i32 @strncpy(i8* %0, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.9, i64 0, i64 0), i32 13)
br label %33
23: ; preds = %2
%24 = tail call i32 @strncpy(i8* %0, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.10, i64 0, i64 0), i32 13)
br label %33
25: ; preds = %2
%26 = tail call i32 @strncpy(i8* %0, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.11, i64 0, i64 0), i32 13)
br label %33
27: ; preds = %2
%28 = tail call i32 @strncpy(i8* %0, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.12, i64 0, i64 0), i32 13)
br label %33
29: ; preds = %2
%30 = tail call i32 @strncpy(i8* %0, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.13, i64 0, i64 0), i32 13)
br label %33
31: ; preds = %2
%32 = tail call i32 @strncpy(i8* %0, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.14, i64 0, i64 0), i32 13)
br label %33
33: ; preds = %2, %31, %29, %27, %25, %23, %21, %19, %17, %15, %13, %11, %9, %7, %5, %3
ret void
}