#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*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
main() {
  struct etohandan {
    int num;
    char eto[20];
  };
  struct etohandan year[12] = {
      {1, "申"}, {2, "酉"}, {3, "戌"}, {4, "亥"},  {5, "子"},  {6, "丑"},
      {7, "寅"}, {8, "卯"}, {9, "辰"}, {10, "巳"}, {11, "午"}, {12, "未"},
  };
  int input, eto;
  printf("西暦年を入力 ===> ");
  scanf("%d", &input);
  eto = input % 12;
  printf("%d年は%s年です。\n", input, year[eto].eto);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x130,%rsp
lea    -0x120(%rbp),%rdi
lea    0xeb7(%rip),%rsi
mov    $0x120,%edx
call   1040 <memcpy@plt>
lea    0xfc6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xfd1(%rip),%rdi
lea    -0x124(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x124(%rbp),%eax
mov    $0xc,%ecx
cltd
idiv   %ecx
mov    %edx,-0x128(%rbp)
mov    -0x124(%rbp),%esi
movslq -0x128(%rbp),%rax
lea    -0x120(%rbp),%rdx
imul   $0x18,%rax,%rax
add    %rax,%rdx
add    $0x4,%rdx
lea    0xf8e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x130,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x138,%rsp
lea    0xec2(%rip),%rsi
lea    0x10(%rsp),%rdi
mov    $0x120,%edx
call   1040 <memcpy@plt>
lea    0xfcc(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xfd7(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
movslq 0xc(%rsp),%rsi
imul   $0x2aaaaaab,%rsi,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
shr    $0x21,%rax
add    %ecx,%eax
shl    $0x2,%eax
lea    (%rax,%rax,2),%eax
mov    %esi,%ecx
sub    %eax,%ecx
movslq %ecx,%rax
lea    (%rax,%rax,2),%rax
lea    (%rsp,%rax,8),%rdx
add    $0x14,%rdx
lea    0xf97(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x138,%rsp
ret

LLVM IR (-O0):
%struct.etohandan = type { i32, [20 x i8] }
@__const.main.year = [12 x %struct.etohandan] [%struct.etohandan { i32 1, [20 x i8] c"\E7\94\B3\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00" }, %struct.etohandan { i32 2, [20 x i8] c"\E9\85\89\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00" }, %struct.etohandan { i32 3, [20 x i8] c"\E6\88\8C\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00" }, %struct.etohandan { i32 4, [20 x i8] c"\E4\BA\A5\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00" }, %struct.etohandan { i32 5, [20 x i8] c"\E5\AD\90\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00" }, %struct.etohandan { i32 6, [20 x i8] c"\E4\B8\91\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00" }, %struct.etohandan { i32 7, [20 x i8] c"\E5\AF\85\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00" }, %struct.etohandan { i32 8, [20 x i8] c"\E5\8D\AF\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00" }, %struct.etohandan { i32 9, [20 x i8] c"\E8\BE\B0\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00" }, %struct.etohandan { i32 10, [20 x i8] c"\E5\B7\B3\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00" }, %struct.etohandan { i32 11, [20 x i8] c"\E5\8D\88\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00" }, %struct.etohandan { i32 12, [20 x i8] c"\E6\9C\AA\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00" }]
@.str = [25 x i8] c"\E8\A5\BF\E6\9A\A6\E5\B9\B4\E3\82\92\E5\85\A5\E5\8A\9B ===> \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [24 x i8] c"%d\E5\B9\B4\E3\81\AF%s\E5\B9\B4\E3\81\A7\E3\81\99\E3\80\82\0A\00"
define i32 @main() {
%1 = alloca [12 x %struct.etohandan]
%2 = alloca i32
%3 = alloca i32
%4 = bitcast [12 x %struct.etohandan]* %1 to i8*
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%7 = load i32, i32* %2
%8 = srem i32 %7, 12
store i32 %8, i32* %3
%9 = load i32, i32* %2
%10 = load i32, i32* %3
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [12 x %struct.etohandan], [12 x %struct.etohandan]* %1, i64 0, i64 %11
%13 = getelementptr inbounds %struct.etohandan, %struct.etohandan* %12, i32 0, i32 1
%14 = getelementptr inbounds [20 x i8], [20 x i8]* %13, i64 0, i64 0
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i32 %9, i8* %14)
ret i32 0
}

LLVM IR (-O2):
%struct.etohandan = type { i32, [20 x i8] }
@__const.main.year = [12 x %struct.etohandan] [%struct.etohandan { i32 1, [20 x i8] c"\E7\94\B3\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00" }, %struct.etohandan { i32 2, [20 x i8] c"\E9\85\89\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00" }, %struct.etohandan { i32 3, [20 x i8] c"\E6\88\8C\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00" }, %struct.etohandan { i32 4, [20 x i8] c"\E4\BA\A5\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00" }, %struct.etohandan { i32 5, [20 x i8] c"\E5\AD\90\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00" }, %struct.etohandan { i32 6, [20 x i8] c"\E4\B8\91\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00" }, %struct.etohandan { i32 7, [20 x i8] c"\E5\AF\85\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00" }, %struct.etohandan { i32 8, [20 x i8] c"\E5\8D\AF\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00" }, %struct.etohandan { i32 9, [20 x i8] c"\E8\BE\B0\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00" }, %struct.etohandan { i32 10, [20 x i8] c"\E5\B7\B3\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00" }, %struct.etohandan { i32 11, [20 x i8] c"\E5\8D\88\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00" }, %struct.etohandan { i32 12, [20 x i8] c"\E6\9C\AA\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00" }]
@.str = [25 x i8] c"\E8\A5\BF\E6\9A\A6\E5\B9\B4\E3\82\92\E5\85\A5\E5\8A\9B ===> \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [24 x i8] c"%d\E5\B9\B4\E3\81\AF%s\E5\B9\B4\E3\81\A7\E3\81\99\E3\80\82\0A\00"
define i32 @main() {
%1 = alloca [12 x %struct.etohandan]
%2 = alloca i32
%3 = bitcast [12 x %struct.etohandan]* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%7 = load i32, i32* %2
%8 = srem i32 %7, 12
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds [12 x %struct.etohandan], [12 x %struct.etohandan]* %1, i64 0, i64 %9, i32 1, i64 0
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i32 %7, i8* %10)
ret i32 0
}