#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_END;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fread(unsigned int *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int, int /*<<< orphan*/);
int /*<<< orphan*/ fwrite(unsigned int *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ sscanf(char *, char *, unsigned int *);
void main(int argc, char *argv[]) {
  FILE *ldr;
  unsigned int code, adr;
  unsigned int i;
  if ((argc != 2) && (argc != 4)) {
    printf("\n Формат командной строки:\n  %s  <файл загрузчика> <код чипсета> "
           "<адрес загрузки> - запись блока идентификации в загрузчик\n  %s  "
           "<файл загрузчика> - просмотр блока идентификации\n",
           argv[0], argv[0]);
    return;
  }
  ldr = fopen(argv[1], "r+");
  if (ldr == 0) {
    printf("\n Ошибка открытия файла %s\n", argv[1]);
    return;
  }
  if (argc == 2) {
    fseek(ldr, -12, SEEK_END);
    fread(&i, 1, 4, ldr);
    if (i != 0xdeadbeef) {
      printf("\n Загрузчик не содержит в себе блок идентификации\n");
      fclose(ldr);
      return;
    }
    fread(&code, 4, 1, ldr);
    fread(&adr, 4, 1, ldr);
    fclose(ldr);
    printf("\n Параметры идентификации загрузчика %s:", argv[1]);
    printf("\n * Код чипсета = 0x%x", code);
    printf("\n * Адрес загрузки = 0x%08x\n\n", adr);
    return;
  }
  sscanf(argv[2], "%x", &code);
  if (code == 0) {
    printf("\n Неправильный код чипсета\n");
    fclose(ldr);
    return;
  }
  sscanf(argv[3], "%x", &adr);
  if (adr == 0) {
    printf("\n Неправильный адрес\n");
    fclose(ldr);
    return;
  }
  fseek(ldr, -12, SEEK_END);
  fread(&i, 1, 4, ldr);
  if (i == 0xdeadbeef) {
    printf("\n Загрузчик уже содержит в себе блок идентификации - "
           "перезаписываем\n");
  } else {
    fclose(ldr);
    ldr = fopen(argv[1], "a");
    i = 0xdeadbeef;
    fwrite(&i, 4, 1, ldr);
  }
  fwrite(&code, 4, 1, ldr);
  fwrite(&adr, 4, 1, ldr);
  fclose(ldr);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x4(%rbp)
je     11b4 <main+0x44>
cmpl   $0x4,-0x4(%rbp)
je     11b4 <main+0x44>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe58(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1407 <main+0x297>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xf74(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    11f2 <main+0x82>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xf54(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1407 <main+0x297>
cmpl   $0x2,-0x4(%rbp)
jne    12c7 <main+0x157>
mov    -0x18(%rbp),%rdi
mov    0x2de1(%rip),%rax
mov    (%rax),%edx
mov    $0xfffffff4,%esi
call   1070 <fseek@plt>
mov    -0x18(%rbp),%rcx
lea    -0x24(%rbp),%rdi
mov    $0x1,%esi
mov    $0x4,%edx
call   1030 <fread@plt>
cmpl   $0xdeadbeef,-0x24(%rbp)
je     1253 <main+0xe3>
lea    0xf2b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
jmp    1407 <main+0x297>
mov    -0x18(%rbp),%rcx
lea    -0x1c(%rbp),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
call   1030 <fread@plt>
mov    -0x18(%rbp),%rcx
lea    -0x20(%rbp),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
call   1030 <fread@plt>
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xf2c(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x1c(%rbp),%esi
lea    0xf64(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x20(%rbp),%esi
lea    0xf74(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1407 <main+0x297>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xf56(%rip),%rsi
lea    -0x1c(%rbp),%rdx
call   1060 <sscanf@plt>
cmpl   $0x0,-0x1c(%rbp)
jne    1305 <main+0x195>
lea    0xf6a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
jmp    1407 <main+0x297>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
lea    0xf18(%rip),%rsi
lea    -0x20(%rbp),%rdx
call   1060 <sscanf@plt>
cmpl   $0x0,-0x20(%rbp)
jne    1343 <main+0x1d3>
lea    0xf5e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
jmp    1407 <main+0x297>
mov    -0x18(%rbp),%rdi
mov    0x2c9a(%rip),%rax
mov    (%rax),%edx
mov    $0xfffffff4,%esi
call   1070 <fseek@plt>
mov    -0x18(%rbp),%rcx
lea    -0x24(%rbp),%rdi
mov    $0x1,%esi
mov    $0x4,%edx
call   1030 <fread@plt>
cmpl   $0xdeadbeef,-0x24(%rbp)
jne    1391 <main+0x221>
lea    0xf2e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    13d0 <main+0x260>
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xf87(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x18(%rbp)
movl   $0xdeadbeef,-0x24(%rbp)
mov    -0x18(%rbp),%rcx
lea    -0x24(%rbp),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
call   1090 <fwrite@plt>
mov    -0x18(%rbp),%rcx
lea    -0x1c(%rbp),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
call   1090 <fwrite@plt>
mov    -0x18(%rbp),%rcx
lea    -0x20(%rbp),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
call   1090 <fwrite@plt>
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
cmp    $0x2,%edi
je     119b <main+0x1b>
cmp    $0x4,%ebp
jne    126f <main+0xef>
mov    0x8(%rbx),%rdi
lea    0xf91(%rip),%rsi
call   1090 <fopen@plt>
test   %rax,%rax
je     128b <main+0x10b>
mov    %rax,%r14
cmp    $0x2,%ebp
jne    12a5 <main+0x125>
mov    0x2e21(%rip),%rax
mov    (%rax),%edx
mov    %r14,%rdi
mov    $0xfffffff4,%esi
call   1080 <fseek@plt>
lea    0x4(%rsp),%rdi
mov    $0x1,%esi
mov    $0x4,%edx
mov    %r14,%rcx
call   1040 <fread@plt>
cmpl   $0xdeadbeef,0x4(%rsp)
de
jne    1322 <main+0x1a2>
lea    0xc(%rsp),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1040 <fread@plt>
lea    0x8(%rsp),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1040 <fread@plt>
mov    %r14,%rdi
call   1050 <fclose@plt>
mov    0x8(%rbx),%rsi
lea    0xf2d(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0xc(%rsp),%esi
lea    0xf64(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x8(%rsp),%esi
lea    0xf73(%rip),%rdi
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
jmp    1060 <printf@plt>
mov    (%rbx),%rdx
lea    0xd87(%rip),%rdi
mov    %rdx,%rsi
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
jmp    1060 <printf@plt>
mov    0x8(%rbx),%rsi
lea    0xea4(%rip),%rdi
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
jmp    1060 <printf@plt>
mov    0x10(%rbx),%rdi
lea    0xf20(%rip),%rsi
lea    0xc(%rsp),%rdx
call   1070 <sscanf@plt>
cmpl   $0x0,0xc(%rsp)
je     133e <main+0x1be>
mov    0x18(%rbx),%rdi
lea    0xf04(%rip),%rsi
lea    0x8(%rsp),%rdx
call   1070 <sscanf@plt>
cmpl   $0x0,0x8(%rsp)
je     134c <main+0x1cc>
mov    0x2d04(%rip),%rax
mov    (%rax),%edx
mov    %r14,%rdi
mov    $0xfffffff4,%esi
call   1080 <fseek@plt>
lea    0x4(%rsp),%rdi
mov    $0x1,%esi
mov    $0x4,%edx
mov    %r14,%rcx
call   1040 <fread@plt>
cmpl   $0xdeadbeef,0x4(%rsp)
de
jne    135a <main+0x1da>
lea    0xee5(%rip),%rdi
call   1030 <puts@plt>
jmp    1394 <main+0x214>
lea    0xfaa(%rip),%rdi
call   1030 <puts@plt>
mov    %r14,%rdi
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
jmp    1050 <fclose@plt>
lea    0xf5d(%rip),%rdi
call   1030 <puts@plt>
jmp    13c2 <main+0x242>
lea    0xf29(%rip),%rdi
call   1030 <puts@plt>
jmp    13c2 <main+0x242>
mov    %r14,%rdi
call   1050 <fclose@plt>
mov    0x8(%rbx),%rdi
lea    0xe91(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,%r14
movl   $0xdeadbeef,0x4(%rsp)
de
lea    0x4(%rsp),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
mov    %rax,%rcx
call   10a0 <fwrite@plt>
lea    0xc(%rsp),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   10a0 <fwrite@plt>
lea    0x8(%rsp),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   10a0 <fwrite@plt>
mov    %r14,%rdi
call   1050 <fclose@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [311 x i8] c"\0A \D0\A4\D0\BE\D1\80\D0\BC\D0\B0\D1\82 \D0\BA\D0\BE\D0\BC\D0\B0\D0\BD\D0\B4\D0\BD\D0\BE\D0\B9 \D1\81\D1\82\D1\80\D0\BE\D0\BA\D0\B8:\0A %s <\D1\84\D0\B0\D0\B9\D0\BB \D0\B7\D0\B0\D0\B3\D1\80\D1\83\D0\B7\D1\87\D0\B8\D0\BA\D0\B0> <\D0\BA\D0\BE\D0\B4 \D1\87\D0\B8\D0\BF\D1\81\D0\B5\D1\82\D0\B0> <\D0\B0\D0\B4\D1\80\D0\B5\D1\81 \D0\B7\D0\B0\D0\B3\D1\80\D1\83\D0\B7\D0\BA\D0\B8> - \D0\B7\D0\B0\D0\BF\D0\B8\D1\81\D1\8C \D0\B1\D0\BB\D0\BE\D0\BA\D0\B0 \D0\B8\D0\B4\D0\B5\D0\BD\D1\82\D0\B8\D1\84\D0\B8\D0\BA\D0\B0\D1\86\D0\B8\D0\B8 \D0\B2 \D0\B7\D0\B0\D0\B3\D1\80\D1\83\D0\B7\D1\87\D0\B8\D0\BA\0A %s <\D1\84\D0\B0\D0\B9\D0\BB \D0\B7\D0\B0\D0\B3\D1\80\D1\83\D0\B7\D1\87\D0\B8\D0\BA\D0\B0> - \D0\BF\D1\80\D0\BE\D1\81\D0\BC\D0\BE\D1\82\D1\80 \D0\B1\D0\BB\D0\BE\D0\BA\D0\B0 \D0\B8\D0\B4\D0\B5\D0\BD\D1\82\D0\B8\D1\84\D0\B8\D0\BA\D0\B0\D1\86\D0\B8\D0\B8\0A\00"
@.str.1 = [3 x i8] c"r+\00"
@.str.2 = [47 x i8] c"\0A \D0\9E\D1\88\D0\B8\D0\B1\D0\BA\D0\B0 \D0\BE\D1\82\D0\BA\D1\80\D1\8B\D1\82\D0\B8\D1\8F \D1\84\D0\B0\D0\B9\D0\BB\D0\B0 %s\0A\00"
@SEEK_END = global i32 0
@.str.3 = [92 x i8] c"\0A \D0\97\D0\B0\D0\B3\D1\80\D1\83\D0\B7\D1\87\D0\B8\D0\BA \D0\BD\D0\B5 \D1\81\D0\BE\D0\B4\D0\B5\D1\80\D0\B6\D0\B8\D1\82 \D0\B2 \D1\81\D0\B5\D0\B1\D0\B5 \D0\B1\D0\BB\D0\BE\D0\BA \D0\B8\D0\B4\D0\B5\D0\BD\D1\82\D0\B8\D1\84\D0\B8\D0\BA\D0\B0\D1\86\D0\B8\D0\B8\0A\00"
@.str.4 = [73 x i8] c"\0A \D0\9F\D0\B0\D1\80\D0\B0\D0\BC\D0\B5\D1\82\D1\80\D1\8B \D0\B8\D0\B4\D0\B5\D0\BD\D1\82\D0\B8\D1\84\D0\B8\D0\BA\D0\B0\D1\86\D0\B8\D0\B8 \D0\B7\D0\B0\D0\B3\D1\80\D1\83\D0\B7\D1\87\D0\B8\D0\BA\D0\B0 %s:\00"
@.str.5 = [33 x i8] c"\0A * \D0\9A\D0\BE\D0\B4 \D1\87\D0\B8\D0\BF\D1\81\D0\B5\D1\82\D0\B0 = 0x%x\00"
@.str.6 = [43 x i8] c"\0A * \D0\90\D0\B4\D1\80\D0\B5\D1\81 \D0\B7\D0\B0\D0\B3\D1\80\D1\83\D0\B7\D0\BA\D0\B8 = 0x%08x\0A\0A\00"
@.str.7 = [3 x i8] c"%x\00"
@.str.8 = [50 x i8] c"\0A \D0\9D\D0\B5\D0\BF\D1\80\D0\B0\D0\B2\D0\B8\D0\BB\D1\8C\D0\BD\D1\8B\D0\B9 \D0\BA\D0\BE\D0\B4 \D1\87\D0\B8\D0\BF\D1\81\D0\B5\D1\82\D0\B0\0A\00"
@.str.9 = [39 x i8] c"\0A \D0\9D\D0\B5\D0\BF\D1\80\D0\B0\D0\B2\D0\B8\D0\BB\D1\8C\D0\BD\D1\8B\D0\B9 \D0\B0\D0\B4\D1\80\D0\B5\D1\81\0A\00"
@.str.10 = [125 x i8] c"\0A \D0\97\D0\B0\D0\B3\D1\80\D1\83\D0\B7\D1\87\D0\B8\D0\BA \D1\83\D0\B6\D0\B5 \D1\81\D0\BE\D0\B4\D0\B5\D1\80\D0\B6\D0\B8\D1\82 \D0\B2 \D1\81\D0\B5\D0\B1\D0\B5 \D0\B1\D0\BB\D0\BE\D0\BA \D0\B8\D0\B4\D0\B5\D0\BD\D1\82\D0\B8\D1\84\D0\B8\D0\BA\D0\B0\D1\86\D0\B8\D0\B8 - \D0\BF\D0\B5\D1\80\D0\B5\D0\B7\D0\B0\D0\BF\D0\B8\D1\81\D1\8B\D0\B2\D0\B0\D0\B5\D0\BC\0A\00"
@.str.11 = [2 x i8] c"a\00"
define void @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %3
store i8** %1, i8*** %4
%9 = load i32, i32* %3
%10 = icmp ne i32 %9, 2
br i1 %10, label %11, label %22
11: ; preds = %2
%12 = load i32, i32* %3
%13 = icmp ne i32 %12, 4
br i1 %13, label %14, label %22
14: ; preds = %11
%15 = load i8**, i8*** %4
%16 = getelementptr inbounds i8*, i8** %15, i64 0
%17 = load i8*, i8** %16
%18 = load i8**, i8*** %4
%19 = getelementptr inbounds i8*, i8** %18, i64 0
%20 = load i8*, i8** %19
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([311 x i8], [311 x i8]* @.str, i64 0, i64 0), i8* %17, i8* %20)
br label %112
22: ; preds = %11, %2
%23 = load i8**, i8*** %4
%24 = getelementptr inbounds i8*, i8** %23, i64 1
%25 = load i8*, i8** %24
%26 = call i32* @fopen(i8* %25, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %26, i32** %5
%27 = load i32*, i32** %5
%28 = icmp eq i32* %27, null
br i1 %28, label %29, label %34
29: ; preds = %22
%30 = load i8**, i8*** %4
%31 = getelementptr inbounds i8*, i8** %30, i64 1
%32 = load i8*, i8** %31
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.2, i64 0, i64 0), i8* %32)
br label %112
34: ; preds = %22
%35 = load i32, i32* %3
%36 = icmp eq i32 %35, 2
br i1 %36, label %37, label %64
37: ; preds = %34
%38 = load i32*, i32** %5
%39 = load i32, i32* @SEEK_END
%40 = call i32 @fseek(i32* %38, i32 -12, i32 %39)
%41 = load i32*, i32** %5
%42 = call i32 @fread(i32* %8, i32 1, i32 4, i32* %41)
%43 = load i32, i32* %8
%44 = icmp ne i32 %43, -559038737
br i1 %44, label %45, label %49
45: ; preds = %37
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([92 x i8], [92 x i8]* @.str.3, i64 0, i64 0))
%47 = load i32*, i32** %5
%48 = call i32 @fclose(i32* %47)
br label %112
49: ; preds = %37
%50 = load i32*, i32** %5
%51 = call i32 @fread(i32* %6, i32 4, i32 1, i32* %50)
%52 = load i32*, i32** %5
%53 = call i32 @fread(i32* %7, i32 4, i32 1, i32* %52)
%54 = load i32*, i32** %5
%55 = call i32 @fclose(i32* %54)
%56 = load i8**, i8*** %4
%57 = getelementptr inbounds i8*, i8** %56, i64 1
%58 = load i8*, i8** %57
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str.4, i64 0, i64 0), i8* %58)
%60 = load i32, i32* %6
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.5, i64 0, i64 0), i32 %60)
%62 = load i32, i32* %7
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.6, i64 0, i64 0), i32 %62)
br label %112
64: ; preds = %34
%65 = load i8**, i8*** %4
%66 = getelementptr inbounds i8*, i8** %65, i64 2
%67 = load i8*, i8** %66
%68 = call i32 @sscanf(i8* %67, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i32* %6)
%69 = load i32, i32* %6
%70 = icmp eq i32 %69, 0
br i1 %70, label %71, label %75
71: ; preds = %64
%72 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.8, i64 0, i64 0))
%73 = load i32*, i32** %5
%74 = call i32 @fclose(i32* %73)
br label %112
75: ; preds = %64
%76 = load i8**, i8*** %4
%77 = getelementptr inbounds i8*, i8** %76, i64 3
%78 = load i8*, i8** %77
%79 = call i32 @sscanf(i8* %78, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i32* %7)
%80 = load i32, i32* %7
%81 = icmp eq i32 %80, 0
br i1 %81, label %82, label %86
82: ; preds = %75
%83 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.9, i64 0, i64 0))
%84 = load i32*, i32** %5
%85 = call i32 @fclose(i32* %84)
br label %112
86: ; preds = %75
%87 = load i32*, i32** %5
%88 = load i32, i32* @SEEK_END
%89 = call i32 @fseek(i32* %87, i32 -12, i32 %88)
%90 = load i32*, i32** %5
%91 = call i32 @fread(i32* %8, i32 1, i32 4, i32* %90)
%92 = load i32, i32* %8
%93 = icmp eq i32 %92, -559038737
br i1 %93, label %94, label %96
94: ; preds = %86
%95 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([125 x i8], [125 x i8]* @.str.10, i64 0, i64 0))
br label %105
96: ; preds = %86
%97 = load i32*, i32** %5
%98 = call i32 @fclose(i32* %97)
%99 = load i8**, i8*** %4
%100 = getelementptr inbounds i8*, i8** %99, i64 1
%101 = load i8*, i8** %100
%102 = call i32* @fopen(i8* %101, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.11, i64 0, i64 0))
store i32* %102, i32** %5
store i32 -559038737, i32* %8
%103 = load i32*, i32** %5
%104 = call i32 @fwrite(i32* %8, i32 4, i32 1, i32* %103)
br label %105
105: ; preds = %96, %94
%106 = load i32*, i32** %5
%107 = call i32 @fwrite(i32* %6, i32 4, i32 1, i32* %106)
%108 = load i32*, i32** %5
%109 = call i32 @fwrite(i32* %7, i32 4, i32 1, i32* %108)
%110 = load i32*, i32** %5
%111 = call i32 @fclose(i32* %110)
br label %112
112: ; preds = %105, %82, %71, %49, %45, %29, %14
ret void
}

LLVM IR (-O2):
@.str = [311 x i8] c"\0A \D0\A4\D0\BE\D1\80\D0\BC\D0\B0\D1\82 \D0\BA\D0\BE\D0\BC\D0\B0\D0\BD\D0\B4\D0\BD\D0\BE\D0\B9 \D1\81\D1\82\D1\80\D0\BE\D0\BA\D0\B8:\0A %s <\D1\84\D0\B0\D0\B9\D0\BB \D0\B7\D0\B0\D0\B3\D1\80\D1\83\D0\B7\D1\87\D0\B8\D0\BA\D0\B0> <\D0\BA\D0\BE\D0\B4 \D1\87\D0\B8\D0\BF\D1\81\D0\B5\D1\82\D0\B0> <\D0\B0\D0\B4\D1\80\D0\B5\D1\81 \D0\B7\D0\B0\D0\B3\D1\80\D1\83\D0\B7\D0\BA\D0\B8> - \D0\B7\D0\B0\D0\BF\D0\B8\D1\81\D1\8C \D0\B1\D0\BB\D0\BE\D0\BA\D0\B0 \D0\B8\D0\B4\D0\B5\D0\BD\D1\82\D0\B8\D1\84\D0\B8\D0\BA\D0\B0\D1\86\D0\B8\D0\B8 \D0\B2 \D0\B7\D0\B0\D0\B3\D1\80\D1\83\D0\B7\D1\87\D0\B8\D0\BA\0A %s <\D1\84\D0\B0\D0\B9\D0\BB \D0\B7\D0\B0\D0\B3\D1\80\D1\83\D0\B7\D1\87\D0\B8\D0\BA\D0\B0> - \D0\BF\D1\80\D0\BE\D1\81\D0\BC\D0\BE\D1\82\D1\80 \D0\B1\D0\BB\D0\BE\D0\BA\D0\B0 \D0\B8\D0\B4\D0\B5\D0\BD\D1\82\D0\B8\D1\84\D0\B8\D0\BA\D0\B0\D1\86\D0\B8\D0\B8\0A\00"
@.str.1 = [3 x i8] c"r+\00"
@.str.2 = [47 x i8] c"\0A \D0\9E\D1\88\D0\B8\D0\B1\D0\BA\D0\B0 \D0\BE\D1\82\D0\BA\D1\80\D1\8B\D1\82\D0\B8\D1\8F \D1\84\D0\B0\D0\B9\D0\BB\D0\B0 %s\0A\00"
@SEEK_END = global i32 0
@.str.4 = [73 x i8] c"\0A \D0\9F\D0\B0\D1\80\D0\B0\D0\BC\D0\B5\D1\82\D1\80\D1\8B \D0\B8\D0\B4\D0\B5\D0\BD\D1\82\D0\B8\D1\84\D0\B8\D0\BA\D0\B0\D1\86\D0\B8\D0\B8 \D0\B7\D0\B0\D0\B3\D1\80\D1\83\D0\B7\D1\87\D0\B8\D0\BA\D0\B0 %s:\00"
@.str.5 = [33 x i8] c"\0A * \D0\9A\D0\BE\D0\B4 \D1\87\D0\B8\D0\BF\D1\81\D0\B5\D1\82\D0\B0 = 0x%x\00"
@.str.6 = [43 x i8] c"\0A * \D0\90\D0\B4\D1\80\D0\B5\D1\81 \D0\B7\D0\B0\D0\B3\D1\80\D1\83\D0\B7\D0\BA\D0\B8 = 0x%08x\0A\0A\00"
@.str.7 = [3 x i8] c"%x\00"
@.str.11 = [2 x i8] c"a\00"
@str = [124 x i8] c"\0A \D0\97\D0\B0\D0\B3\D1\80\D1\83\D0\B7\D1\87\D0\B8\D0\BA \D1\83\D0\B6\D0\B5 \D1\81\D0\BE\D0\B4\D0\B5\D1\80\D0\B6\D0\B8\D1\82 \D0\B2 \D1\81\D0\B5\D0\B1\D0\B5 \D0\B1\D0\BB\D0\BE\D0\BA \D0\B8\D0\B4\D0\B5\D0\BD\D1\82\D0\B8\D1\84\D0\B8\D0\BA\D0\B0\D1\86\D0\B8\D0\B8 - \D0\BF\D0\B5\D1\80\D0\B5\D0\B7\D0\B0\D0\BF\D0\B8\D1\81\D1\8B\D0\B2\D0\B0\D0\B5\D0\BC\00"
@str.12 = [38 x i8] c"\0A \D0\9D\D0\B5\D0\BF\D1\80\D0\B0\D0\B2\D0\B8\D0\BB\D1\8C\D0\BD\D1\8B\D0\B9 \D0\B0\D0\B4\D1\80\D0\B5\D1\81\00"
@str.13 = [49 x i8] c"\0A \D0\9D\D0\B5\D0\BF\D1\80\D0\B0\D0\B2\D0\B8\D0\BB\D1\8C\D0\BD\D1\8B\D0\B9 \D0\BA\D0\BE\D0\B4 \D1\87\D0\B8\D0\BF\D1\81\D0\B5\D1\82\D0\B0\00"
@str.14 = [91 x i8] c"\0A \D0\97\D0\B0\D0\B3\D1\80\D1\83\D0\B7\D1\87\D0\B8\D0\BA \D0\BD\D0\B5 \D1\81\D0\BE\D0\B4\D0\B5\D1\80\D0\B6\D0\B8\D1\82 \D0\B2 \D1\81\D0\B5\D0\B1\D0\B5 \D0\B1\D0\BB\D0\BE\D0\BA \D0\B8\D0\B4\D0\B5\D0\BD\D1\82\D0\B8\D1\84\D0\B8\D0\BA\D0\B0\D1\86\D0\B8\D0\B8\00"
define void @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = bitcast i32* %3 to i8*
%7 = bitcast i32* %4 to i8*
%8 = bitcast i32* %5 to i8*
switch i32 %0, label %9 [
i32 4, label %12
i32 2, label %12
]
9: ; preds = %2
%10 = load i8*, i8** %1
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([311 x i8], [311 x i8]* @.str, i64 0, i64 0), i8* %10, i8* %10)
br label %77
12: ; preds = %2, %2
%13 = getelementptr inbounds i8*, i8** %1, i64 1
%14 = load i8*, i8** %13
%15 = tail call i32* @fopen(i8* %14, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%16 = icmp eq i32* %15, null
br i1 %16, label %17, label %20
17: ; preds = %12
%18 = load i8*, i8** %13
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @.str.2, i64 0, i64 0), i8* %18)
br label %77
20: ; preds = %12
%21 = icmp eq i32 %0, 2
br i1 %21, label %22, label %41
22: ; preds = %20
%23 = load i32, i32* @SEEK_END
%24 = tail call i32 @fseek(i32* %15, i32 -12, i32 %23)
%25 = call i32 @fread(i32* %5, i32 1, i32 4, i32* %15)
%26 = load i32, i32* %5
%27 = icmp eq i32 %26, -559038737
br i1 %27, label %31, label %28
28: ; preds = %22
%29 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([91 x i8], [91 x i8]* @str.14, i64 0, i64 0))
%30 = tail call i32 @fclose(i32* %15)
br label %77
31: ; preds = %22
%32 = call i32 @fread(i32* %3, i32 4, i32 1, i32* %15)
%33 = call i32 @fread(i32* %4, i32 4, i32 1, i32* %15)
%34 = tail call i32 @fclose(i32* %15)
%35 = load i8*, i8** %13
%36 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([73 x i8], [73 x i8]* @.str.4, i64 0, i64 0), i8* %35)
%37 = load i32, i32* %3
%38 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.5, i64 0, i64 0), i32 %37)
%39 = load i32, i32* %4
%40 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.6, i64 0, i64 0), i32 %39)
br label %77
41: ; preds = %20
%42 = getelementptr inbounds i8*, i8** %1, i64 2
%43 = load i8*, i8** %42
%44 = call i32 @sscanf(i8* %43, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i32* %3)
%45 = load i32, i32* %3
%46 = icmp eq i32 %45, 0
br i1 %46, label %47, label %50
47: ; preds = %41
%48 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @str.13, i64 0, i64 0))
%49 = call i32 @fclose(i32* %15)
br label %77
50: ; preds = %41
%51 = getelementptr inbounds i8*, i8** %1, i64 3
%52 = load i8*, i8** %51
%53 = call i32 @sscanf(i8* %52, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i32* %4)
%54 = load i32, i32* %4
%55 = icmp eq i32 %54, 0
br i1 %55, label %56, label %59
56: ; preds = %50
%57 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str.12, i64 0, i64 0))
%58 = call i32 @fclose(i32* %15)
br label %77
59: ; preds = %50
%60 = load i32, i32* @SEEK_END
%61 = call i32 @fseek(i32* %15, i32 -12, i32 %60)
%62 = call i32 @fread(i32* %5, i32 1, i32 4, i32* %15)
%63 = load i32, i32* %5
%64 = icmp eq i32 %63, -559038737
br i1 %64, label %65, label %67
65: ; preds = %59
%66 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([124 x i8], [124 x i8]* @str, i64 0, i64 0))
br label %72
67: ; preds = %59
%68 = call i32 @fclose(i32* %15)
%69 = load i8*, i8** %13
%70 = call i32* @fopen(i8* %69, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.11, i64 0, i64 0))
store i32 -559038737, i32* %5
%71 = call i32 @fwrite(i32* %5, i32 4, i32 1, i32* %70)
br label %72
72: ; preds = %67, %65
%73 = phi i32* [ %15, %65 ], [ %70, %67 ]
%74 = call i32 @fwrite(i32* %3, i32 4, i32 1, i32* %73)
%75 = call i32 @fwrite(i32* %4, i32 4, i32 1, i32* %73)
%76 = call i32 @fclose(i32* %73)
br label %77
77: ; preds = %72, %56, %47, %31, %28, %17, %9
ret void
}