#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*/ atoi(char *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ feof(int /*<<< orphan*/ *);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ free(char *);
char *getenv(char *);
scalar_t__ malloc(scalar_t__);
int /*<<< orphan*/ setBlinkCursor(char);
int /*<<< orphan*/ setBlockCursor(char);
int /*<<< orphan*/ setFullscreen(char);
int /*<<< orphan*/ setPixelSize(char);
int /*<<< orphan*/ setRam8k(char);
int /*<<< orphan*/ setScanlines(char);
int /*<<< orphan*/ setTerminalSpeed(int /*<<< orphan*/);
int /*<<< orphan*/ setWriteInRom(char);
int /*<<< orphan*/ sprintf(char *, char *, char *);
int /*<<< orphan*/ strcmp(char *, char *);
char *strdup(char *);
scalar_t__ strlen(char *);
char *strrchr(char *, char);
void loadConfiguration(void) {
  FILE *fp;
  char *configdir, *filename, buffer[256], *value;
  char *homedir = getenv("HOME");
  if (homedir) {
    configdir = (char *)malloc(strlen(homedir) + 8);
    sprintf(configdir, "%s/.pom1/", homedir);
  } else
    configdir = strdup("");
  filename = (char *)malloc(strlen(configdir) + 9);
  sprintf(filename, "%spom1.cfg", configdir);
  free(configdir);
  fp = fopen(filename, "r");
  free(filename);
  if (fp) {
    while (!feof(fp)) {
      if (!fgets(buffer, 256, fp))
        continue;
      if (buffer[0] == '/' || buffer[0] == '\n')
        continue;
      *(strrchr(buffer, '\n')) = '\0';
      value = strrchr(buffer, '=') + 1;
      *(strrchr(buffer, '=')) = '\0';
      if (!strcmp(buffer, "pixelSize"))
        setPixelSize(value[0] & 0x03);
      else if (!strcmp(buffer, "scanlines"))
        setScanlines(value[0] & 0x01);
      else if (!strcmp(buffer, "terminalSpeed"))
        setTerminalSpeed(atoi(value));
      else if (!strcmp(buffer, "ram8k"))
        setRam8k(value[0] & 0x01);
      else if (!strcmp(buffer, "writeInRom"))
        setWriteInRom(value[0] & 0x01);
      else if (!strcmp(buffer, "fullscreen"))
        setFullscreen(value[0] & 0x01);
      else if (!strcmp(buffer, "blinkCursor"))
        setBlinkCursor(value[0] & 0x01);
      else if (!strcmp(buffer, "blockCursor"))
        setBlockCursor(value[0] & 0x01);
    }
    fclose(fp);
  }
}


x86 assembly (clang, -O0):
<loadConfiguration>:
push   %rbp
mov    %rsp,%rbp
sub    $0x130,%rsp
lea    0xd9e(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x130(%rbp)
cmpq   $0x0,-0x130(%rbp)
je     12b4 <loadConfiguration+0x64>
mov    -0x130(%rbp),%rdi
call   1060 <strlen@plt>
mov    %rax,%rdi
add    $0x8,%rdi
call   10f0 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x130(%rbp),%rdx
lea    0xd5b(%rip),%rsi
call   1160 <sprintf@plt>
jmp    12c4 <loadConfiguration+0x74>
lea    0xd53(%rip),%rdi
call   1170 <strdup@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1060 <strlen@plt>
mov    %rax,%rdi
add    $0x9,%rdi
call   10f0 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xd23(%rip),%rsi
call   1160 <sprintf@plt>
mov    -0x10(%rbp),%rdi
call   1040 <free@plt>
mov    -0x18(%rbp),%rdi
lea    0xd69(%rip),%rsi
call   1140 <fopen@plt>
mov    %rax,-0x8(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <free@plt>
cmpq   $0x0,-0x8(%rbp)
je     15ab <loadConfiguration+0x35b>
jmp    1327 <loadConfiguration+0xd7>
mov    -0x8(%rbp),%rdi
call   10e0 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1345 <loadConfiguration+0xf5>
jmp    15a2 <loadConfiguration+0x352>
lea    -0x120(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    $0x100,%esi
call   10c0 <fgets@plt>
cmp    $0x0,%eax
jne    1368 <loadConfiguration+0x118>
jmp    1327 <loadConfiguration+0xd7>
movsbl -0x120(%rbp),%eax
cmp    $0x2f,%eax
je     1388 <loadConfiguration+0x138>
movsbl -0x120(%rbp),%eax
cmp    $0xa,%eax
jne    138d <loadConfiguration+0x13d>
jmp    1327 <loadConfiguration+0xd7>
lea    -0x120(%rbp),%rdi
mov    $0xa,%esi
call   1080 <strrchr@plt>
movb   $0x0,(%rax)
lea    -0x120(%rbp),%rdi
mov    $0x3d,%esi
call   1080 <strrchr@plt>
add    $0x1,%rax
mov    %rax,-0x128(%rbp)
lea    -0x120(%rbp),%rdi
mov    $0x3d,%esi
call   1080 <strrchr@plt>
movb   $0x0,(%rax)
lea    -0x120(%rbp),%rdi
lea    0xc3b(%rip),%rsi
call   10d0 <strcmp@plt>
cmp    $0x0,%eax
jne    1407 <loadConfiguration+0x1b7>
mov    -0x128(%rbp),%rax
movsbl (%rax),%eax
and    $0x3,%eax
movsbl %al,%edi
call   10a0 <setPixelSize@plt>
jmp    159d <loadConfiguration+0x34d>
lea    -0x120(%rbp),%rdi
lea    0xc0f(%rip),%rsi
call   10d0 <strcmp@plt>
cmp    $0x0,%eax
jne    143d <loadConfiguration+0x1ed>
mov    -0x128(%rbp),%rax
movsbl (%rax),%eax
and    $0x1,%eax
movsbl %al,%edi
call   1070 <setScanlines@plt>
jmp    1598 <loadConfiguration+0x348>
lea    -0x120(%rbp),%rdi
lea    0xbe3(%rip),%rsi
call   10d0 <strcmp@plt>
cmp    $0x0,%eax
jne    1471 <loadConfiguration+0x221>
mov    -0x128(%rbp),%rdi
call   1150 <atoi@plt>
mov    %eax,%edi
call   1100 <setTerminalSpeed@plt>
jmp    1593 <loadConfiguration+0x343>
lea    -0x120(%rbp),%rdi
lea    0xbbd(%rip),%rsi
call   10d0 <strcmp@plt>
cmp    $0x0,%eax
jne    14a7 <loadConfiguration+0x257>
mov    -0x128(%rbp),%rax
movsbl (%rax),%eax
and    $0x1,%eax
movsbl %al,%edi
call   1130 <setRam8k@plt>
jmp    158e <loadConfiguration+0x33e>
lea    -0x120(%rbp),%rdi
lea    0xb8d(%rip),%rsi
call   10d0 <strcmp@plt>
cmp    $0x0,%eax
jne    14dd <loadConfiguration+0x28d>
mov    -0x128(%rbp),%rax
movsbl (%rax),%eax
and    $0x1,%eax
movsbl %al,%edi
call   1090 <setWriteInRom@plt>
jmp    1589 <loadConfiguration+0x339>
lea    -0x120(%rbp),%rdi
lea    0xb62(%rip),%rsi
call   10d0 <strcmp@plt>
cmp    $0x0,%eax
jne    1513 <loadConfiguration+0x2c3>
mov    -0x128(%rbp),%rax
movsbl (%rax),%eax
and    $0x1,%eax
movsbl %al,%edi
call   1110 <setFullscreen@plt>
jmp    1584 <loadConfiguration+0x334>
lea    -0x120(%rbp),%rdi
lea    0xb37(%rip),%rsi
call   10d0 <strcmp@plt>
cmp    $0x0,%eax
jne    1549 <loadConfiguration+0x2f9>
mov    -0x128(%rbp),%rax
movsbl (%rax),%eax
and    $0x1,%eax
movsbl %al,%edi
call   10b0 <setBlinkCursor@plt>
jmp    157f <loadConfiguration+0x32f>
lea    -0x120(%rbp),%rdi
lea    0xb0d(%rip),%rsi
call   10d0 <strcmp@plt>
cmp    $0x0,%eax
jne    157a <loadConfiguration+0x32a>
mov    -0x128(%rbp),%rax
movsbl (%rax),%eax
and    $0x1,%eax
movsbl %al,%edi
call   1120 <setBlockCursor@plt>
jmp    157f <loadConfiguration+0x32f>
jmp    1584 <loadConfiguration+0x334>
jmp    1589 <loadConfiguration+0x339>
jmp    158e <loadConfiguration+0x33e>
jmp    1593 <loadConfiguration+0x343>
jmp    1598 <loadConfiguration+0x348>
jmp    159d <loadConfiguration+0x34d>
jmp    1327 <loadConfiguration+0xd7>
mov    -0x8(%rbp),%rdi
call   1050 <fclose@plt>
add    $0x130,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<loadConfiguration>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x108,%rsp
lea    0xda8(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
je     128d <loadConfiguration+0x4d>
mov    %rax,%r14
mov    %rax,%rdi
call   1060 <strlen@plt>
lea    0x8(%rax),%rdi
call   10e0 <malloc@plt>
mov    %rax,%r15
lea    0xd85(%rip),%rsi
mov    %rax,%rdi
mov    %r14,%rdx
call   1150 <sprintf@plt>
jmp    129c <loadConfiguration+0x5c>
lea    0xd7a(%rip),%rdi
call   1160 <strdup@plt>
mov    %rax,%r15
mov    %r15,%rdi
call   1060 <strlen@plt>
lea    0x9(%rax),%rdi
call   10e0 <malloc@plt>
mov    %rax,%rbx
lea    0xd58(%rip),%rsi
mov    %rax,%rdi
mov    %r15,%rdx
call   1150 <sprintf@plt>
mov    %r15,%rdi
call   1040 <free@plt>
lea    0xd9d(%rip),%rsi
mov    %rbx,%rdi
call   1130 <fopen@plt>
mov    %rax,%r15
mov    %rbx,%rdi
call   1040 <free@plt>
test   %r15,%r15
je     12fd <loadConfiguration+0xbd>
mov    %r15,%rdi
call   10d0 <feof@plt>
test   %eax,%eax
je     130f <loadConfiguration+0xcf>
mov    %r15,%rdi
call   1050 <fclose@plt>
add    $0x108,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %rsp,%r14
movabs $0x7a69536c65786970,%rbx
53 69 7a
movabs $0x656e696c6e616373,%r12
69 6e 65
movabs $0x6c616e696d726574,%r13
6e 61 6c
movabs $0x64656570536c61,%rbp
jmp    135c <loadConfiguration+0x11c>
movzbl (%rax),%edi
and    $0x3,%edi
call   10a0 <setPixelSize@plt>
nopw   0x0(%rax,%rax,1)
mov    %r15,%rdi
call   10d0 <feof@plt>
test   %eax,%eax
jne    12f5 <loadConfiguration+0xb5>
mov    %r14,%rdi
mov    $0x100,%esi
mov    %r15,%rdx
call   10c0 <fgets@plt>
test   %eax,%eax
je     1350 <loadConfiguration+0x110>
movzbl (%rsp),%eax
cmp    $0xa,%al
je     1350 <loadConfiguration+0x110>
cmp    $0x2f,%al
je     1350 <loadConfiguration+0x110>
mov    %r14,%rdi
mov    $0xa,%esi
call   1080 <strrchr@plt>
movb   $0x0,(%rax)
mov    %r14,%rdi
mov    $0x3d,%esi
call   1080 <strrchr@plt>
movb   $0x0,(%rax)
add    $0x1,%rax
mov    (%rsp),%rcx
xor    %rbx,%rcx
movzwl 0x8(%rsp),%edx
xor    $0x65,%rdx
or     %rcx,%rdx
je     133c <loadConfiguration+0xfc>
mov    (%rsp),%rcx
xor    %r12,%rcx
movzwl 0x8(%rsp),%edx
xor    $0x73,%rdx
or     %rcx,%rdx
je     14a8 <loadConfiguration+0x268>
mov    (%rsp),%rcx
xor    %r13,%rcx
mov    0x6(%rsp),%rdx
xor    %rbp,%rdx
or     %rcx,%rdx
je     14b8 <loadConfiguration+0x278>
mov    (%rsp),%ecx
mov    $0x386d6172,%edx
xor    %edx,%ecx
movzwl 0x4(%rsp),%edx
xor    $0x6b,%edx
or     %ecx,%edx
je     14cc <loadConfiguration+0x28c>
mov    (%rsp),%rcx
movabs $0x526e496574697277,%rdx
49 6e 52
xor    %rdx,%rcx
mov    0x3(%rsp),%rdx
movabs $0x6d6f526e496574,%rsi
xor    %rsi,%rdx
or     %rcx,%rdx
je     14dc <loadConfiguration+0x29c>
mov    (%rsp),%rcx
movabs $0x657263736c6c7566,%rdx
63 72 65
xor    %rdx,%rcx
mov    0x3(%rsp),%rdx
movabs $0x6e65657263736c,%rsi
xor    %rsi,%rdx
or     %rcx,%rdx
je     14ec <loadConfiguration+0x2ac>
movabs $0x7275436b636f6c62,%rsi
43 75 72
lea    0xafa0000(%rsi),%rcx
xor    (%rsp),%rcx
mov    0x8(%rsp),%edx
xor    $0x726f73,%rdx
or     %rcx,%rdx
je     14fc <loadConfiguration+0x2bc>
mov    (%rsp),%rcx
xor    %rsi,%rcx
mov    0x8(%rsp),%edx
xor    $0x726f73,%rdx
or     %rcx,%rdx
jne    1350 <loadConfiguration+0x110>
movzbl (%rax),%edi
and    $0x1,%edi
call   1110 <setBlockCursor@plt>
jmp    1350 <loadConfiguration+0x110>
movzbl (%rax),%edi
and    $0x1,%edi
call   1070 <setScanlines@plt>
jmp    1350 <loadConfiguration+0x110>
mov    %rax,%rdi
call   1140 <atoi@plt>
mov    %eax,%edi
call   10f0 <setTerminalSpeed@plt>
jmp    1350 <loadConfiguration+0x110>
movzbl (%rax),%edi
and    $0x1,%edi
call   1120 <setRam8k@plt>
jmp    1350 <loadConfiguration+0x110>
movzbl (%rax),%edi
and    $0x1,%edi
call   1090 <setWriteInRom@plt>
jmp    1350 <loadConfiguration+0x110>
movzbl (%rax),%edi
and    $0x1,%edi
call   1100 <setFullscreen@plt>
jmp    1350 <loadConfiguration+0x110>
movzbl (%rax),%edi
and    $0x1,%edi
call   10b0 <setBlinkCursor@plt>
jmp    1350 <loadConfiguration+0x110>

LLVM IR (-O0):
@.str = [5 x i8] c"HOME\00"
@.str.1 = [10 x i8] c"%s/.pom1/\00"
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [11 x i8] c"%spom1.cfg\00"
@.str.4 = [2 x i8] c"r\00"
@.str.5 = [10 x i8] c"pixelSize\00"
@.str.6 = [10 x i8] c"scanlines\00"
@.str.7 = [14 x i8] c"terminalSpeed\00"
@.str.8 = [6 x i8] c"ram8k\00"
@.str.9 = [11 x i8] c"writeInRom\00"
@.str.10 = [11 x i8] c"fullscreen\00"
@.str.11 = [12 x i8] c"blinkCursor\00"
@.str.12 = [12 x i8] c"blockCursor\00"
define void @loadConfiguration() {
%1 = alloca i32*
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca [256 x i8]
%5 = alloca i8*
%6 = alloca i8*
%7 = call i8* @getenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
store i8* %7, i8** %6
%8 = load i8*, i8** %6
%9 = icmp ne i8* %8, null
br i1 %9, label %10, label %19
10: ; preds = %0
%11 = load i8*, i8** %6
%12 = call i64 @strlen(i8* %11)
%13 = add nsw i64 %12, 8
%14 = call i64 @malloc(i64 %13)
%15 = inttoptr i64 %14 to i8*
store i8* %15, i8** %2
%16 = load i8*, i8** %2
%17 = load i8*, i8** %6
%18 = call i32 @sprintf(i8* %16, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* %17)
br label %21
19: ; preds = %0
%20 = call i8* @strdup(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0))
store i8* %20, i8** %2
br label %21
21: ; preds = %19, %10
%22 = load i8*, i8** %2
%23 = call i64 @strlen(i8* %22)
%24 = add nsw i64 %23, 9
%25 = call i64 @malloc(i64 %24)
%26 = inttoptr i64 %25 to i8*
store i8* %26, i8** %3
%27 = load i8*, i8** %3
%28 = load i8*, i8** %2
%29 = call i32 @sprintf(i8* %27, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i8* %28)
%30 = load i8*, i8** %2
%31 = call i32 @free(i8* %30)
%32 = load i8*, i8** %3
%33 = call i32* @fopen(i8* %32, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
store i32* %33, i32** %1
%34 = load i8*, i8** %3
%35 = call i32 @free(i8* %34)
%36 = load i32*, i32** %1
%37 = icmp ne i32* %36, null
br i1 %37, label %38, label %171
38: ; preds = %21
br label %39
39: ; preds = %167, %60, %49, %38
%40 = load i32*, i32** %1
%41 = call i32 @feof(i32* %40)
%42 = icmp ne i32 %41, 0
%43 = xor i1 %42, true
br i1 %43, label %44, label %168
44: ; preds = %39
%45 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%46 = load i32*, i32** %1
%47 = call i32 @fgets(i8* %45, i32 256, i32* %46)
%48 = icmp ne i32 %47, 0
br i1 %48, label %50, label %49
49: ; preds = %44
br label %39
50: ; preds = %44
%51 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%52 = load i8, i8* %51
%53 = sext i8 %52 to i32
%54 = icmp eq i32 %53, 47
br i1 %54, label %60, label %55
55: ; preds = %50
%56 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%57 = load i8, i8* %56
%58 = sext i8 %57 to i32
%59 = icmp eq i32 %58, 10
br i1 %59, label %60, label %61
60: ; preds = %55, %50
br label %39
61: ; preds = %55
%62 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%63 = call i8* @strrchr(i8* %62, i8 signext 10)
store i8 0, i8* %63
%64 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%65 = call i8* @strrchr(i8* %64, i8 signext 61)
%66 = getelementptr inbounds i8, i8* %65, i64 1
store i8* %66, i8** %5
%67 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%68 = call i8* @strrchr(i8* %67, i8 signext 61)
store i8 0, i8* %68
%69 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%70 = call i32 @strcmp(i8* %69, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0))
%71 = icmp ne i32 %70, 0
br i1 %71, label %80, label %72
72: ; preds = %61
%73 = load i8*, i8** %5
%74 = getelementptr inbounds i8, i8* %73, i64 0
%75 = load i8, i8* %74
%76 = sext i8 %75 to i32
%77 = and i32 %76, 3
%78 = trunc i32 %77 to i8
%79 = call i32 @setPixelSize(i8 signext %78)
br label %167
80: ; preds = %61
%81 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%82 = call i32 @strcmp(i8* %81, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0))
%83 = icmp ne i32 %82, 0
br i1 %83, label %92, label %84
84: ; preds = %80
%85 = load i8*, i8** %5
%86 = getelementptr inbounds i8, i8* %85, i64 0
%87 = load i8, i8* %86
%88 = sext i8 %87 to i32
%89 = and i32 %88, 1
%90 = trunc i32 %89 to i8
%91 = call i32 @setScanlines(i8 signext %90)
br label %166
92: ; preds = %80
%93 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%94 = call i32 @strcmp(i8* %93, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0))
%95 = icmp ne i32 %94, 0
br i1 %95, label %100, label %96
96: ; preds = %92
%97 = load i8*, i8** %5
%98 = call i32 @atoi(i8* %97)
%99 = call i32 @setTerminalSpeed(i32 %98)
br label %165
100: ; preds = %92
%101 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%102 = call i32 @strcmp(i8* %101, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0))
%103 = icmp ne i32 %102, 0
br i1 %103, label %112, label %104
104: ; preds = %100
%105 = load i8*, i8** %5
%106 = getelementptr inbounds i8, i8* %105, i64 0
%107 = load i8, i8* %106
%108 = sext i8 %107 to i32
%109 = and i32 %108, 1
%110 = trunc i32 %109 to i8
%111 = call i32 @setRam8k(i8 signext %110)
br label %164
112: ; preds = %100
%113 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%114 = call i32 @strcmp(i8* %113, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.9, i64 0, i64 0))
%115 = icmp ne i32 %114, 0
br i1 %115, label %124, label %116
116: ; preds = %112
%117 = load i8*, i8** %5
%118 = getelementptr inbounds i8, i8* %117, i64 0
%119 = load i8, i8* %118
%120 = sext i8 %119 to i32
%121 = and i32 %120, 1
%122 = trunc i32 %121 to i8
%123 = call i32 @setWriteInRom(i8 signext %122)
br label %163
124: ; preds = %112
%125 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%126 = call i32 @strcmp(i8* %125, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.10, i64 0, i64 0))
%127 = icmp ne i32 %126, 0
br i1 %127, label %136, label %128
128: ; preds = %124
%129 = load i8*, i8** %5
%130 = getelementptr inbounds i8, i8* %129, i64 0
%131 = load i8, i8* %130
%132 = sext i8 %131 to i32
%133 = and i32 %132, 1
%134 = trunc i32 %133 to i8
%135 = call i32 @setFullscreen(i8 signext %134)
br label %162
136: ; preds = %124
%137 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%138 = call i32 @strcmp(i8* %137, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.11, i64 0, i64 0))
%139 = icmp ne i32 %138, 0
br i1 %139, label %148, label %140
140: ; preds = %136
%141 = load i8*, i8** %5
%142 = getelementptr inbounds i8, i8* %141, i64 0
%143 = load i8, i8* %142
%144 = sext i8 %143 to i32
%145 = and i32 %144, 1
%146 = trunc i32 %145 to i8
%147 = call i32 @setBlinkCursor(i8 signext %146)
br label %161
148: ; preds = %136
%149 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%150 = call i32 @strcmp(i8* %149, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.12, i64 0, i64 0))
%151 = icmp ne i32 %150, 0
br i1 %151, label %160, label %152
152: ; preds = %148
%153 = load i8*, i8** %5
%154 = getelementptr inbounds i8, i8* %153, i64 0
%155 = load i8, i8* %154
%156 = sext i8 %155 to i32
%157 = and i32 %156, 1
%158 = trunc i32 %157 to i8
%159 = call i32 @setBlockCursor(i8 signext %158)
br label %160
160: ; preds = %152, %148
br label %161
161: ; preds = %160, %140
br label %162
162: ; preds = %161, %128
br label %163
163: ; preds = %162, %116
br label %164
164: ; preds = %163, %104
br label %165
165: ; preds = %164, %96
br label %166
166: ; preds = %165, %84
br label %167
167: ; preds = %166, %72
br label %39
168: ; preds = %39
%169 = load i32*, i32** %1
%170 = call i32 @fclose(i32* %169)
br label %171
171: ; preds = %168, %21
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"HOME\00"
@.str.1 = [10 x i8] c"%s/.pom1/\00"
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [11 x i8] c"%spom1.cfg\00"
@.str.4 = [2 x i8] c"r\00"
@.str.5 = [10 x i8] c"pixelSize\00"
@.str.6 = [10 x i8] c"scanlines\00"
@.str.7 = [14 x i8] c"terminalSpeed\00"
@.str.8 = [6 x i8] c"ram8k\00"
@.str.9 = [11 x i8] c"writeInRom\00"
@.str.10 = [11 x i8] c"fullscreen\00"
@.str.11 = [12 x i8] c"blinkCursor\00"
@.str.12 = [12 x i8] c"blockCursor\00"
define void @loadConfiguration() {
%1 = alloca [256 x i8]
%2 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%3 = tail call i8* @getenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i8* %3, null
br i1 %4, label %11, label %5
5: ; preds = %0
%6 = tail call i64 @strlen(i8* %3)
%7 = add nsw i64 %6, 8
%8 = tail call i64 @malloc(i64 %7)
%9 = inttoptr i64 %8 to i8*
%10 = tail call i32 @sprintf(i8* dereferenceable(1) %9, i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* %3)
br label %13
11: ; preds = %0
%12 = tail call dereferenceable_or_null(1) i8* @strdup(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0))
br label %13
13: ; preds = %11, %5
%14 = phi i8* [ %9, %5 ], [ %12, %11 ]
%15 = tail call i64 @strlen(i8* dereferenceable(1) %14)
%16 = add nsw i64 %15, 9
%17 = tail call i64 @malloc(i64 %16)
%18 = inttoptr i64 %17 to i8*
%19 = tail call i32 @sprintf(i8* dereferenceable(1) %18, i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i8* %14)
%20 = tail call i32 @free(i8* %14)
%21 = tail call i32* @fopen(i8* %18, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%22 = tail call i32 @free(i8* %18)
%23 = icmp eq i32* %21, null
br i1 %23, label %95, label %24
24: ; preds = %13
%25 = call i32 @feof(i32* %21)
%26 = icmp eq i32 %25, 0
br i1 %26, label %27, label %93
27: ; preds = %24, %90
%28 = call i32 @fgets(i8* %2, i32 256, i32* %21)
%29 = icmp eq i32 %28, 0
br i1 %29, label %90, label %30
30: ; preds = %27
%31 = load i8, i8* %2
switch i8 %31, label %32 [
i8 47, label %90
i8 10, label %90
]
32: ; preds = %30
%33 = call i8* @strrchr(i8* %2, i8 signext 10)
store i8 0, i8* %33
%34 = call i8* @strrchr(i8* %2, i8 signext 61)
%35 = getelementptr inbounds i8, i8* %34, i64 1
store i8 0, i8* %34
%36 = call i32 @bcmp(i8* dereferenceable(10) %2, i8* dereferenceable(10) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i64 10)
%37 = icmp eq i32 %36, 0
br i1 %37, label %38, label %42
38: ; preds = %32
%39 = load i8, i8* %35
%40 = and i8 %39, 3
%41 = call i32 @setPixelSize(i8 signext %40)
br label %90
42: ; preds = %32
%43 = call i32 @bcmp(i8* dereferenceable(10) %2, i8* dereferenceable(10) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i64 10)
%44 = icmp eq i32 %43, 0
br i1 %44, label %45, label %49
45: ; preds = %42
%46 = load i8, i8* %35
%47 = and i8 %46, 1
%48 = call i32 @setScanlines(i8 signext %47)
br label %90
49: ; preds = %42
%50 = call i32 @bcmp(i8* dereferenceable(14) %2, i8* dereferenceable(14) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0), i64 14)
%51 = icmp eq i32 %50, 0
br i1 %51, label %52, label %55
52: ; preds = %49
%53 = call i32 @atoi(i8* %35)
%54 = call i32 @setTerminalSpeed(i32 %53)
br label %90
55: ; preds = %49
%56 = call i32 @bcmp(i8* dereferenceable(6) %2, i8* dereferenceable(6) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0), i64 6)
%57 = icmp eq i32 %56, 0
br i1 %57, label %58, label %62
58: ; preds = %55
%59 = load i8, i8* %35
%60 = and i8 %59, 1
%61 = call i32 @setRam8k(i8 signext %60)
br label %90
62: ; preds = %55
%63 = call i32 @bcmp(i8* dereferenceable(11) %2, i8* dereferenceable(11) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.9, i64 0, i64 0), i64 11)
%64 = icmp eq i32 %63, 0
br i1 %64, label %65, label %69
65: ; preds = %62
%66 = load i8, i8* %35
%67 = and i8 %66, 1
%68 = call i32 @setWriteInRom(i8 signext %67)
br label %90
69: ; preds = %62
%70 = call i32 @bcmp(i8* dereferenceable(11) %2, i8* dereferenceable(11) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.10, i64 0, i64 0), i64 11)
%71 = icmp eq i32 %70, 0
br i1 %71, label %72, label %76
72: ; preds = %69
%73 = load i8, i8* %35
%74 = and i8 %73, 1
%75 = call i32 @setFullscreen(i8 signext %74)
br label %90
76: ; preds = %69
%77 = call i32 @bcmp(i8* dereferenceable(12) %2, i8* dereferenceable(12) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.11, i64 0, i64 0), i64 12)
%78 = icmp eq i32 %77, 0
br i1 %78, label %79, label %83
79: ; preds = %76
%80 = load i8, i8* %35
%81 = and i8 %80, 1
%82 = call i32 @setBlinkCursor(i8 signext %81)
br label %90
83: ; preds = %76
%84 = call i32 @bcmp(i8* dereferenceable(12) %2, i8* dereferenceable(12) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.12, i64 0, i64 0), i64 12)
%85 = icmp eq i32 %84, 0
br i1 %85, label %86, label %90
86: ; preds = %83
%87 = load i8, i8* %35
%88 = and i8 %87, 1
%89 = call i32 @setBlockCursor(i8 signext %88)
br label %90
90: ; preds = %38, %52, %65, %79, %86, %83, %72, %58, %45, %27, %30, %30
%91 = call i32 @feof(i32* %21)
%92 = icmp eq i32 %91, 0
br i1 %92, label %27, label %93
93: ; preds = %90, %24
%94 = call i32 @fclose(i32* %21)
br label %95
95: ; preds = %93, %13
ret void
}