#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 /*<<< orphan*/ fl;

/* Variables and functions */
int /*<<< orphan*/ O_RDONLY;
int creat(char *, int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int getopt(int, char **, char *);
int open(char *, int /*<<< orphan*/);
int optind;
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, int, int);
int process_sym_fl(float);
int read(int, float *, int);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ sym_int2bits(int, int *);
int write(int, int *, int);
int main(int argc, char **argv) {
  int fd, fd_out, opt;
  int opt_verbose = 0;
  while ((opt = getopt(argc, argv, "v")) != -1) {
    switch (opt) {
    case 'v':
      opt_verbose = 1;
      break;
    default:
      exit(2);
    }
  }
  if (argc <= optind + 1) {
    fprintf(stderr, "Usage: %s [-v] <infile> <outfile>\n", argv[0]);
    exit(2);
  }
  fd = open(argv[optind], O_RDONLY);
  if (fd < 0) {
    perror("open infile");
    exit(1);
  }
  fd_out = creat(argv[optind + 1], 0660);
  if (fd_out < 0) {
    perror("open outfile");
    exit(1);
  }
  while (1) {
    int rc;
    float fl;
    uint8_t bits[2];
    rc = read(fd, &fl, sizeof(fl));
    if (rc < 0) {
      perror("read");
      exit(1);
    } else if (rc == 0)
      break;
    rc = process_sym_fl(fl);
    sym_int2bits(rc, bits);
    if (opt_verbose)
      printf("%1u%1u", bits[0], bits[1]);
    rc = write(fd_out, bits, 2);
    if (rc < 0) {
      perror("write");
      exit(1);
    } else if (rc == 0)
      break;
  }
  exit(0);
}


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)
movl   $0x0,-0x20(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe25(%rip),%rdx
call   10a0 <getopt@plt>
mov    %eax,-0x1c(%rbp)
cmp    $0xffffffff,%eax
je     1218 <main+0x68>
mov    -0x1c(%rbp),%eax
sub    $0x76,%eax
jne    1209 <main+0x59>
jmp    11fd <main+0x4d>
movl   $0x1,-0x20(%rbp)
jmp    1213 <main+0x63>
mov    $0x2,%edi
call   10c0 <exit@plt>
jmp    11cd <main+0x1d>
mov    -0x8(%rbp),%eax
mov    0x2dbe(%rip),%rcx
mov    (%rcx),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jg     1255 <main+0xa5>
mov    0x2d9a(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xdbc(%rip),%rsi
call   1070 <fprintf@plt>
mov    $0x2,%edi
call   10c0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x2d80(%rip),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,8),%rdi
mov    0x2d7a(%rip),%rax
mov    (%rax),%esi
call   1080 <open@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    1298 <main+0xe8>
lea    0xd9c(%rip),%rdi
call   1090 <perror@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x2d3d(%rip),%rcx
mov    (%rcx),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
mov    $0x1b0,%esi
call   10b0 <creat@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jge    12dc <main+0x12c>
lea    0xd64(%rip),%rdi
call   1090 <perror@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
jmp    12e1 <main+0x131>
mov    -0x14(%rbp),%edi
lea    -0x28(%rbp),%rsi
mov    $0x4,%edx
call   1060 <read@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jge    1315 <main+0x165>
lea    0xd38(%rip),%rdi
call   1090 <perror@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
cmpl   $0x0,-0x24(%rbp)
jne    1324 <main+0x174>
jmp    13ab <main+0x1fb>
jmp    1329 <main+0x179>
movss  -0x28(%rbp),%xmm0
call   1030 <process_sym_fl@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%edi
lea    -0x30(%rbp),%rsi
call   10d0 <sym_int2bits@plt>
cmpl   $0x0,-0x20(%rbp)
je     135e <main+0x1ae>
mov    -0x30(%rbp),%esi
mov    -0x2c(%rbp),%edx
lea    0xcea(%rip),%rdi
call   1050 <printf@plt>
mov    -0x18(%rbp),%edi
lea    -0x30(%rbp),%rsi
mov    $0x2,%edx
call   1040 <write@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jge    1392 <main+0x1e2>
lea    0xcc7(%rip),%rdi
call   1090 <perror@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
cmpl   $0x0,-0x24(%rbp)
jne    13a1 <main+0x1f1>
jmp    13ab <main+0x1fb>
jmp    13a6 <main+0x1f6>
jmp    12e1 <main+0x131>
xor    %edi,%edi
call   10c0 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r15
mov    %edi,%ebp
mov    $0x1,%cl
lea    0xe34(%rip),%r14
nopl   0x0(%rax)
mov    %ecx,%ebx
mov    %ebp,%edi
mov    %r15,%rsi
mov    %r14,%rdx
call   10a0 <getopt@plt>
xor    %ecx,%ecx
cmp    $0x76,%eax
je     11d0 <main+0x20>
cmp    $0xffffffff,%eax
jne    121c <main+0x6c>
mov    0x2dee(%rip),%r12
movslq (%r12),%rax
lea    0x1(%rax),%ecx
cmp    %ebp,%ecx
jge    1226 <main+0x76>
mov    (%r15,%rax,8),%rdi
mov    0x2de0(%rip),%rax
mov    (%rax),%esi
call   1080 <open@plt>
test   %eax,%eax
jns    1248 <main+0x98>
lea    0xe0b(%rip),%rdi
jmp    128b <main+0xdb>
mov    $0x2,%edi
call   10c0 <exit@plt>
mov    0x2da3(%rip),%rax
mov    (%rax),%edi
mov    (%r15),%rdx
lea    0xdc9(%rip),%rsi
call   1070 <fprintf@plt>
mov    $0x2,%edi
call   10c0 <exit@plt>
mov    %eax,%r14d
movslq (%r12),%rax
mov    0x8(%r15,%rax,8),%rdi
mov    $0x1b0,%esi
call   10b0 <creat@plt>
test   %eax,%eax
jns    126b <main+0xbb>
lea    0xdc8(%rip),%rdi
jmp    128b <main+0xdb>
mov    %eax,%r13d
lea    0xc(%rsp),%rsi
mov    %r14d,%edi
mov    $0x4,%edx
call   1060 <read@plt>
test   %eax,%eax
jns    129a <main+0xea>
lea    0xdb3(%rip),%rdi
call   1090 <perror@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
lea    0x10(%rsp),%rbp
lea    0xc(%rsp),%r15
lea    0xd98(%rip),%r12
nopl   0x0(%rax,%rax,1)
test   %eax,%eax
je     130d <main+0x15d>
movss  0xc(%rsp),%xmm0
call   1030 <process_sym_fl@plt>
mov    %eax,%edi
mov    %rbp,%rsi
call   10d0 <sym_int2bits@plt>
test   $0x1,%bl
jne    12de <main+0x12e>
mov    0x10(%rsp),%esi
mov    0x14(%rsp),%edx
mov    %r12,%rdi
call   1050 <printf@plt>
mov    %r13d,%edi
mov    %rbp,%rsi
mov    $0x2,%edx
call   1040 <write@plt>
test   %eax,%eax
js     1314 <main+0x164>
je     130d <main+0x15d>
mov    %r14d,%edi
mov    %r15,%rsi
mov    $0x4,%edx
call   1060 <read@plt>
test   %eax,%eax
jns    12b0 <main+0x100>
jmp    1284 <main+0xd4>
xor    %edi,%edi
call   10c0 <exit@plt>
lea    0xd2f(%rip),%rdi
jmp    128b <main+0xdb>

LLVM IR (-O0):
@.str = [2 x i8] c"v\00"
@optind = global i32 0
@stderr = global i32 0
@.str.1 = [35 x i8] c"Usage: %s [-v] <infile> <outfile>\0A\00"
@O_RDONLY = global i32 0
@.str.2 = [12 x i8] c"open infile\00"
@.str.3 = [13 x i8] c"open outfile\00"
@.str.4 = [5 x i8] c"read\00"
@.str.5 = [7 x i8] c"%1u%1u\00"
@.str.6 = [6 x i8] c"write\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 i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca float
%12 = alloca [2 x i32]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %9
br label %13
13: ; preds = %23, %2
%14 = load i32, i32* %4
%15 = load i8**, i8*** %5
%16 = call i32 @getopt(i32 %14, i8** %15, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32 %16, i32* %8
%17 = icmp ne i32 %16, -1
br i1 %17, label %18, label %24
18: ; preds = %13
%19 = load i32, i32* %8
switch i32 %19, label %21 [
i32 118, label %20
]
20: ; preds = %18
store i32 1, i32* %9
br label %23
21: ; preds = %18
%22 = call i32 @exit(i32 2)
unreachable
23: ; preds = %20
br label %13
24: ; preds = %13
%25 = load i32, i32* %4
%26 = load i32, i32* @optind
%27 = add nsw i32 %26, 1
%28 = icmp sle i32 %25, %27
br i1 %28, label %29, label %36
29: ; preds = %24
%30 = load i32, i32* @stderr
%31 = load i8**, i8*** %5
%32 = getelementptr inbounds i8*, i8** %31, i64 0
%33 = load i8*, i8** %32
%34 = call i32 @fprintf(i32 %30, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i8* %33)
%35 = call i32 @exit(i32 2)
unreachable
36: ; preds = %24
%37 = load i8**, i8*** %5
%38 = load i32, i32* @optind
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds i8*, i8** %37, i64 %39
%41 = load i8*, i8** %40
%42 = load i32, i32* @O_RDONLY
%43 = call i32 @open(i8* %41, i32 %42)
store i32 %43, i32* %6
%44 = load i32, i32* %6
%45 = icmp slt i32 %44, 0
br i1 %45, label %46, label %49
46: ; preds = %36
%47 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%48 = call i32 @exit(i32 1)
unreachable
49: ; preds = %36
%50 = load i8**, i8*** %5
%51 = load i32, i32* @optind
%52 = add nsw i32 %51, 1
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds i8*, i8** %50, i64 %53
%55 = load i8*, i8** %54
%56 = call i32 @creat(i8* %55, i32 432)
store i32 %56, i32* %7
%57 = load i32, i32* %7
%58 = icmp slt i32 %57, 0
br i1 %58, label %59, label %62
59: ; preds = %49
%60 = call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
%61 = call i32 @exit(i32 1)
unreachable
62: ; preds = %49
br label %63
63: ; preds = %62, %104
%64 = load i32, i32* %6
%65 = call i32 @read(i32 %64, float* %11, i32 4)
store i32 %65, i32* %10
%66 = load i32, i32* %10
%67 = icmp slt i32 %66, 0
br i1 %67, label %68, label %71
68: ; preds = %63
%69 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%70 = call i32 @exit(i32 1)
unreachable
71: ; preds = %63
%72 = load i32, i32* %10
%73 = icmp eq i32 %72, 0
br i1 %73, label %74, label %75
74: ; preds = %71
br label %105
75: ; preds = %71
br label %76
76: ; preds = %75
%77 = load float, float* %11
%78 = call i32 @process_sym_fl(float %77)
store i32 %78, i32* %10
%79 = load i32, i32* %10
%80 = getelementptr inbounds [2 x i32], [2 x i32]* %12, i64 0, i64 0
%81 = call i32 @sym_int2bits(i32 %79, i32* %80)
%82 = load i32, i32* %9
%83 = icmp ne i32 %82, 0
br i1 %83, label %84, label %90
84: ; preds = %76
%85 = getelementptr inbounds [2 x i32], [2 x i32]* %12, i64 0, i64 0
%86 = load i32, i32* %85
%87 = getelementptr inbounds [2 x i32], [2 x i32]* %12, i64 0, i64 1
%88 = load i32, i32* %87
%89 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i32 %86, i32 %88)
br label %90
90: ; preds = %84, %76
%91 = load i32, i32* %7
%92 = getelementptr inbounds [2 x i32], [2 x i32]* %12, i64 0, i64 0
%93 = call i32 @write(i32 %91, i32* %92, i32 2)
store i32 %93, i32* %10
%94 = load i32, i32* %10
%95 = icmp slt i32 %94, 0
br i1 %95, label %96, label %99
96: ; preds = %90
%97 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
%98 = call i32 @exit(i32 1)
unreachable
99: ; preds = %90
%100 = load i32, i32* %10
%101 = icmp eq i32 %100, 0
br i1 %101, label %102, label %103
102: ; preds = %99
br label %105
103: ; preds = %99
br label %104
104: ; preds = %103
br label %63
105: ; preds = %102, %74
%106 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [2 x i8] c"v\00"
@optind = global i32 0
@stderr = global i32 0
@.str.1 = [35 x i8] c"Usage: %s [-v] <infile> <outfile>\0A\00"
@O_RDONLY = global i32 0
@.str.2 = [12 x i8] c"open infile\00"
@.str.3 = [13 x i8] c"open outfile\00"
@.str.4 = [5 x i8] c"read\00"
@.str.5 = [7 x i8] c"%1u%1u\00"
@.str.6 = [6 x i8] c"write\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca float
%4 = alloca [2 x i32]
br label %5
5: ; preds = %5, %2
%6 = phi i1 [ true, %2 ], [ false, %5 ]
%7 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
switch i32 %7, label %8 [
i32 -1, label %10
i32 118, label %5
]
8: ; preds = %5
%9 = tail call i32 @exit(i32 2)
unreachable
10: ; preds = %5
%11 = load i32, i32* @optind
%12 = add nsw i32 %11, 1
%13 = icmp slt i32 %12, %0
br i1 %13, label %19, label %14
14: ; preds = %10
%15 = load i32, i32* @stderr
%16 = load i8*, i8** %1
%17 = tail call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i8* %16)
%18 = tail call i32 @exit(i32 2)
unreachable
19: ; preds = %10
%20 = sext i32 %11 to i64
%21 = getelementptr inbounds i8*, i8** %1, i64 %20
%22 = load i8*, i8** %21
%23 = load i32, i32* @O_RDONLY
%24 = tail call i32 @open(i8* %22, i32 %23)
%25 = icmp slt i32 %24, 0
br i1 %25, label %26, label %29
26: ; preds = %19
%27 = tail call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%28 = tail call i32 @exit(i32 1)
unreachable
29: ; preds = %19
%30 = load i32, i32* @optind
%31 = add nsw i32 %30, 1
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i8*, i8** %1, i64 %32
%34 = load i8*, i8** %33
%35 = tail call i32 @creat(i8* %34, i32 432)
%36 = icmp slt i32 %35, 0
br i1 %36, label %45, label %37
37: ; preds = %29
%38 = bitcast float* %3 to i8*
%39 = bitcast [2 x i32]* %4 to i8*
%40 = call i32 @read(i32 %24, float* %3, i32 4)
%41 = icmp slt i32 %40, 0
br i1 %41, label %48, label %42
42: ; preds = %37
%43 = getelementptr inbounds [2 x i32], [2 x i32]* %4, i64 0, i64 0
%44 = getelementptr inbounds [2 x i32], [2 x i32]* %4, i64 0, i64 1
br label %51
45: ; preds = %29
%46 = tail call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
%47 = tail call i32 @exit(i32 1)
unreachable
48: ; preds = %70, %37
%49 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%50 = call i32 @exit(i32 1)
unreachable
51: ; preds = %42, %70
%52 = phi i32 [ %40, %42 ], [ %71, %70 ]
%53 = icmp eq i32 %52, 0
br i1 %53, label %73, label %54
54: ; preds = %51
%55 = load float, float* %3
%56 = call i32 @process_sym_fl(float %55)
%57 = call i32 @sym_int2bits(i32 %56, i32* %43)
br i1 %6, label %62, label %58
58: ; preds = %54
%59 = load i32, i32* %43
%60 = load i32, i32* %44
%61 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i32 %59, i32 %60)
br label %62
62: ; preds = %58, %54
%63 = call i32 @write(i32 %35, i32* %43, i32 2)
%64 = icmp slt i32 %63, 0
br i1 %64, label %65, label %68
65: ; preds = %62
%66 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
%67 = call i32 @exit(i32 1)
unreachable
68: ; preds = %62
%69 = icmp eq i32 %63, 0
br i1 %69, label %73, label %70
70: ; preds = %68
%71 = call i32 @read(i32 %24, float* %3, i32 4)
%72 = icmp slt i32 %71, 0
br i1 %72, label %48, label %51
73: ; preds = %68, %51
%74 = call i32 @exit(i32 0)
unreachable
}