#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 /*<<< orphan*/ O_RDWR;
int /*<<< orphan*/ R_OK;
scalar_t__ access(char *, int /*<<< orphan*/);
int /*<<< orphan*/ close(int);
int flash_to_file(int, int, char *);
scalar_t__ hexfile_to_flash(int, char *);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int prog_begin();
int /*<<< orphan*/ prog_end();
int spi_read(int, char *, int);
int main(int argc, char **argv) {
  int fd, ret;
  printf("Opening the spidev\n");
  fd = open("/dev/spidev0.0", O_RDWR);
  if (fd < 0) {
    printf("Open spidev device failed!\n");
    goto out;
  }
  ret = prog_begin();
  if (ret < 0) {
    printf("Initialize gpio failed.");
    goto out;
  }
  if (argc > 1) {
    if (access(argv[1], R_OK)) {
      printf("Reading from the device to %s\n", argv[1]);
      if ((ret = flash_to_file(fd, 0, argv[1])) < 0)
        goto outf;
    } else {
      printf("Writing %s to the device\n", argv[1]);
      if (hexfile_to_flash(fd, argv[1]) == 0)
        printf("Write succeeded\n");
    }
  } else {
    char temp[2];
    temp[0] = 0x05;
    if ((ret = spi_read(fd, temp, 2)) < 0)
      goto outf;
    ;
    printf("FSR: endebug%u,STP%u,WEN%u,RDYN%u,INFEN%u,RDISMB%u\n",
           temp[1] & 0x40, temp[1] & 020, temp[1] & 0x10, temp[1] & 0x8,
           temp[1] & 0x4, temp[1] & 0x2);
    temp[0] = 0x89;
    if ((ret = spi_read(fd, temp, 2)) < 0)
      goto outf;
    ;
    printf("FPCR NUPP: %u\n", temp[1] & 0x7f);
    printf("Backing up the info page\n");
    if ((ret = flash_to_file(fd, 1, "info_page.bin")) < 0)
      goto outf;
  }
outf:
  if (ret < 0)
    perror("Error");
  printf("Closing the spidev\n");
  prog_end();
  close(fd);
out:
  return ret;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe43(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2e1d(%rip),%rax
mov    (%rax),%esi
lea    0xe40(%rip),%rdi
call   1080 <open@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    11f9 <main+0x59>
lea    0xe36(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    13e0 <main+0x240>
mov    $0x0,%al
call   10c0 <prog_begin@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jge    1220 <main+0x80>
lea    0xe2b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    13e0 <main+0x240>
cmpl   $0x1,-0x8(%rbp)
jle    12d0 <main+0x130>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    0x2d9f(%rip),%rax
mov    (%rax),%esi
call   1090 <access@plt>
cmp    $0x0,%rax
je     1288 <main+0xe8>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xdfe(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x14(%rbp),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
xor    %esi,%esi
call   1030 <flash_to_file@plt>
mov    %eax,-0x18(%rbp)
cmp    $0x0,%eax
jge    1283 <main+0xe3>
jmp    13ad <main+0x20d>
jmp    12cb <main+0x12b>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xddf(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x14(%rbp),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
call   1070 <hexfile_to_flash@plt>
cmp    $0x0,%rax
jne    12c6 <main+0x126>
lea    0xdd1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    12cb <main+0x12b>
jmp    13a8 <main+0x208>
movb   $0x5,-0x1a(%rbp)
mov    -0x14(%rbp),%edi
lea    -0x1a(%rbp),%rsi
mov    $0x2,%edx
call   1060 <spi_read@plt>
mov    %eax,-0x18(%rbp)
cmp    $0x0,%eax
jge    12f6 <main+0x156>
jmp    13ad <main+0x20d>
movsbl -0x19(%rbp),%esi
and    $0x40,%esi
movsbl -0x19(%rbp),%edx
and    $0x10,%edx
movsbl -0x19(%rbp),%ecx
and    $0x10,%ecx
movsbl -0x19(%rbp),%r8d
and    $0x8,%r8d
movsbl -0x19(%rbp),%r9d
and    $0x4,%r9d
movsbl -0x19(%rbp),%eax
and    $0x2,%eax
lea    0xd76(%rip),%rdi
mov    %eax,(%rsp)
mov    $0x0,%al
call   1040 <printf@plt>
movb   $0x89,-0x1a(%rbp)
mov    -0x14(%rbp),%edi
lea    -0x1a(%rbp),%rsi
mov    $0x2,%edx
call   1060 <spi_read@plt>
mov    %eax,-0x18(%rbp)
cmp    $0x0,%eax
jge    135b <main+0x1bb>
jmp    13ad <main+0x20d>
movsbl -0x19(%rbp),%esi
and    $0x7f,%esi
lea    0xd6c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xd6d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x14(%rbp),%edi
mov    $0x1,%esi
lea    0xd71(%rip),%rdx
call   1030 <flash_to_file@plt>
mov    %eax,-0x18(%rbp)
cmp    $0x0,%eax
jge    13a3 <main+0x203>
jmp    13ad <main+0x20d>
jmp    13a8 <main+0x208>
jmp    13ad <main+0x20d>
cmpl   $0x0,-0x18(%rbp)
jge    13c3 <main+0x223>
lea    0xd4e(%rip),%rdi
call   10b0 <perror@plt>
lea    0xd48(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   10a0 <prog_end@plt>
mov    -0x14(%rbp),%edi
call   1050 <close@plt>
mov    -0x18(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r15
mov    %edi,%ebx
lea    0xef1(%rip),%rdi
call   1030 <puts@plt>
mov    0x2e16(%rip),%rax
mov    (%rax),%esi
lea    0xe25(%rip),%rdi
call   1090 <open@plt>
test   %eax,%eax
js     1234 <main+0x84>
mov    %eax,%r14d
xor    %eax,%eax
call   10d0 <prog_begin@plt>
mov    %eax,%ebp
test   %eax,%eax
js     1245 <main+0x95>
cmp    $0x2,%ebx
jl     1258 <main+0xa8>
mov    0x8(%r15),%rdi
mov    0x2dd4(%rip),%rax
mov    (%rax),%esi
call   10a0 <access@plt>
mov    0x8(%r15),%rsi
test   %rax,%rax
je     1329 <main+0x179>
lea    0xe08(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x8(%r15),%rdx
mov    %r14d,%edi
xor    %esi,%esi
jmp    12f6 <main+0x146>
lea    0xecb(%rip),%rdi
call   1030 <puts@plt>
jmp    131c <main+0x16c>
lea    0xdc3(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    131c <main+0x16c>
movb   $0x5,0x16(%rsp)
lea    0x16(%rsp),%rsi
mov    %r14d,%edi
mov    $0x2,%edx
call   1070 <spi_read@plt>
test   %eax,%eax
js     12fb <main+0x14b>
movzbl 0x17(%rsp),%eax
mov    %eax,%esi
and    $0x40,%esi
mov    %eax,%ecx
and    $0x10,%ecx
mov    %eax,%r8d
and    $0x8,%r8d
mov    %eax,%r9d
and    $0x4,%r9d
and    $0x2,%eax
mov    %eax,(%rsp)
lea    0xdbf(%rip),%rdi
mov    %ecx,%edx
xor    %eax,%eax
call   1050 <printf@plt>
movb   $0x89,0x16(%rsp)
lea    0x16(%rsp),%rsi
mov    %r14d,%edi
mov    $0x2,%edx
call   1070 <spi_read@plt>
test   %eax,%eax
js     12fb <main+0x14b>
movzbl 0x17(%rsp),%esi
and    $0x7f,%esi
lea    0xdc0(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xde8(%rip),%rdi
call   1030 <puts@plt>
lea    0xdb5(%rip),%rdx
mov    %r14d,%edi
mov    $0x1,%esi
call   1040 <flash_to_file@plt>
mov    %eax,%ebp
test   %eax,%eax
js     1356 <main+0x1a6>
lea    0xddb(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   10b0 <prog_end@plt>
mov    %r14d,%edi
call   1060 <close@plt>
mov    %ebp,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xd16(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x8(%r15),%rsi
mov    %r14d,%edi
call   1080 <hexfile_to_flash@plt>
test   %rax,%rax
jne    1301 <main+0x151>
lea    0xda7(%rip),%rdi
call   1030 <puts@plt>
jmp    1301 <main+0x151>
lea    0xd54(%rip),%rdi
call   10c0 <perror@plt>
jmp    1301 <main+0x151>

LLVM IR (-O0):
@.str = [20 x i8] c"Opening the spidev\0A\00"
@.str.1 = [15 x i8] c"/dev/spidev0.0\00"
@O_RDWR = global i32 0
@.str.2 = [28 x i8] c"Open spidev device failed!\0A\00"
@.str.3 = [24 x i8] c"Initialize gpio failed.\00"
@R_OK = global i32 0
@.str.4 = [31 x i8] c"Reading from the device to %s\0A\00"
@.str.5 = [26 x i8] c"Writing %s to the device\0A\00"
@.str.6 = [17 x i8] c"Write succeeded\0A\00"
@.str.7 = [52 x i8] c"FSR: endebug%u,STP%u,WEN%u,RDYN%u,INFEN%u,RDISMB%u\0A\00"
@.str.8 = [15 x i8] c"FPCR NUPP: %u\0A\00"
@.str.9 = [26 x i8] c"Backing up the info page\0A\00"
@.str.10 = [14 x i8] c"info_page.bin\00"
@.str.11 = [6 x i8] c"Error\00"
@.str.12 = [20 x i8] c"Closing the spidev\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca [2 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%10 = load i32, i32* @O_RDWR
%11 = call i32 @open(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 %10)
store i32 %11, i32* %6
%12 = load i32, i32* %6
%13 = icmp slt i32 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %2
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0))
br label %122
16: ; preds = %2
%17 = call i32 (...) @prog_begin()
store i32 %17, i32* %7
%18 = load i32, i32* %7
%19 = icmp slt i32 %18, 0
br i1 %19, label %20, label %22
20: ; preds = %16
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0))
br label %122
22: ; preds = %16
%23 = load i32, i32* %4
%24 = icmp sgt i32 %23, 1
br i1 %24, label %25, label %60
25: ; preds = %22
%26 = load i8**, i8*** %5
%27 = getelementptr inbounds i8*, i8** %26, i64 1
%28 = load i8*, i8** %27
%29 = load i32, i32* @R_OK
%30 = call i64 @access(i8* %28, i32 %29)
%31 = icmp ne i64 %30, 0
br i1 %31, label %32, label %45
32: ; preds = %25
%33 = load i8**, i8*** %5
%34 = getelementptr inbounds i8*, i8** %33, i64 1
%35 = load i8*, i8** %34
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.4, i64 0, i64 0), i8* %35)
%37 = load i32, i32* %6
%38 = load i8**, i8*** %5
%39 = getelementptr inbounds i8*, i8** %38, i64 1
%40 = load i8*, i8** %39
%41 = call i32 @flash_to_file(i32 %37, i32 0, i8* %40)
store i32 %41, i32* %7
%42 = icmp slt i32 %41, 0
br i1 %42, label %43, label %44
43: ; preds = %32
br label %112
44: ; preds = %32
br label %59
45: ; preds = %25
%46 = load i8**, i8*** %5
%47 = getelementptr inbounds i8*, i8** %46, i64 1
%48 = load i8*, i8** %47
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0), i8* %48)
%50 = load i32, i32* %6
%51 = load i8**, i8*** %5
%52 = getelementptr inbounds i8*, i8** %51, i64 1
%53 = load i8*, i8** %52
%54 = call i64 @hexfile_to_flash(i32 %50, i8* %53)
%55 = icmp eq i64 %54, 0
br i1 %55, label %56, label %58
56: ; preds = %45
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.6, i64 0, i64 0))
br label %58
58: ; preds = %56, %45
br label %59
59: ; preds = %58, %44
br label %111
60: ; preds = %22
%61 = getelementptr inbounds [2 x i8], [2 x i8]* %8, i64 0, i64 0
store i8 5, i8* %61
%62 = load i32, i32* %6
%63 = getelementptr inbounds [2 x i8], [2 x i8]* %8, i64 0, i64 0
%64 = call i32 @spi_read(i32 %62, i8* %63, i32 2)
store i32 %64, i32* %7
%65 = icmp slt i32 %64, 0
br i1 %65, label %66, label %67
66: ; preds = %60
br label %112
67: ; preds = %60
%68 = getelementptr inbounds [2 x i8], [2 x i8]* %8, i64 0, i64 1
%69 = load i8, i8* %68
%70 = sext i8 %69 to i32
%71 = and i32 %70, 64
%72 = getelementptr inbounds [2 x i8], [2 x i8]* %8, i64 0, i64 1
%73 = load i8, i8* %72
%74 = sext i8 %73 to i32
%75 = and i32 %74, 16
%76 = getelementptr inbounds [2 x i8], [2 x i8]* %8, i64 0, i64 1
%77 = load i8, i8* %76
%78 = sext i8 %77 to i32
%79 = and i32 %78, 16
%80 = getelementptr inbounds [2 x i8], [2 x i8]* %8, i64 0, i64 1
%81 = load i8, i8* %80
%82 = sext i8 %81 to i32
%83 = and i32 %82, 8
%84 = getelementptr inbounds [2 x i8], [2 x i8]* %8, i64 0, i64 1
%85 = load i8, i8* %84
%86 = sext i8 %85 to i32
%87 = and i32 %86, 4
%88 = getelementptr inbounds [2 x i8], [2 x i8]* %8, i64 0, i64 1
%89 = load i8, i8* %88
%90 = sext i8 %89 to i32
%91 = and i32 %90, 2
%92 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.7, i64 0, i64 0), i32 %71, i32 %75, i32 %79, i32 %83, i32 %87, i32 %91)
%93 = getelementptr inbounds [2 x i8], [2 x i8]* %8, i64 0, i64 0
store i8 -119, i8* %93
%94 = load i32, i32* %6
%95 = getelementptr inbounds [2 x i8], [2 x i8]* %8, i64 0, i64 0
%96 = call i32 @spi_read(i32 %94, i8* %95, i32 2)
store i32 %96, i32* %7
%97 = icmp slt i32 %96, 0
br i1 %97, label %98, label %99
98: ; preds = %67
br label %112
99: ; preds = %67
%100 = getelementptr inbounds [2 x i8], [2 x i8]* %8, i64 0, i64 1
%101 = load i8, i8* %100
%102 = sext i8 %101 to i32
%103 = and i32 %102, 127
%104 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.8, i64 0, i64 0), i32 %103)
%105 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.9, i64 0, i64 0))
%106 = load i32, i32* %6
%107 = call i32 @flash_to_file(i32 %106, i32 1, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.10, i64 0, i64 0))
store i32 %107, i32* %7
%108 = icmp slt i32 %107, 0
br i1 %108, label %109, label %110
109: ; preds = %99
br label %112
110: ; preds = %99
br label %111
111: ; preds = %110, %59
br label %112
112: ; preds = %111, %109, %98, %66, %43
%113 = load i32, i32* %7
%114 = icmp slt i32 %113, 0
br i1 %114, label %115, label %117
115: ; preds = %112
%116 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.11, i64 0, i64 0))
br label %117
117: ; preds = %115, %112
%118 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.12, i64 0, i64 0))
%119 = call i32 (...) @prog_end()
%120 = load i32, i32* %6
%121 = call i32 @close(i32 %120)
br label %122
122: ; preds = %117, %20, %14
%123 = load i32, i32* %7
ret i32 %123
}

LLVM IR (-O2):
@.str.1 = [15 x i8] c"/dev/spidev0.0\00"
@O_RDWR = global i32 0
@.str.3 = [24 x i8] c"Initialize gpio failed.\00"
@R_OK = global i32 0
@.str.4 = [31 x i8] c"Reading from the device to %s\0A\00"
@.str.5 = [26 x i8] c"Writing %s to the device\0A\00"
@.str.7 = [52 x i8] c"FSR: endebug%u,STP%u,WEN%u,RDYN%u,INFEN%u,RDISMB%u\0A\00"
@.str.8 = [15 x i8] c"FPCR NUPP: %u\0A\00"
@.str.10 = [14 x i8] c"info_page.bin\00"
@.str.11 = [6 x i8] c"Error\00"
@str = [19 x i8] c"Opening the spidev\00"
@str.13 = [25 x i8] c"Backing up the info page\00"
@str.14 = [19 x i8] c"Closing the spidev\00"
@str.15 = [16 x i8] c"Write succeeded\00"
@str.16 = [27 x i8] c"Open spidev device failed!\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [2 x i8]
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
%5 = load i32, i32* @O_RDWR
%6 = tail call i32 @open(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 %5)
%7 = icmp slt i32 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.16, i64 0, i64 0))
br label %70
10: ; preds = %2
%11 = tail call i32 (...) @prog_begin()
%12 = icmp slt i32 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %10
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0))
br label %70
15: ; preds = %10
%16 = icmp sgt i32 %0, 1
br i1 %16, label %17, label %35
17: ; preds = %15
%18 = getelementptr inbounds i8*, i8** %1, i64 1
%19 = load i8*, i8** %18
%20 = load i32, i32* @R_OK
%21 = tail call i64 @access(i8* %19, i32 %20)
%22 = icmp eq i64 %21, 0
%23 = load i8*, i8** %18
br i1 %22, label %28, label %24
24: ; preds = %17
%25 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.4, i64 0, i64 0), i8* %23)
%26 = load i8*, i8** %18
%27 = tail call i32 @flash_to_file(i32 %6, i32 0, i8* %26)
br label %60
28: ; preds = %17
%29 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0), i8* %23)
%30 = load i8*, i8** %18
%31 = tail call i64 @hexfile_to_flash(i32 %6, i8* %30)
%32 = icmp eq i64 %31, 0
br i1 %32, label %33, label %65
33: ; preds = %28
%34 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.15, i64 0, i64 0))
br label %65
35: ; preds = %15
%36 = getelementptr inbounds [2 x i8], [2 x i8]* %3, i64 0, i64 0
store i8 5, i8* %36
%37 = call i32 @spi_read(i32 %6, i8* %36, i32 2)
%38 = icmp slt i32 %37, 0
br i1 %38, label %58, label %39
39: ; preds = %35
%40 = getelementptr inbounds [2 x i8], [2 x i8]* %3, i64 0, i64 1
%41 = load i8, i8* %40
%42 = zext i8 %41 to i32
%43 = and i32 %42, 64
%44 = and i32 %42, 16
%45 = and i32 %42, 8
%46 = and i32 %42, 4
%47 = and i32 %42, 2
%48 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @.str.7, i64 0, i64 0), i32 %43, i32 %44, i32 %44, i32 %45, i32 %46, i32 %47)
store i8 -119, i8* %36
%49 = call i32 @spi_read(i32 %6, i8* %36, i32 2)
%50 = icmp slt i32 %49, 0
br i1 %50, label %58, label %51
51: ; preds = %39
%52 = load i8, i8* %40
%53 = and i8 %52, 127
%54 = zext i8 %53 to i32
%55 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.8, i64 0, i64 0), i32 %54)
%56 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.13, i64 0, i64 0))
%57 = call i32 @flash_to_file(i32 %6, i32 1, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.10, i64 0, i64 0))
br label %58
58: ; preds = %51, %39, %35
%59 = phi i32 [ %37, %35 ], [ %49, %39 ], [ %57, %51 ]
br label %60
60: ; preds = %58, %24
%61 = phi i32 [ %27, %24 ], [ %59, %58 ]
%62 = icmp slt i32 %61, 0
br i1 %62, label %63, label %65
63: ; preds = %60
%64 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.11, i64 0, i64 0))
br label %65
65: ; preds = %28, %33, %63, %60
%66 = phi i32 [ %61, %63 ], [ %61, %60 ], [ %11, %33 ], [ %11, %28 ]
%67 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.14, i64 0, i64 0))
%68 = call i32 (...) @prog_end()
%69 = call i32 @close(i32 %6)
br label %70
70: ; preds = %8, %13, %65
%71 = phi i32 [ undef, %8 ], [ %11, %13 ], [ %66, %65 ]
ret i32 %71
}