#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ SEEK_SET;
int /*<<< orphan*/ fread(unsigned short *, int, unsigned short,
                         int /*<<< orphan*/ *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int, int /*<<< orphan*/);
scalar_t__ malloc(int);
int /*<<< orphan*/ unicode2utf8str(unsigned short *, unsigned short, char *);
void mkpydict(FILE *in, char *pydict[]) {
  int i;
  unsigned short addr, size, code[6];
  char *p;
  fseek(in, 0x1544, SEEK_SET);
  for (i = 0; i < 413; i++) {
    p = (char *)malloc(7);
    fread(&addr, 2, 1, in);
    fread(&size, 2, 1, in);
    fread(code, 2, size / 2, in);
    unicode2utf8str(code, size / 2, p);
    pydict[addr] = p;
  }
}


x86 assembly (clang, -O0):
<mkpydict>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2e85(%rip),%rax
mov    (%rax),%edx
mov    $0x1544,%esi
call   1050 <fseek@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0x19d,-0x14(%rbp)
jge    1212 <mkpydict+0xd2>
mov    $0x7,%edi
call   1040 <malloc@plt>
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%rcx
lea    -0x16(%rbp),%rdi
mov    $0x2,%esi
mov    $0x1,%edx
call   1030 <fread@plt>
mov    -0x8(%rbp),%rcx
lea    -0x18(%rbp),%rdi
mov    $0x2,%esi
mov    $0x1,%edx
call   1030 <fread@plt>
lea    -0x24(%rbp),%rdi
movzwl -0x18(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    -0x8(%rbp),%rcx
mov    $0x2,%esi
movzwl %ax,%edx
call   1030 <fread@plt>
lea    -0x24(%rbp),%rdi
movzwl -0x18(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    -0x30(%rbp),%rdx
movzwl %ax,%esi
call   1060 <unicode2utf8str@plt>
mov    -0x30(%rbp),%rdx
mov    -0x10(%rbp),%rax
movzwl -0x16(%rbp),%ecx
mov    %rdx,(%rax,%rcx,8)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    116e <mkpydict+0x2e>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mkpydict>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
mov    0x2e85(%rip),%rax
mov    (%rax),%edx
mov    $0x1544,%esi
call   1050 <fseek@plt>
mov    $0x19d,%r12d
lea    0xc(%rsp),%r13
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0x7,%edi
call   1040 <malloc@plt>
mov    %rax,%rbp
lea    0xa(%rsp),%rdi
mov    $0x2,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1030 <fread@plt>
lea    0x8(%rsp),%rdi
mov    $0x2,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1030 <fread@plt>
movzwl 0x8(%rsp),%r15d
shr    %r15d
mov    %r13,%rdi
mov    $0x2,%esi
mov    %r15d,%edx
mov    %rbx,%rcx
call   1030 <fread@plt>
mov    %r13,%rdi
mov    %r15d,%esi
mov    %rbp,%rdx
call   1060 <unicode2utf8str@plt>
movzwl 0xa(%rsp),%eax
mov    %rbp,(%r14,%rax,8)
add    $0xffffffff,%r12d
jne    1180 <mkpydict+0x40>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@SEEK_SET = global i32 0
define void @mkpydict(i32* %0, i8** %1) {
%3 = alloca i32*
%4 = alloca i8**
%5 = alloca i32
%6 = alloca i16
%7 = alloca i16
%8 = alloca [6 x i16]
%9 = alloca i8*
store i32* %0, i32** %3
store i8** %1, i8*** %4
%10 = load i32*, i32** %3
%11 = load i32, i32* @SEEK_SET
%12 = call i32 @fseek(i32* %10, i32 5444, i32 %11)
store i32 0, i32* %5
br label %13
13: ; preds = %42, %2
%14 = load i32, i32* %5
%15 = icmp slt i32 %14, 413
br i1 %15, label %16, label %45
16: ; preds = %13
%17 = call i64 @malloc(i32 7)
%18 = inttoptr i64 %17 to i8*
store i8* %18, i8** %9
%19 = load i32*, i32** %3
%20 = call i32 @fread(i16* %6, i32 2, i16 zeroext 1, i32* %19)
%21 = load i32*, i32** %3
%22 = call i32 @fread(i16* %7, i32 2, i16 zeroext 1, i32* %21)
%23 = getelementptr inbounds [6 x i16], [6 x i16]* %8, i64 0, i64 0
%24 = load i16, i16* %7
%25 = zext i16 %24 to i32
%26 = sdiv i32 %25, 2
%27 = trunc i32 %26 to i16
%28 = load i32*, i32** %3
%29 = call i32 @fread(i16* %23, i32 2, i16 zeroext %27, i32* %28)
%30 = getelementptr inbounds [6 x i16], [6 x i16]* %8, i64 0, i64 0
%31 = load i16, i16* %7
%32 = zext i16 %31 to i32
%33 = sdiv i32 %32, 2
%34 = trunc i32 %33 to i16
%35 = load i8*, i8** %9
%36 = call i32 @unicode2utf8str(i16* %30, i16 zeroext %34, i8* %35)
%37 = load i8*, i8** %9
%38 = load i8**, i8*** %4
%39 = load i16, i16* %6
%40 = zext i16 %39 to i64
%41 = getelementptr inbounds i8*, i8** %38, i64 %40
store i8* %37, i8** %41
br label %42
42: ; preds = %16
%43 = load i32, i32* %5
%44 = add nsw i32 %43, 1
store i32 %44, i32* %5
br label %13
45: ; preds = %13
ret void
}

LLVM IR (-O2):
@SEEK_SET = global i32 0
define void @mkpydict(i32* nocapture %0, i8** nocapture writeonly %1) {
%3 = alloca i16
%4 = alloca i16
%5 = alloca [6 x i16]
%6 = bitcast i16* %3 to i8*
%7 = bitcast i16* %4 to i8*
%8 = bitcast [6 x i16]* %5 to i8*
%9 = load i32, i32* @SEEK_SET
%10 = tail call i32 @fseek(i32* %0, i32 5444, i32 %9)
%11 = getelementptr inbounds [6 x i16], [6 x i16]* %5, i64 0, i64 0
br label %12
12: ; preds = %2, %12
%13 = phi i32 [ 0, %2 ], [ %25, %12 ]
%14 = call i64 @malloc(i32 7)
%15 = inttoptr i64 %14 to i8*
%16 = call i32 @fread(i16* %3, i32 2, i16 zeroext 1, i32* %0)
%17 = call i32 @fread(i16* %4, i32 2, i16 zeroext 1, i32* %0)
%18 = load i16, i16* %4
%19 = lshr i16 %18, 1
%20 = call i32 @fread(i16* %11, i32 2, i16 zeroext %19, i32* %0)
%21 = call i32 @unicode2utf8str(i16* %11, i16 zeroext %19, i8* %15)
%22 = load i16, i16* %3
%23 = zext i16 %22 to i64
%24 = getelementptr inbounds i8*, i8** %1, i64 %23
store i8* %15, i8** %24
%25 = add nuw nsw i32 %13, 1
%26 = icmp eq i32 %25, 413
br i1 %26, label %27, label %12
27: ; preds = %12
ret void
}