#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 rand();
char *ccode(void) {
  int cca[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 0, 1, 2, 3, 4, 5,
               6, 7, 0, 1, 2, 3, 4, 5, 6, 0, 1, 2, 3, 4, 5,
               0, 1, 2, 3, 4, 0, 1, 2, 3, 0, 1, 2, 0, 1, 0};
  switch (cca[rand() % 45]) {
  case 0:
    return ".ru";
    break;
  case 1:
    return ".cn";
    break;
  case 2:
    return ".ca";
    break;
  case 3:
    return ".tw";
    break;
  case 4:
    return ".bg";
    break;
  case 5:
    return ".uk";
    break;
  case 6:
    return ".in";
    break;
  case 7:
    return ".mx";
    break;
  case 8:
    return ".de";
    break;
  }
}


x86 assembly (clang, -O0):
<ccode>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
lea    0xefe(%rip),%rsi
lea    -0xc0(%rbp),%rdi
mov    $0xb4,%edx
call   1030 <memcpy@plt>
xor    %eax,%eax
call   1040 <rand@plt>
movslq %eax,%rcx
imul   $0xffffffffb60b60b7,%rcx,%rcx
shr    $0x20,%rcx
mov    %ecx,%edx
add    %eax,%edx
mov    %edx,%ecx
shr    $0x1f,%ecx
sar    $0x5,%edx
add    %ecx,%edx
mov    %edx,%ecx
lea    (%rcx,%rcx,8),%edx
mov    %edx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
cltq
mov    -0xc0(%rbp,%rax,4),%eax
mov    %rax,-0xc8(%rbp)
sub    $0x8,%rax
ja     122e <ccode+0x10e>
mov    -0xc8(%rbp),%rax
lea    0xe66(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xf3a(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    122e <ccode+0x10e>
lea    0xf2e(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    122e <ccode+0x10e>
lea    0xf22(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    122e <ccode+0x10e>
lea    0xf16(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    122e <ccode+0x10e>
lea    0xf0a(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    122e <ccode+0x10e>
lea    0xefe(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    122e <ccode+0x10e>
lea    0xef2(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    122e <ccode+0x10e>
lea    0xee6(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    122e <ccode+0x10e>
lea    0xeda(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0xd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ccode>:
push   %rax
xor    %eax,%eax
call   1030 <rand@plt>
cltq
imul   $0xffffffffb60b60b7,%rax,%rcx
shr    $0x20,%rcx
add    %eax,%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
sar    $0x5,%ecx
add    %edx,%ecx
lea    (%rcx,%rcx,8),%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
cltq
lea    0xebe(%rip),%rcx
mov    (%rcx,%rax,4),%eax
add    $0xffffffff,%eax
cmp    $0x7,%eax
ja     115f <ccode+0x4f>
cltq
lea    0xf5e(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
pop    %rcx
ret
lea    0xf6e(%rip),%rax
pop    %rcx
ret

LLVM IR (-O0):
@__const.ccode.cca = [45 x i32] [i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 0, i32 1, i32 2, i32 3, i32 4, i32 0, i32 1, i32 2, i32 3, i32 0, i32 1, i32 2, i32 0, i32 1, i32 0]
@.str = [4 x i8] c".ru\00"
@.str.1 = [4 x i8] c".cn\00"
@.str.2 = [4 x i8] c".ca\00"
@.str.3 = [4 x i8] c".tw\00"
@.str.4 = [4 x i8] c".bg\00"
@.str.5 = [4 x i8] c".uk\00"
@.str.6 = [4 x i8] c".in\00"
@.str.7 = [4 x i8] c".mx\00"
@.str.8 = [4 x i8] c".de\00"
define i8* @ccode() {
%1 = alloca i8*
%2 = alloca [45 x i32]
%3 = bitcast [45 x i32]* %2 to i8*
%4 = call i32 (...) @rand()
%5 = srem i32 %4, 45
%6 = sext i32 %5 to i64
%7 = getelementptr inbounds [45 x i32], [45 x i32]* %2, i64 0, i64 %6
%8 = load i32, i32* %7
switch i32 %8, label %18 [
i32 0, label %9
i32 1, label %10
i32 2, label %11
i32 3, label %12
i32 4, label %13
i32 5, label %14
i32 6, label %15
i32 7, label %16
i32 8, label %17
]
9: ; preds = %0
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8** %1
br label %18
10: ; preds = %0
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8** %1
br label %18
11: ; preds = %0
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8** %1
br label %18
12: ; preds = %0
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8** %1
br label %18
13: ; preds = %0
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8** %1
br label %18
14: ; preds = %0
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i8** %1
br label %18
15: ; preds = %0
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i8** %1
br label %18
16: ; preds = %0
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i8** %1
br label %18
17: ; preds = %0
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i8** %1
br label %18
18: ; preds = %9, %10, %11, %12, %13, %14, %15, %16, %17, %0
%19 = load i8*, i8** %1
ret i8* %19
}

LLVM IR (-O2):
@__const.ccode.cca = [45 x i32] [i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 0, i32 1, i32 2, i32 3, i32 4, i32 0, i32 1, i32 2, i32 3, i32 0, i32 1, i32 2, i32 0, i32 1, i32 0]
@.str = [4 x i8] c".ru\00"
@.str.1 = [4 x i8] c".cn\00"
@.str.2 = [4 x i8] c".ca\00"
@.str.3 = [4 x i8] c".tw\00"
@.str.4 = [4 x i8] c".bg\00"
@.str.5 = [4 x i8] c".uk\00"
@.str.6 = [4 x i8] c".in\00"
@.str.7 = [4 x i8] c".mx\00"
@.str.8 = [4 x i8] c".de\00"
@reltable.ccode = [8 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.1 to i64), i64 ptrtoint ([8 x i32]* @reltable.ccode to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.2 to i64), i64 ptrtoint ([8 x i32]* @reltable.ccode to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.3 to i64), i64 ptrtoint ([8 x i32]* @reltable.ccode to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.4 to i64), i64 ptrtoint ([8 x i32]* @reltable.ccode to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.5 to i64), i64 ptrtoint ([8 x i32]* @reltable.ccode to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.6 to i64), i64 ptrtoint ([8 x i32]* @reltable.ccode to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.7 to i64), i64 ptrtoint ([8 x i32]* @reltable.ccode to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.8 to i64), i64 ptrtoint ([8 x i32]* @reltable.ccode to i64)) to i32)]
define i8* @ccode() {
%1 = tail call i32 (...) @rand()
%2 = srem i32 %1, 45
%3 = sext i32 %2 to i64
%4 = getelementptr inbounds [45 x i32], [45 x i32]* @__const.ccode.cca, i64 0, i64 %3
%5 = load i32, i32* %4
%6 = add i32 %5, -1
%7 = icmp ult i32 %6, 8
br i1 %7, label %8, label %12
8: ; preds = %0
%9 = sext i32 %6 to i64
%10 = shl i64 %9, 2
%11 = call i8* @llvm.load.relative.i64(i8* bitcast ([8 x i32]* @reltable.ccode to i8*), i64 %10)
br label %12
12: ; preds = %8, %0
%13 = phi i8* [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), %0 ], [ %11, %8 ]
ret i8* %13
}