#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 uint8_t;
typedef int int16_t;

/* Variables and functions */
int /*<<< orphan*/ I2C_SLAVE;
int /*<<< orphan*/ O_RDWR;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ exit(int);
int ioctl(int, int /*<<< orphan*/, int);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int read(int, int *, int);
int /*<<< orphan*/ snprintf(char *, int, char *, int);
int write(int, int *, int);
int main() {
  int file;
  int adapter_nr = 1;
  char filename[20];
  int16_t result;
  float voltage, resistance = 0.0;
  int read_check, write_check = 0;
  uint8_t write_buf[3];
  uint8_t read_buf[2];
  float bit_v = 6.144 / 2048;
  snprintf(filename, 19, "/dev/i2c-%d", adapter_nr);
  file = open(filename, O_RDWR);
  if (file < 0) {
    printf("Error #1: error when opening file\n");
    exit(1);
  }
  int ioc;
  ioc = ioctl(file, I2C_SLAVE, 0x48);
  if (ioc < 0) {
    printf("Error #2: error when using ioctl\n");
    exit(1);
  }
  write_buf[0] = 1;
  write_buf[1] = 0xD1;
  write_buf[2] = 0x03;
  read_buf[0] = 0;
  read_buf[1] = 0;
  write_check = write(file, write_buf, 3);
  if (write_check != 3) {
    printf("Error #3: error when writing to device\n");
    exit(1);
  }
  while ((read_buf[0] & 0x80) == 0) {
    read_check = read(file, read_buf, 2);
    if (read_check != 2) {
      printf("Error #4: error while reading data\n");
      exit(1);
    }
  }
  write_buf[0] = 0;
  write_check = write(file, write_buf, 1);
  if (write_check != 1) {
    printf("Error#5: error while writing to pointer register\n");
    exit(1);
  }
  read_check = read(file, read_buf, 2);
  if (read_check != 2) {
    printf("Error#6: error while reading the converted data\n");
    exit(1);
  }
  result = read_buf[0] << 8 | read_buf[1];
  result = result >> 4;
  if (result > 0x07FF) {
    result |= 0xF000;
  }
  voltage = (float)result * bit_v;
  resistance = 10000 * (1 / ((3.29 / voltage) - 1));
  printf("\n================================Analysis==========================="
         "===============\n\n");
  printf("|\tVin\t|\tVout\t|\tR1\t\t|\tR2 Result\t|\n\n");
  printf("|\t3.3 V\t|\t%.2f V\t|\t%d ohms\t|\t%.2f ohms\t|\n", voltage, 10000,
         resistance);
  close(file);
  printf("\n\nEnd of Program\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0xc(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x2c(%rbp)
movl   $0x0,-0x34(%rbp)
movss  0xe53(%rip),%xmm0
movss  %xmm0,-0x4c(%rbp)
lea    -0x20(%rbp),%rdi
mov    -0xc(%rbp),%ecx
mov    $0x13,%esi
lea    0xe5b(%rip),%rdx
call   1050 <snprintf@plt>
lea    -0x20(%rbp),%rdi
mov    0x2e13(%rip),%rax
mov    (%rax),%esi
call   1090 <open@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    1201 <main+0x81>
lea    0xe3c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>
mov    -0x8(%rbp),%edi
mov    0x2dd5(%rip),%rax
mov    (%rax),%esi
mov    $0x48,%edx
call   1060 <ioctl@plt>
mov    %eax,-0x50(%rbp)
cmpl   $0x0,-0x50(%rbp)
jge    123c <main+0xbc>
lea    0xe24(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>
movl   $0x1,-0x40(%rbp)
movl   $0xd1,-0x3c(%rbp)
movl   $0x3,-0x38(%rbp)
movl   $0x0,-0x48(%rbp)
movl   $0x0,-0x44(%rbp)
mov    -0x8(%rbp),%edi
lea    -0x40(%rbp),%rsi
mov    $0x3,%edx
call   1030 <write@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0x3,-0x34(%rbp)
je     1295 <main+0x115>
lea    0xded(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>
jmp    129a <main+0x11a>
mov    -0x48(%rbp),%eax
and    $0x80,%eax
cmp    $0x0,%eax
jne    12e6 <main+0x166>
mov    -0x8(%rbp),%edi
lea    -0x48(%rbp),%rsi
mov    $0x2,%edx
call   1080 <read@plt>
mov    %eax,-0x30(%rbp)
cmpl   $0x2,-0x30(%rbp)
je     12e1 <main+0x161>
lea    0xdc9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>
jmp    129a <main+0x11a>
movl   $0x0,-0x40(%rbp)
mov    -0x8(%rbp),%edi
lea    -0x40(%rbp),%rsi
mov    $0x1,%edx
call   1030 <write@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0x1,-0x34(%rbp)
je     1323 <main+0x1a3>
lea    0xdab(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>
mov    -0x8(%rbp),%edi
lea    -0x48(%rbp),%rsi
mov    $0x2,%edx
call   1080 <read@plt>
mov    %eax,-0x30(%rbp)
cmpl   $0x2,-0x30(%rbp)
je     1359 <main+0x1d9>
lea    0xda7(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>
mov    -0x48(%rbp),%eax
shl    $0x8,%eax
or     -0x44(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
sar    $0x4,%eax
mov    %eax,-0x24(%rbp)
cmpl   $0x7ff,-0x24(%rbp)
jle    1386 <main+0x206>
mov    -0x24(%rbp),%eax
or     $0xf000,%eax
mov    %eax,-0x24(%rbp)
cvtsi2ssl -0x24(%rbp),%xmm0
mulss  -0x4c(%rbp),%xmm0
movss  %xmm0,-0x28(%rbp)
movss  -0x28(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xc72(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  0xc5e(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xc52(%rip),%xmm1
divsd  %xmm0,%xmm1
movsd  0xc3e(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x2c(%rbp)
lea    0xd42(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xd8a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movss  -0x28(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x2c(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xd8d(%rip),%rdi
mov    $0x2710,%esi
mov    $0x2,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%edi
call   1070 <close@plt>
lea    0xd9c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
sub    $0x38,%rsp
lea    0xe8b(%rip),%rdx
lea    0x20(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x13,%esi
mov    $0x1,%ecx
call   1060 <snprintf@plt>
mov    0x2e2d(%rip),%rax
mov    (%rax),%esi
mov    %rbx,%rdi
call   10a0 <open@plt>
test   %eax,%eax
js     1362 <main+0x1d2>
mov    %eax,%ebp
mov    0x2e0a(%rip),%rax
mov    (%rax),%esi
mov    %ebp,%edi
mov    $0x48,%edx
call   1070 <ioctl@plt>
test   %eax,%eax
js     136b <main+0x1db>
movabs $0xd100000001,%rax
mov    %rax,0xc(%rsp)
movl   $0x3,0x14(%rsp)
movq   $0x0,(%rsp)
lea    0xc(%rsp),%rsi
mov    %ebp,%edi
mov    $0x3,%edx
call   1040 <write@plt>
cmp    $0x3,%eax
jne    1374 <main+0x1e4>
mov    %rsp,%rbx
nopl   0x0(%rax,%rax,1)
mov    %ebp,%edi
mov    %rbx,%rsi
mov    $0x2,%edx
call   1090 <read@plt>
cmp    $0x2,%eax
jne    134c <main+0x1bc>
testb  $0x80,(%rsp)
je     1230 <main+0xa0>
movl   $0x0,0xc(%rsp)
lea    0xc(%rsp),%rsi
mov    %ebp,%edi
mov    $0x1,%edx
call   1040 <write@plt>
cmp    $0x1,%eax
jne    137d <main+0x1ed>
mov    %rsp,%rsi
mov    %ebp,%edi
mov    $0x2,%edx
call   1090 <read@plt>
cmp    $0x2,%eax
jne    1386 <main+0x1f6>
mov    (%rsp),%eax
shl    $0x8,%eax
or     0x4(%rsp),%eax
mov    %eax,%ecx
sar    $0x4,%ecx
mov    %ecx,%edx
or     $0xf000,%edx
cmp    $0x8000,%eax
cmovl  %ecx,%edx
cvtsi2ss %edx,%xmm0
mulss  0xd4d(%rip),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  %xmm1,0x18(%rsp)
movsd  0xd43(%rip),%xmm0
divsd  %xmm1,%xmm0
addsd  0xd3f(%rip),%xmm0
movsd  0xd3f(%rip),%xmm1
divsd  %xmm0,%xmm1
mulsd  0xd3b(%rip),%xmm1
xorps  %xmm0,%xmm0
cvtsd2ss %xmm1,%xmm0
movss  %xmm0,0x8(%rsp)
lea    0xd65(%rip),%rdi
call   1030 <puts@plt>
lea    0xdae(%rip),%rdi
call   1030 <puts@plt>
movss  0x8(%rsp),%xmm0
xorps  %xmm1,%xmm1
cvtss2sd %xmm0,%xmm1
lea    0xd16(%rip),%rdi
movsd  0x18(%rsp),%xmm0
mov    $0x2710,%esi
mov    $0x2,%al
call   1050 <printf@plt>
mov    %ebp,%edi
call   1080 <close@plt>
lea    0xd97(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %rbp
ret
lea    0xdf4(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>
lea    0xe49(%rip),%rdi
jmp    1353 <main+0x1c3>
lea    0xe1f(%rip),%rdi
jmp    1353 <main+0x1c3>
lea    0xdef(%rip),%rdi
jmp    1353 <main+0x1c3>
lea    0xd92(%rip),%rdi
jmp    1353 <main+0x1c3>
lea    0xd59(%rip),%rdi
jmp    1353 <main+0x1c3>

LLVM IR (-O0):
@.str = [12 x i8] c"/dev/i2c-%d\00"
@O_RDWR = global i32 0
@.str.1 = [35 x i8] c"Error: error when opening file\0A\00"
@I2C_SLAVE = global i32 0
@.str.2 = [34 x i8] c"Error: error when using ioctl\0A\00"
@.str.3 = [40 x i8] c"Error: error when writing to device\0A\00"
@.str.4 = [36 x i8] c"Error: error while reading data\0A\00"
@.str.5 = [50 x i8] c"Error: error while writing to pointer register\0A\00"
@.str.6 = [49 x i8] c"Error: error while reading the converted data\0A\00"
@.str.7 = [86 x i8] c"\0A================================Analysis==========================================\0A\0A\00"
@.str.8 = [35 x i8] c"|\09Vin\09|\09Vout\09|\09R1\09\09|\09R2 Result\09|\0A\0A\00"
@.str.9 = [42 x i8] c"|\093.3 V\09|\09%.2f V\09|\09%d ohms\09|\09%.2f ohms\09|\0A\00"
@.str.10 = [18 x i8] c"\0A\0AEnd of Program\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [20 x i8]
%5 = alloca i32
%6 = alloca float
%7 = alloca float
%8 = alloca i32
%9 = alloca i32
%10 = alloca [3 x i32]
%11 = alloca [2 x i32]
%12 = alloca float
%13 = alloca i32
store i32 0, i32* %1
store i32 1, i32* %3
store float 0.000000e+00, float* %7
store i32 0, i32* %9
store float 0x3F689374C0000000, float* %12
%14 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 0
%15 = load i32, i32* %3
%16 = call i32 @snprintf(i8* %14, i32 19, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %15)
%17 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 0
%18 = load i32, i32* @O_RDWR
%19 = call i32 @open(i8* %17, i32 %18)
store i32 %19, i32* %2
%20 = load i32, i32* %2
%21 = icmp slt i32 %20, 0
br i1 %21, label %22, label %25
22: ; preds = %0
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0))
%24 = call i32 @exit(i32 1)
unreachable
25: ; preds = %0
%26 = load i32, i32* %2
%27 = load i32, i32* @I2C_SLAVE
%28 = call i32 @ioctl(i32 %26, i32 %27, i32 72)
store i32 %28, i32* %13
%29 = load i32, i32* %13
%30 = icmp slt i32 %29, 0
br i1 %30, label %31, label %34
31: ; preds = %25
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0))
%33 = call i32 @exit(i32 1)
unreachable
34: ; preds = %25
%35 = getelementptr inbounds [3 x i32], [3 x i32]* %10, i64 0, i64 0
store i32 1, i32* %35
%36 = getelementptr inbounds [3 x i32], [3 x i32]* %10, i64 0, i64 1
store i32 209, i32* %36
%37 = getelementptr inbounds [3 x i32], [3 x i32]* %10, i64 0, i64 2
store i32 3, i32* %37
%38 = getelementptr inbounds [2 x i32], [2 x i32]* %11, i64 0, i64 0
store i32 0, i32* %38
%39 = getelementptr inbounds [2 x i32], [2 x i32]* %11, i64 0, i64 1
store i32 0, i32* %39
%40 = load i32, i32* %2
%41 = getelementptr inbounds [3 x i32], [3 x i32]* %10, i64 0, i64 0
%42 = call i32 @write(i32 %40, i32* %41, i32 3)
store i32 %42, i32* %9
%43 = load i32, i32* %9
%44 = icmp ne i32 %43, 3
br i1 %44, label %45, label %48
45: ; preds = %34
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.3, i64 0, i64 0))
%47 = call i32 @exit(i32 1)
unreachable
48: ; preds = %34
br label %49
49: ; preds = %63, %48
%50 = getelementptr inbounds [2 x i32], [2 x i32]* %11, i64 0, i64 0
%51 = load i32, i32* %50
%52 = and i32 %51, 128
%53 = icmp eq i32 %52, 0
br i1 %53, label %54, label %64
54: ; preds = %49
%55 = load i32, i32* %2
%56 = getelementptr inbounds [2 x i32], [2 x i32]* %11, i64 0, i64 0
%57 = call i32 @read(i32 %55, i32* %56, i32 2)
store i32 %57, i32* %8
%58 = load i32, i32* %8
%59 = icmp ne i32 %58, 2
br i1 %59, label %60, label %63
60: ; preds = %54
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.4, i64 0, i64 0))
%62 = call i32 @exit(i32 1)
unreachable
63: ; preds = %54
br label %49
64: ; preds = %49
%65 = getelementptr inbounds [3 x i32], [3 x i32]* %10, i64 0, i64 0
store i32 0, i32* %65
%66 = load i32, i32* %2
%67 = getelementptr inbounds [3 x i32], [3 x i32]* %10, i64 0, i64 0
%68 = call i32 @write(i32 %66, i32* %67, i32 1)
store i32 %68, i32* %9
%69 = load i32, i32* %9
%70 = icmp ne i32 %69, 1
br i1 %70, label %71, label %74
71: ; preds = %64
%72 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.5, i64 0, i64 0))
%73 = call i32 @exit(i32 1)
unreachable
74: ; preds = %64
%75 = load i32, i32* %2
%76 = getelementptr inbounds [2 x i32], [2 x i32]* %11, i64 0, i64 0
%77 = call i32 @read(i32 %75, i32* %76, i32 2)
store i32 %77, i32* %8
%78 = load i32, i32* %8
%79 = icmp ne i32 %78, 2
br i1 %79, label %80, label %83
80: ; preds = %74
%81 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.6, i64 0, i64 0))
%82 = call i32 @exit(i32 1)
unreachable
83: ; preds = %74
%84 = getelementptr inbounds [2 x i32], [2 x i32]* %11, i64 0, i64 0
%85 = load i32, i32* %84
%86 = shl i32 %85, 8
%87 = getelementptr inbounds [2 x i32], [2 x i32]* %11, i64 0, i64 1
%88 = load i32, i32* %87
%89 = or i32 %86, %88
store i32 %89, i32* %5
%90 = load i32, i32* %5
%91 = ashr i32 %90, 4
store i32 %91, i32* %5
%92 = load i32, i32* %5
%93 = icmp sgt i32 %92, 2047
br i1 %93, label %94, label %97
94: ; preds = %83
%95 = load i32, i32* %5
%96 = or i32 %95, 61440
store i32 %96, i32* %5
br label %97
97: ; preds = %94, %83
%98 = load i32, i32* %5
%99 = sitofp i32 %98 to float
%100 = load float, float* %12
%101 = fmul float %99, %100
store float %101, float* %6
%102 = load float, float* %6
%103 = fpext float %102 to double
%104 = fdiv double 3.290000e+00, %103
%105 = fsub double %104, 1.000000e+00
%106 = fdiv double 1.000000e+00, %105
%107 = fmul double 1.000000e+04, %106
%108 = fptrunc double %107 to float
store float %108, float* %7
%109 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([86 x i8], [86 x i8]* @.str.7, i64 0, i64 0))
%110 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.8, i64 0, i64 0))
%111 = load float, float* %6
%112 = fpext float %111 to double
%113 = load float, float* %7
%114 = fpext float %113 to double
%115 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.9, i64 0, i64 0), double %112, i32 10000, double %114)
%116 = load i32, i32* %2
%117 = call i32 @close(i32 %116)
%118 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.10, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [12 x i8] c"/dev/i2c-%d\00"
@O_RDWR = global i32 0
@I2C_SLAVE = global i32 0
@.str.9 = [42 x i8] c"|\093.3 V\09|\09%.2f V\09|\09%d ohms\09|\09%.2f ohms\09|\0A\00"
@str = [85 x i8] c"\0A================================Analysis==========================================\0A\00"
@str.11 = [34 x i8] c"|\09Vin\09|\09Vout\09|\09R1\09\09|\09R2 Result\09|\0A\00"
@str.12 = [17 x i8] c"\0A\0AEnd of Program\00"
@str.13 = [48 x i8] c"Error: error while reading the converted data\00"
@str.14 = [49 x i8] c"Error: error while writing to pointer register\00"
@str.15 = [35 x i8] c"Error: error while reading data\00"
@str.16 = [39 x i8] c"Error: error when writing to device\00"
@str.17 = [33 x i8] c"Error: error when using ioctl\00"
@str.18 = [34 x i8] c"Error: error when opening file\00"
define i32 @main() {
%1 = alloca [20 x i8]
%2 = alloca [3 x i32]
%3 = alloca [2 x i32]
%4 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%5 = bitcast [3 x i32]* %2 to i8*
%6 = bitcast [2 x i32]* %3 to i8*
%7 = call i32 @snprintf(i8* %4, i32 19, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 1)
%8 = load i32, i32* @O_RDWR
%9 = call i32 @open(i8* %4, i32 %8)
%10 = icmp slt i32 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %0
%12 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str.18, i64 0, i64 0))
%13 = call i32 @exit(i32 1)
unreachable
14: ; preds = %0
%15 = load i32, i32* @I2C_SLAVE
%16 = call i32 @ioctl(i32 %9, i32 %15, i32 72)
%17 = icmp slt i32 %16, 0
br i1 %17, label %18, label %21
18: ; preds = %14
%19 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.17, i64 0, i64 0))
%20 = call i32 @exit(i32 1)
unreachable
21: ; preds = %14
%22 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 0
store i32 1, i32* %22
%23 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 1
store i32 209, i32* %23
%24 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 2
store i32 3, i32* %24
%25 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 0
store i32 0, i32* %25
%26 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 1
store i32 0, i32* %26
%27 = call i32 @write(i32 %9, i32* %22, i32 3)
%28 = icmp eq i32 %27, 3
br i1 %28, label %32, label %29
29: ; preds = %21
%30 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str.16, i64 0, i64 0))
%31 = call i32 @exit(i32 1)
unreachable
32: ; preds = %21, %35
%33 = call i32 @read(i32 %9, i32* %25, i32 2)
%34 = icmp eq i32 %33, 2
br i1 %34, label %35, label %39
35: ; preds = %32
%36 = load i32, i32* %25
%37 = and i32 %36, 128
%38 = icmp eq i32 %37, 0
br i1 %38, label %32, label %42
39: ; preds = %32
%40 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str.15, i64 0, i64 0))
%41 = call i32 @exit(i32 1)
unreachable
42: ; preds = %35
store i32 0, i32* %22
%43 = call i32 @write(i32 %9, i32* %22, i32 1)
%44 = icmp eq i32 %43, 1
br i1 %44, label %48, label %45
45: ; preds = %42
%46 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @str.14, i64 0, i64 0))
%47 = call i32 @exit(i32 1)
unreachable
48: ; preds = %42
%49 = call i32 @read(i32 %9, i32* %25, i32 2)
%50 = icmp eq i32 %49, 2
br i1 %50, label %54, label %51
51: ; preds = %48
%52 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @str.13, i64 0, i64 0))
%53 = call i32 @exit(i32 1)
unreachable
54: ; preds = %48
%55 = load i32, i32* %25
%56 = shl i32 %55, 8
%57 = load i32, i32* %26
%58 = or i32 %56, %57
%59 = ashr i32 %58, 4
%60 = icmp sgt i32 %58, 32767
%61 = or i32 %59, 61440
%62 = select i1 %60, i32 %61, i32 %59
%63 = sitofp i32 %62 to float
%64 = fmul float %63, 0x3F689374C0000000
%65 = fpext float %64 to double
%66 = fdiv double 3.290000e+00, %65
%67 = fadd double %66, -1.000000e+00
%68 = fdiv double 1.000000e+00, %67
%69 = fmul double %68, 1.000000e+04
%70 = fptrunc double %69 to float
%71 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([85 x i8], [85 x i8]* @str, i64 0, i64 0))
%72 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str.11, i64 0, i64 0))
%73 = fpext float %70 to double
%74 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.9, i64 0, i64 0), double %65, i32 10000, double %73)
%75 = call i32 @close(i32 %9)
%76 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.12, i64 0, i64 0))
ret i32 0
}