void num2mar(int num, char mar[]) {
  int ten = num / 13;
  int reminder = num % 13;
  char one_arr[13][5] = {"tret", "jan", "feb", "mar", "apr", "may", "jun",
                         "jly",  "aug", "sep", "oct", "nov", "dec"};
  char ten_arr[13][5] = {"",    "tam", "hel", "maa", "huh", "tou", "kes",
                         "hei", "elo", "syy", "lok", "mer", "jou"};
  if (ten == 0) {
    strcpy(mar, one_arr[reminder]);
  } else {
    strcpy(mar, ten_arr[ten]);
    strcat(mar, " ");
    strcat(mar, one_arr[reminder]);
  }
}


x86 assembly (clang, -O0):
<num2mar>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xd,%ecx
cltd
idiv   %ecx
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xd,%ecx
cltd
idiv   %ecx
mov    %edx,-0x18(%rbp)
lea    -0x60(%rbp),%rdi
lea    0xe97(%rip),%rsi
mov    $0x41,%edx
call   1040 <memcpy@plt>
lea    -0xb0(%rbp),%rdi
lea    0xecf(%rip),%rsi
mov    $0x41,%edx
call   1040 <memcpy@plt>
cmpl   $0x0,-0x14(%rbp)
jne    11b2 <num2mar+0x82>
mov    -0x10(%rbp),%rdi
movslq -0x18(%rbp),%rax
lea    -0x60(%rbp),%rsi
imul   $0x5,%rax,%rax
add    %rax,%rsi
call   1030 <strcpy@plt>
jmp    11f5 <num2mar+0xc5>
mov    -0x10(%rbp),%rdi
movslq -0x14(%rbp),%rax
lea    -0xb0(%rbp),%rsi
imul   $0x5,%rax,%rax
add    %rax,%rsi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%rdi
lea    0xeb9(%rip),%rsi
call   1050 <strcat@plt>
mov    -0x10(%rbp),%rdi
movslq -0x18(%rbp),%rax
lea    -0x60(%rbp),%rsi
imul   $0x5,%rax,%rax
add    %rax,%rsi
call   1050 <strcat@plt>
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<num2mar>:
push   %rbp
push   %rbx
sub    $0x98,%rsp
mov    %rsi,%rbx
movslq %edi,%rcx
imul   $0x4ec4ec4f,%rcx,%rax
mov    %rax,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rax
add    %edx,%eax
lea    (%rax,%rax,2),%edx
lea    (%rax,%rdx,4),%edx
mov    %ecx,%ebp
sub    %edx,%ebp
mov    0xedd(%rip),%dl
mov    %dl,0x40(%rsp)
movaps 0xec2(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xea6(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xe8a(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xe6e(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    0xef4(%rip),%dl
mov    %dl,0x90(%rsp)
movaps 0xed6(%rip),%xmm0
movaps %xmm0,0x80(%rsp)
movaps 0xeb7(%rip),%xmm0
movaps %xmm0,0x70(%rsp)
movaps 0xe9b(%rip),%xmm0
movaps %xmm0,0x60(%rsp)
movaps 0xe7f(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
add    $0xc,%ecx
cmp    $0x18,%ecx
ja     11f3 <num2mar+0xc3>
movslq %ebp,%rax
lea    (%rax,%rax,4),%rax
lea    (%rsp,%rax,1),%rsi
mov    %rbx,%rdi
call   1030 <strcpy@plt>
jmp    122a <num2mar+0xfa>
cltq
lea    (%rax,%rax,4),%rax
lea    (%rsp,%rax,1),%rsi
add    $0x50,%rsi
mov    %rbx,%rdi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
movw   $0x20,(%rbx,%rax,1)
movslq %ebp,%rax
lea    (%rax,%rax,4),%rax
lea    (%rsp,%rax,1),%rsi
mov    %rbx,%rdi
call   1050 <strcat@plt>
add    $0x98,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@__const.num2mar.one_arr = [13 x [5 x i8]] [[5 x i8] c"tret\00", [5 x i8] c"jan\00\00", [5 x i8] c"feb\00\00", [5 x i8] c"mar\00\00", [5 x i8] c"apr\00\00", [5 x i8] c"may\00\00", [5 x i8] c"jun\00\00", [5 x i8] c"jly\00\00", [5 x i8] c"aug\00\00", [5 x i8] c"sep\00\00", [5 x i8] c"oct\00\00", [5 x i8] c"nov\00\00", [5 x i8] c"dec\00\00"]
@__const.num2mar.ten_arr = [13 x [5 x i8]] [[5 x i8] zeroinitializer, [5 x i8] c"tam\00\00", [5 x i8] c"hel\00\00", [5 x i8] c"maa\00\00", [5 x i8] c"huh\00\00", [5 x i8] c"tou\00\00", [5 x i8] c"kes\00\00", [5 x i8] c"hei\00\00", [5 x i8] c"elo\00\00", [5 x i8] c"syy\00\00", [5 x i8] c"lok\00\00", [5 x i8] c"mer\00\00", [5 x i8] c"jou\00\00"]
@.str = [2 x i8] c" \00"
define void @num2mar(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca [13 x [5 x i8]]
%8 = alloca [13 x [5 x i8]]
store i32 %0, i32* %3
store i8* %1, i8** %4
%9 = load i32, i32* %3
%10 = sdiv i32 %9, 13
store i32 %10, i32* %5
%11 = load i32, i32* %3
%12 = srem i32 %11, 13
store i32 %12, i32* %6
%13 = bitcast [13 x [5 x i8]]* %7 to i8*
%14 = bitcast [13 x [5 x i8]]* %8 to i8*
%15 = load i32, i32* %5
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %24
17: ; preds = %2
%18 = load i8*, i8** %4
%19 = load i32, i32* %6
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [13 x [5 x i8]], [13 x [5 x i8]]* %7, i64 0, i64 %20
%22 = getelementptr inbounds [5 x i8], [5 x i8]* %21, i64 0, i64 0
%23 = call i8* @strcpy(i8* %18, i8* %22)
br label %39
24: ; preds = %2
%25 = load i8*, i8** %4
%26 = load i32, i32* %5
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [13 x [5 x i8]], [13 x [5 x i8]]* %8, i64 0, i64 %27
%29 = getelementptr inbounds [5 x i8], [5 x i8]* %28, i64 0, i64 0
%30 = call i8* @strcpy(i8* %25, i8* %29)
%31 = load i8*, i8** %4
%32 = call i8* @strcat(i8* %31, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%33 = load i8*, i8** %4
%34 = load i32, i32* %6
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds [13 x [5 x i8]], [13 x [5 x i8]]* %7, i64 0, i64 %35
%37 = getelementptr inbounds [5 x i8], [5 x i8]* %36, i64 0, i64 0
%38 = call i8* @strcat(i8* %33, i8* %37)
br label %39
39: ; preds = %24, %17
ret void
}

LLVM IR (-O2):
@__const.num2mar.one_arr = [13 x [5 x i8]] [[5 x i8] c"tret\00", [5 x i8] c"jan\00\00", [5 x i8] c"feb\00\00", [5 x i8] c"mar\00\00", [5 x i8] c"apr\00\00", [5 x i8] c"may\00\00", [5 x i8] c"jun\00\00", [5 x i8] c"jly\00\00", [5 x i8] c"aug\00\00", [5 x i8] c"sep\00\00", [5 x i8] c"oct\00\00", [5 x i8] c"nov\00\00", [5 x i8] c"dec\00\00"]
@__const.num2mar.ten_arr = [13 x [5 x i8]] [[5 x i8] zeroinitializer, [5 x i8] c"tam\00\00", [5 x i8] c"hel\00\00", [5 x i8] c"maa\00\00", [5 x i8] c"huh\00\00", [5 x i8] c"tou\00\00", [5 x i8] c"kes\00\00", [5 x i8] c"hei\00\00", [5 x i8] c"elo\00\00", [5 x i8] c"syy\00\00", [5 x i8] c"lok\00\00", [5 x i8] c"mer\00\00", [5 x i8] c"jou\00\00"]
define void @num2mar(i32 %0, i8* %1) {
%3 = alloca [13 x [5 x i8]]
%4 = alloca [13 x [5 x i8]]
%5 = srem i32 %0, 13
%6 = sdiv i32 %0, 13
%7 = getelementptr inbounds [13 x [5 x i8]], [13 x [5 x i8]]* %3, i64 0, i64 0, i64 0
%8 = getelementptr inbounds [13 x [5 x i8]], [13 x [5 x i8]]* %4, i64 0, i64 0, i64 0
%9 = add i32 %0, 12
%10 = icmp ult i32 %9, 25
br i1 %10, label %11, label %15
11: ; preds = %2
%12 = sext i32 %5 to i64
%13 = getelementptr inbounds [13 x [5 x i8]], [13 x [5 x i8]]* %3, i64 0, i64 %12, i64 0
%14 = call i8* @strcpy(i8* dereferenceable(1) %1, i8* %13)
br label %25
15: ; preds = %2
%16 = sext i32 %6 to i64
%17 = getelementptr inbounds [13 x [5 x i8]], [13 x [5 x i8]]* %4, i64 0, i64 %16, i64 0
%18 = call i8* @strcpy(i8* dereferenceable(1) %1, i8* %17)
%19 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%20 = getelementptr i8, i8* %1, i64 %19
%21 = bitcast i8* %20 to i16*
store i16 32, i16* %21
%22 = sext i32 %5 to i64
%23 = getelementptr inbounds [13 x [5 x i8]], [13 x [5 x i8]]* %3, i64 0, i64 %22, i64 0
%24 = call i8* @strcat(i8* dereferenceable(1) %1, i8* %23)
br label %25
25: ; preds = %15, %11
ret void
}