#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 *calloc(int, int);
int *trans_to_calib(const short *trans) {
  int *calib = calloc(18, sizeof(int));
  int i = 0;
  for (i = 0; i < 9; ++i) {
    calib[i * 2] = trans[i];
    calib[(i * 2) + 1] = 10000;
  }
  return calib;
}


x86 assembly (clang, -O0):
<trans_to_calib>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x12,%edi
mov    $0x4,%esi
call   1030 <calloc@plt>
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x9,-0x14(%rbp)
jge    1188 <trans_to_calib+0x78>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movswl (%rax,%rcx,2),%edx
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
shl    $0x1,%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
shl    $0x1,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movl   $0x2710,(%rax,%rcx,4)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    113d <trans_to_calib+0x2d>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<trans_to_calib>:
push   %rbx
mov    %rdi,%rbx
mov    $0x12,%edi
mov    $0x4,%esi
call   1030 <calloc@plt>
movswl (%rbx),%ecx
mov    %ecx,(%rax)
movl   $0x2710,0x4(%rax)
movswl 0x2(%rbx),%ecx
mov    %ecx,0x8(%rax)
movl   $0x2710,0xc(%rax)
movswl 0x4(%rbx),%ecx
mov    %ecx,0x10(%rax)
movl   $0x2710,0x14(%rax)
movswl 0x6(%rbx),%ecx
mov    %ecx,0x18(%rax)
movl   $0x2710,0x1c(%rax)
movswl 0x8(%rbx),%ecx
mov    %ecx,0x20(%rax)
movl   $0x2710,0x24(%rax)
movswl 0xa(%rbx),%ecx
mov    %ecx,0x28(%rax)
movl   $0x2710,0x2c(%rax)
movswl 0xc(%rbx),%ecx
mov    %ecx,0x30(%rax)
movl   $0x2710,0x34(%rax)
movswl 0xe(%rbx),%ecx
mov    %ecx,0x38(%rax)
movl   $0x2710,0x3c(%rax)
movswl 0x10(%rbx),%ecx
mov    %ecx,0x40(%rax)
movl   $0x2710,0x44(%rax)
pop    %rbx
ret

LLVM IR (-O0):
define i32* @trans_to_calib(i16* %0) {
%2 = alloca i16*
%3 = alloca i32*
%4 = alloca i32
store i16* %0, i16** %2
%5 = call i32* @calloc(i32 18, i32 4)
store i32* %5, i32** %3
store i32 0, i32* %4
store i32 0, i32* %4
br label %6
6: ; preds = %27, %1
%7 = load i32, i32* %4
%8 = icmp slt i32 %7, 9
br i1 %8, label %9, label %30
9: ; preds = %6
%10 = load i16*, i16** %2
%11 = load i32, i32* %4
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds i16, i16* %10, i64 %12
%14 = load i16, i16* %13
%15 = sext i16 %14 to i32
%16 = load i32*, i32** %3
%17 = load i32, i32* %4
%18 = mul nsw i32 %17, 2
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i32, i32* %16, i64 %19
store i32 %15, i32* %20
%21 = load i32*, i32** %3
%22 = load i32, i32* %4
%23 = mul nsw i32 %22, 2
%24 = add nsw i32 %23, 1
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i32, i32* %21, i64 %25
store i32 10000, i32* %26
br label %27
27: ; preds = %9
%28 = load i32, i32* %4
%29 = add nsw i32 %28, 1
store i32 %29, i32* %4
br label %6
30: ; preds = %6
%31 = load i32*, i32** %3
ret i32* %31
}

LLVM IR (-O2):
define noalias i32* @trans_to_calib(i16* nocapture %0) {
%2 = tail call i32* @calloc(i32 18, i32 4)
%3 = load i16, i16* %0
%4 = sext i16 %3 to i32
store i32 %4, i32* %2
%5 = getelementptr inbounds i32, i32* %2, i64 1
store i32 10000, i32* %5
%6 = getelementptr inbounds i16, i16* %0, i64 1
%7 = load i16, i16* %6
%8 = sext i16 %7 to i32
%9 = getelementptr inbounds i32, i32* %2, i64 2
store i32 %8, i32* %9
%10 = getelementptr inbounds i32, i32* %2, i64 3
store i32 10000, i32* %10
%11 = getelementptr inbounds i16, i16* %0, i64 2
%12 = load i16, i16* %11
%13 = sext i16 %12 to i32
%14 = getelementptr inbounds i32, i32* %2, i64 4
store i32 %13, i32* %14
%15 = getelementptr inbounds i32, i32* %2, i64 5
store i32 10000, i32* %15
%16 = getelementptr inbounds i16, i16* %0, i64 3
%17 = load i16, i16* %16
%18 = sext i16 %17 to i32
%19 = getelementptr inbounds i32, i32* %2, i64 6
store i32 %18, i32* %19
%20 = getelementptr inbounds i32, i32* %2, i64 7
store i32 10000, i32* %20
%21 = getelementptr inbounds i16, i16* %0, i64 4
%22 = load i16, i16* %21
%23 = sext i16 %22 to i32
%24 = getelementptr inbounds i32, i32* %2, i64 8
store i32 %23, i32* %24
%25 = getelementptr inbounds i32, i32* %2, i64 9
store i32 10000, i32* %25
%26 = getelementptr inbounds i16, i16* %0, i64 5
%27 = load i16, i16* %26
%28 = sext i16 %27 to i32
%29 = getelementptr inbounds i32, i32* %2, i64 10
store i32 %28, i32* %29
%30 = getelementptr inbounds i32, i32* %2, i64 11
store i32 10000, i32* %30
%31 = getelementptr inbounds i16, i16* %0, i64 6
%32 = load i16, i16* %31
%33 = sext i16 %32 to i32
%34 = getelementptr inbounds i32, i32* %2, i64 12
store i32 %33, i32* %34
%35 = getelementptr inbounds i32, i32* %2, i64 13
store i32 10000, i32* %35
%36 = getelementptr inbounds i16, i16* %0, i64 7
%37 = load i16, i16* %36
%38 = sext i16 %37 to i32
%39 = getelementptr inbounds i32, i32* %2, i64 14
store i32 %38, i32* %39
%40 = getelementptr inbounds i32, i32* %2, i64 15
store i32 10000, i32* %40
%41 = getelementptr inbounds i16, i16* %0, i64 8
%42 = load i16, i16* %41
%43 = sext i16 %42 to i32
%44 = getelementptr inbounds i32, i32* %2, i64 16
store i32 %43, i32* %44
%45 = getelementptr inbounds i32, i32* %2, i64 17
store i32 10000, i32* %45
ret i32* %2
}