#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*/ EXIT_FAILURE;
scalar_t__ calloc(int, int);
int /*<<< orphan*/ exit_mem(int /*<<< orphan*/, char *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ free(char *);
char *getenv(char *);
int /*<<< orphan*/ mkdir(char *, int);
int /*<<< orphan*/ printf(char *);
scalar_t__ realloc(char *, int);
int /*<<< orphan*/ remove(char *);
int /*<<< orphan*/ sprintf(char *, char *, char *);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
scalar_t__ system(char *);
FILE *load_edict(bool is_edict) {
  char *homediredict = NULL;
  FILE *edict;
  char *wgetstring = NULL;
  if (is_edict)
    edict = fopen("/usr/share/edict/edict", "r");
  else
    edict = fopen("/usr/share/edict/kanjidic", "r");
  if (!edict) {
    if (is_edict)
      homediredict = (char *)calloc(
          (strlen(getenv("HOME")) + strlen("/.himitsu/edict")) + 1,
          sizeof(char));
    else
      homediredict = (char *)calloc(
          (strlen(getenv("HOME")) + strlen("/.himitsu/kanjidic")) + 1,
          sizeof(char));
    strcpy(homediredict, getenv("HOME"));
    strcat(homediredict, "/.himitsu");
    edict = fopen(homediredict, "r");
    if (!edict)
      mkdir(homediredict, 0755);
    else
      fclose(edict);
    if (is_edict)
      strcat(homediredict, "/edict");
    else
      strcat(homediredict, "/kanjidic");
    edict = fopen(homediredict, "r");
    if (!edict) {
      if (is_edict) {
        wgetstring = (char *)calloc(
            strlen("wget http://ftp.monash.edu.au/pub/nihongo/edict -O %s") +
                strlen(homediredict),
            sizeof(char));
        sprintf(wgetstring,
                "wget http://ftp.monash.edu.au/pub/nihongo/edict -O %s",
                homediredict);
        printf("It seems that edict isn't in the system. Downloading...\n\n");
      } else {
        wgetstring = (char *)calloc(
            strlen("wget http://ftp.monash.edu.au/pub/nihongo/kanjidic -O %s") +
                strlen(homediredict),
            sizeof(char));
        sprintf(wgetstring,
                "wget http://ftp.monash.edu.au/pub/nihongo/kanjidic -O %s",
                homediredict);
        printf(
            "It seems that kanjidic isn't in the system. Downloading...\n\n");
      }
      if (system(wgetstring) != 0) {
        remove(homediredict);
        homediredict = (char *)realloc(
            homediredict, (strlen(homediredict) + strlen(" not found...") + 1) *
                              sizeof(char));
        strcat(homediredict, " not found...");
        exit_mem(EXIT_FAILURE, homediredict);
      } else
        edict = fopen(homediredict, "r");
    }
  }
  if (homediredict) {
    free(homediredict);
    homediredict = NULL;
  }
  return edict;
}


x86 assembly (clang, -O0):
<load_edict>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %edi,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
movq   $0x0,-0x20(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1231 <load_edict+0x41>
lea    0xde4(%rip),%rdi
lea    0xdf4(%rip),%rsi
call   10f0 <fopen@plt>
mov    %rax,-0x18(%rbp)
jmp    1248 <load_edict+0x58>
lea    0xde1(%rip),%rdi
lea    0xdd8(%rip),%rsi
call   10f0 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    14d2 <load_edict+0x2e2>
cmpl   $0x0,-0x4(%rbp)
je     129b <load_edict+0xab>
lea    0xdcf(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,%rdi
call   10a0 <strlen@plt>
mov    %eax,-0x24(%rbp)
lea    0xdbd(%rip),%rdi
call   10a0 <strlen@plt>
mov    -0x24(%rbp),%edi
add    %eax,%edi
add    $0x1,%edi
mov    $0x1,%esi
call   10d0 <calloc@plt>
mov    %rax,-0x10(%rbp)
jmp    12d4 <load_edict+0xe4>
lea    0xd91(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,%rdi
call   10a0 <strlen@plt>
mov    %eax,-0x28(%rbp)
lea    0xd8f(%rip),%rdi
call   10a0 <strlen@plt>
mov    -0x28(%rbp),%edi
add    %eax,%edi
add    $0x1,%edi
mov    $0x1,%esi
call   10d0 <calloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x30(%rbp)
lea    0xd50(%rip),%rdi
call   1030 <getenv@plt>
mov    -0x30(%rbp),%rdi
mov    %rax,%rsi
call   1070 <strcpy@plt>
mov    -0x10(%rbp),%rdi
lea    0xd5c(%rip),%rsi
call   1100 <strcat@plt>
mov    -0x10(%rbp),%rdi
lea    0xd08(%rip),%rsi
call   10f0 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1336 <load_edict+0x146>
mov    -0x10(%rbp),%rdi
mov    $0x1ed,%esi
call   1080 <mkdir@plt>
jmp    133f <load_edict+0x14f>
mov    -0x18(%rbp),%rdi
call   1090 <fclose@plt>
cmpl   $0x0,-0x4(%rbp)
je     135e <load_edict+0x16e>
mov    -0x10(%rbp),%rdi
lea    0xcbc(%rip),%rsi
call   1100 <strcat@plt>
jmp    136e <load_edict+0x17e>
mov    -0x10(%rbp),%rdi
lea    0xcc0(%rip),%rsi
call   1100 <strcat@plt>
mov    -0x10(%rbp),%rdi
lea    0xc9e(%rip),%rsi
call   10f0 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    14cd <load_edict+0x2dd>
cmpl   $0x0,-0x4(%rbp)
je     13e7 <load_edict+0x1f7>
lea    0xcc7(%rip),%rdi
call   10a0 <strlen@plt>
mov    %eax,-0x34(%rbp)
mov    -0x10(%rbp),%rdi
call   10a0 <strlen@plt>
mov    -0x34(%rbp),%edi
add    %eax,%edi
mov    $0x1,%esi
call   10d0 <calloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xc94(%rip),%rsi
call   1110 <sprintf@plt>
lea    0xcbe(%rip),%rdi
call   10c0 <printf@plt>
jmp    1432 <load_edict+0x242>
lea    0xce7(%rip),%rdi
call   10a0 <strlen@plt>
mov    %eax,-0x38(%rbp)
mov    -0x10(%rbp),%rdi
call   10a0 <strlen@plt>
mov    -0x38(%rbp),%edi
add    %eax,%edi
mov    $0x1,%esi
call   10d0 <calloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xcb4(%rip),%rsi
call   1110 <sprintf@plt>
lea    0xce1(%rip),%rdi
call   10c0 <printf@plt>
mov    -0x20(%rbp),%rdi
call   10b0 <system@plt>
cmp    $0x0,%rax
je     14b4 <load_edict+0x2c4>
mov    -0x10(%rbp),%rdi
call   1060 <remove@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x10(%rbp),%rdi
call   10a0 <strlen@plt>
mov    %eax,-0x3c(%rbp)
lea    0xce2(%rip),%rdi
call   10a0 <strlen@plt>
mov    -0x48(%rbp),%rdi
mov    %eax,%ecx
mov    -0x3c(%rbp),%eax
add    %ecx,%eax
add    $0x1,%eax
cltq
shl    $0x0,%rax
mov    %eax,%esi
call   10e0 <realloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xcb3(%rip),%rsi
call   1100 <strcat@plt>
mov    0x2b3c(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rsi
call   1050 <exit_mem@plt>
jmp    14c8 <load_edict+0x2d8>
mov    -0x10(%rbp),%rdi
lea    0xb58(%rip),%rsi
call   10f0 <fopen@plt>
mov    %rax,-0x18(%rbp)
jmp    14cd <load_edict+0x2dd>
jmp    14d2 <load_edict+0x2e2>
cmpq   $0x0,-0x10(%rbp)
je     14ee <load_edict+0x2fe>
mov    -0x10(%rbp),%rdi
call   1040 <free@plt>
movq   $0x0,-0x10(%rbp)
mov    -0x18(%rbp),%rax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<load_edict>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebp
test   %edi,%edi
je     1225 <load_edict+0x35>
lea    0xdfc(%rip),%rdi
lea    0xe0c(%rip),%rsi
call   10f0 <fopen@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1428 <load_edict+0x238>
lea    0xe15(%rip),%r14
jmp    124b <load_edict+0x5b>
lea    0xded(%rip),%rdi
lea    0xde4(%rip),%rsi
call   10f0 <fopen@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1428 <load_edict+0x238>
lea    0xdfd(%rip),%r14
lea    0xde1(%rip),%r15
mov    %r15,%rdi
call   1030 <getenv@plt>
mov    %rax,%rdi
call   10b0 <strlen@plt>
mov    %eax,%ebx
mov    %r14,%rdi
call   10b0 <strlen@plt>
lea    (%rbx,%rax,1),%edi
add    $0x1,%edi
mov    $0x1,%esi
call   10d0 <calloc@plt>
mov    %rax,%r14
mov    %r15,%rdi
call   1030 <getenv@plt>
mov    %r14,%rdi
mov    %rax,%rsi
call   1070 <strcpy@plt>
lea    0xdc2(%rip),%rsi
mov    %r14,%rdi
call   1100 <strcat@plt>
lea    0xd6f(%rip),%rsi
mov    %r14,%rdi
call   10f0 <fopen@plt>
test   %rax,%rax
je     1329 <load_edict+0x139>
mov    %rax,%rdi
call   10a0 <fclose@plt>
test   %ebp,%ebp
je     133a <load_edict+0x14a>
lea    0xd48(%rip),%rsi
mov    %r14,%rdi
call   1100 <strcat@plt>
lea    0xd40(%rip),%rsi
mov    %r14,%rdi
call   10f0 <fopen@plt>
test   %rax,%rax
jne    1418 <load_edict+0x228>
lea    0xd76(%rip),%rbp
mov    %rbp,%rdi
call   10b0 <strlen@plt>
mov    %eax,%ebx
mov    %r14,%rdi
call   10b0 <strlen@plt>
add    %eax,%ebx
mov    %ebx,%edi
mov    $0x1,%esi
call   10d0 <calloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %rbp,%rsi
mov    %r14,%rdx
call   1110 <sprintf@plt>
lea    0xdf7(%rip),%rdi
jmp    13a0 <load_edict+0x1b0>
mov    %r14,%rdi
mov    $0x1ed,%esi
call   1080 <mkdir@plt>
test   %ebp,%ebp
jne    12c1 <load_edict+0xd1>
lea    0xce8(%rip),%rsi
mov    %r14,%rdi
call   1100 <strcat@plt>
lea    0xcc7(%rip),%rsi
mov    %r14,%rdi
call   10f0 <fopen@plt>
test   %rax,%rax
jne    1418 <load_edict+0x228>
lea    0xd33(%rip),%rbp
mov    %rbp,%rdi
call   10b0 <strlen@plt>
mov    %eax,%ebx
mov    %r14,%rdi
call   10b0 <strlen@plt>
add    %eax,%ebx
mov    %ebx,%edi
mov    $0x1,%esi
call   10d0 <calloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %rbp,%rsi
mov    %r14,%rdx
call   1110 <sprintf@plt>
lea    0xd42(%rip),%rdi
call   1090 <puts@plt>
mov    %rbx,%rdi
call   10c0 <system@plt>
test   %rax,%rax
je     1409 <load_edict+0x219>
mov    %r14,%rdi
call   1060 <remove@plt>
mov    %r14,%rdi
call   10b0 <strlen@plt>
mov    %eax,%ebx
lea    0xd09(%rip),%rbp
mov    %rbp,%rdi
call   10b0 <strlen@plt>
lea    (%rbx,%rax,1),%esi
add    $0x1,%esi
mov    %r14,%rdi
call   10e0 <realloc@plt>
mov    %rax,%r14
mov    %rax,%rdi
mov    %rbp,%rsi
call   1100 <strcat@plt>
mov    0x2bea(%rip),%rax
mov    (%rax),%edi
mov    %r14,%rsi
call   1050 <exit_mem@plt>
xor    %ebx,%ebx
test   %r14,%r14
jne    1420 <load_edict+0x230>
jmp    1428 <load_edict+0x238>
lea    0xc07(%rip),%rsi
mov    %r14,%rdi
call   10f0 <fopen@plt>
mov    %rax,%rbx
test   %r14,%r14
je     1428 <load_edict+0x238>
mov    %r14,%rdi
call   1040 <free@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [23 x i8] c"/usr/share/edict/edict\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [26 x i8] c"/usr/share/edict/kanjidic\00"
@.str.3 = [5 x i8] c"HOME\00"
@.str.4 = [16 x i8] c"/.himitsu/edict\00"
@.str.5 = [19 x i8] c"/.himitsu/kanjidic\00"
@.str.6 = [10 x i8] c"/.himitsu\00"
@.str.7 = [7 x i8] c"/edict\00"
@.str.8 = [10 x i8] c"/kanjidic\00"
@.str.9 = [54 x i8] c"wget http://ftp.monash.edu.au/pub/nihongo/edict -O %s\00"
@.str.10 = [58 x i8] c"It seems that edict isn't in the system. Downloading...\0A\0A\00"
@.str.11 = [57 x i8] c"wget http://ftp.monash.edu.au/pub/nihongo/kanjidic -O %s\00"
@.str.12 = [61 x i8] c"It seems that kanjidic isn't in the system. Downloading...\0A\0A\00"
@.str.13 = [14 x i8] c" not found...\00"
@EXIT_FAILURE = global i32 0
define i32* @load_edict(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32*
%5 = alloca i8*
store i32 %0, i32* %2
store i8* null, i8** %3
store i8* null, i8** %5
%6 = load i32, i32* %2
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = call i32* @fopen(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %9, i32** %4
br label %12
10: ; preds = %1
%11 = call i32* @fopen(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %11, i32** %4
br label %12
12: ; preds = %10, %8
%13 = load i32*, i32** %4
%14 = icmp ne i32* %13, null
br i1 %14, label %117, label %15
15: ; preds = %12
%16 = load i32, i32* %2
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %26
18: ; preds = %15
%19 = call i8* @getenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%20 = call i32 @strlen(i8* %19)
%21 = call i32 @strlen(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0))
%22 = add nsw i32 %20, %21
%23 = add nsw i32 %22, 1
%24 = call i64 @calloc(i32 %23, i32 1)
%25 = inttoptr i64 %24 to i8*
store i8* %25, i8** %3
br label %34
26: ; preds = %15
%27 = call i8* @getenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%28 = call i32 @strlen(i8* %27)
%29 = call i32 @strlen(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0))
%30 = add nsw i32 %28, %29
%31 = add nsw i32 %30, 1
%32 = call i64 @calloc(i32 %31, i32 1)
%33 = inttoptr i64 %32 to i8*
store i8* %33, i8** %3
br label %34
34: ; preds = %26, %18
%35 = load i8*, i8** %3
%36 = call i8* @getenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%37 = call i32 @strcpy(i8* %35, i8* %36)
%38 = load i8*, i8** %3
%39 = call i32 @strcat(i8* %38, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0))
%40 = load i8*, i8** %3
%41 = call i32* @fopen(i8* %40, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %41, i32** %4
%42 = load i32*, i32** %4
%43 = icmp ne i32* %42, null
br i1 %43, label %47, label %44
44: ; preds = %34
%45 = load i8*, i8** %3
%46 = call i32 @mkdir(i8* %45, i32 493)
br label %50
47: ; preds = %34
%48 = load i32*, i32** %4
%49 = call i32 @fclose(i32* %48)
br label %50
50: ; preds = %47, %44
%51 = load i32, i32* %2
%52 = icmp ne i32 %51, 0
br i1 %52, label %53, label %56
53: ; preds = %50
%54 = load i8*, i8** %3
%55 = call i32 @strcat(i8* %54, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0))
br label %59
56: ; preds = %50
%57 = load i8*, i8** %3
%58 = call i32 @strcat(i8* %57, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0))
br label %59
59: ; preds = %56, %53
%60 = load i8*, i8** %3
%61 = call i32* @fopen(i8* %60, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %61, i32** %4
%62 = load i32*, i32** %4
%63 = icmp ne i32* %62, null
br i1 %63, label %116, label %64
64: ; preds = %59
%65 = load i32, i32* %2
%66 = icmp ne i32 %65, 0
br i1 %66, label %67, label %78
67: ; preds = %64
%68 = call i32 @strlen(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.9, i64 0, i64 0))
%69 = load i8*, i8** %3
%70 = call i32 @strlen(i8* %69)
%71 = add nsw i32 %68, %70
%72 = call i64 @calloc(i32 %71, i32 1)
%73 = inttoptr i64 %72 to i8*
store i8* %73, i8** %5
%74 = load i8*, i8** %5
%75 = load i8*, i8** %3
%76 = call i32 @sprintf(i8* %74, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.9, i64 0, i64 0), i8* %75)
%77 = call i32 @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.10, i64 0, i64 0))
br label %89
78: ; preds = %64
%79 = call i32 @strlen(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.11, i64 0, i64 0))
%80 = load i8*, i8** %3
%81 = call i32 @strlen(i8* %80)
%82 = add nsw i32 %79, %81
%83 = call i64 @calloc(i32 %82, i32 1)
%84 = inttoptr i64 %83 to i8*
store i8* %84, i8** %5
%85 = load i8*, i8** %5
%86 = load i8*, i8** %3
%87 = call i32 @sprintf(i8* %85, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.11, i64 0, i64 0), i8* %86)
%88 = call i32 @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.12, i64 0, i64 0))
br label %89
89: ; preds = %78, %67
%90 = load i8*, i8** %5
%91 = call i64 @system(i8* %90)
%92 = icmp ne i64 %91, 0
br i1 %92, label %93, label %112
93: ; preds = %89
%94 = load i8*, i8** %3
%95 = call i32 @remove(i8* %94)
%96 = load i8*, i8** %3
%97 = load i8*, i8** %3
%98 = call i32 @strlen(i8* %97)
%99 = call i32 @strlen(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.13, i64 0, i64 0))
%100 = add nsw i32 %98, %99
%101 = add nsw i32 %100, 1
%102 = sext i32 %101 to i64
%103 = mul i64 %102, 1
%104 = trunc i64 %103 to i32
%105 = call i64 @realloc(i8* %96, i32 %104)
%106 = inttoptr i64 %105 to i8*
store i8* %106, i8** %3
%107 = load i8*, i8** %3
%108 = call i32 @strcat(i8* %107, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.13, i64 0, i64 0))
%109 = load i32, i32* @EXIT_FAILURE
%110 = load i8*, i8** %3
%111 = call i32 @exit_mem(i32 %109, i8* %110)
br label %115
112: ; preds = %89
%113 = load i8*, i8** %3
%114 = call i32* @fopen(i8* %113, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %114, i32** %4
br label %115
115: ; preds = %112, %93
br label %116
116: ; preds = %115, %59
br label %117
117: ; preds = %116, %12
%118 = load i8*, i8** %3
%119 = icmp ne i8* %118, null
br i1 %119, label %120, label %123
120: ; preds = %117
%121 = load i8*, i8** %3
%122 = call i32 @free(i8* %121)
store i8* null, i8** %3
br label %123
123: ; preds = %120, %117
%124 = load i32*, i32** %4
ret i32* %124
}

LLVM IR (-O2):
@.str = [23 x i8] c"/usr/share/edict/edict\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [26 x i8] c"/usr/share/edict/kanjidic\00"
@.str.3 = [5 x i8] c"HOME\00"
@.str.4 = [16 x i8] c"/.himitsu/edict\00"
@.str.5 = [19 x i8] c"/.himitsu/kanjidic\00"
@.str.6 = [10 x i8] c"/.himitsu\00"
@.str.7 = [7 x i8] c"/edict\00"
@.str.8 = [10 x i8] c"/kanjidic\00"
@.str.9 = [54 x i8] c"wget http://ftp.monash.edu.au/pub/nihongo/edict -O %s\00"
@.str.11 = [57 x i8] c"wget http://ftp.monash.edu.au/pub/nihongo/kanjidic -O %s\00"
@.str.13 = [14 x i8] c" not found...\00"
@EXIT_FAILURE = global i32 0
@str = [60 x i8] c"It seems that kanjidic isn't in the system. Downloading...\0A\00"
@str.14 = [57 x i8] c"It seems that edict isn't in the system. Downloading...\0A\00"
define i32* @load_edict(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %3, label %6
3: ; preds = %1
%4 = tail call i32* @fopen(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%5 = icmp eq i32* %4, null
br i1 %5, label %9, label %75
6: ; preds = %1
%7 = tail call i32* @fopen(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%8 = icmp eq i32* %7, null
br i1 %8, label %9, label %75
9: ; preds = %3, %6
%10 = phi i8* [ getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), %6 ], [ getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), %3 ]
%11 = tail call i8* @getenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%12 = tail call i32 @strlen(i8* %11)
%13 = tail call i32 @strlen(i8* %10)
%14 = add i32 %12, 1
%15 = add i32 %14, %13
%16 = tail call i64 @calloc(i32 %15, i32 1)
%17 = inttoptr i64 %16 to i8*
%18 = tail call i8* @getenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%19 = tail call i32 @strcpy(i8* %17, i8* %18)
%20 = tail call i32 @strcat(i8* %17, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0))
%21 = tail call i32* @fopen(i8* %17, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%22 = icmp eq i32* %21, null
br i1 %22, label %23, label %25
23: ; preds = %9
%24 = tail call i32 @mkdir(i8* %17, i32 493)
br label %27
25: ; preds = %9
%26 = tail call i32 @fclose(i32* %21)
br label %27
27: ; preds = %25, %23
br i1 %2, label %28, label %32
28: ; preds = %27
%29 = tail call i32 @strcat(i8* %17, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0))
%30 = tail call i32* @fopen(i8* %17, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%31 = icmp eq i32* %30, null
br i1 %31, label %43, label %69
32: ; preds = %27
%33 = tail call i32 @strcat(i8* %17, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0))
%34 = tail call i32* @fopen(i8* %17, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%35 = icmp eq i32* %34, null
br i1 %35, label %36, label %69
36: ; preds = %32
%37 = tail call i32 @strlen(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.9, i64 0, i64 0))
%38 = tail call i32 @strlen(i8* %17)
%39 = add nsw i32 %38, %37
%40 = tail call i64 @calloc(i32 %39, i32 1)
%41 = inttoptr i64 %40 to i8*
%42 = tail call i32 @sprintf(i8* dereferenceable(1) %41, i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @.str.9, i64 0, i64 0), i8* %17)
br label %50
43: ; preds = %28
%44 = tail call i32 @strlen(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.11, i64 0, i64 0))
%45 = tail call i32 @strlen(i8* %17)
%46 = add nsw i32 %45, %44
%47 = tail call i64 @calloc(i32 %46, i32 1)
%48 = inttoptr i64 %47 to i8*
%49 = tail call i32 @sprintf(i8* dereferenceable(1) %48, i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @.str.11, i64 0, i64 0), i8* %17)
br label %50
50: ; preds = %43, %36
%51 = phi i8* [ getelementptr inbounds ([60 x i8], [60 x i8]* @str, i64 0, i64 0), %43 ], [ getelementptr inbounds ([57 x i8], [57 x i8]* @str.14, i64 0, i64 0), %36 ]
%52 = phi i8* [ %48, %43 ], [ %41, %36 ]
%53 = tail call i32 @puts(i8* dereferenceable(1) %51)
%54 = tail call i64 @system(i8* %52)
%55 = icmp eq i64 %54, 0
br i1 %55, label %67, label %56
56: ; preds = %50
%57 = tail call i32 @remove(i8* %17)
%58 = tail call i32 @strlen(i8* %17)
%59 = tail call i32 @strlen(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.13, i64 0, i64 0))
%60 = add i32 %58, 1
%61 = add i32 %60, %59
%62 = tail call i64 @realloc(i8* %17, i32 %61)
%63 = inttoptr i64 %62 to i8*
%64 = tail call i32 @strcat(i8* %63, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.13, i64 0, i64 0))
%65 = load i32, i32* @EXIT_FAILURE
%66 = tail call i32 @exit_mem(i32 %65, i8* %63)
br label %69
67: ; preds = %50
%68 = tail call i32* @fopen(i8* %17, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %69
69: ; preds = %32, %28, %67, %56
%70 = phi i8* [ %17, %28 ], [ %63, %56 ], [ %17, %67 ], [ %17, %32 ]
%71 = phi i32* [ %30, %28 ], [ null, %56 ], [ %68, %67 ], [ %34, %32 ]
%72 = icmp eq i8* %70, null
br i1 %72, label %75, label %73
73: ; preds = %69
%74 = tail call i32 @free(i8* %70)
br label %75
75: ; preds = %6, %3, %73, %69
%76 = phi i32* [ %71, %73 ], [ %71, %69 ], [ %7, %6 ], [ %4, %3 ]
ret i32* %76
}