#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 */
unsigned char hex2ui(char);
int /*<<< orphan*/ write_wave(int /*<<< orphan*/ *, double, double);
void write_line(FILE *wavfile, char c1, char c2, char c3) {
  unsigned char ui;
  ui = hex2ui(c1);
  if (ui & 0x1)
    write_wave(wavfile, 0.047, 1136.0);
  else
    write_wave(wavfile, 0.047, 568.0);
  if (ui & 0x2)
    write_wave(wavfile, 0.063, 1136.0);
  else
    write_wave(wavfile, 0.063, 568.0);
  if (ui & 0x4)
    write_wave(wavfile, 0.063, 1136.0);
  else
    write_wave(wavfile, 0.063, 568.0);
  if (ui & 0x8)
    write_wave(wavfile, 0.063, 1136.0);
  else
    write_wave(wavfile, 0.063, 568.0);
  ui = hex2ui(c2);
  if (ui & 0x1)
    write_wave(wavfile, 0.063, 1136.0);
  else
    write_wave(wavfile, 0.063, 568.0);
  if (ui & 0x2)
    write_wave(wavfile, 0.063, 1136.0);
  else
    write_wave(wavfile, 0.063, 568.0);
  if (ui & 0x4)
    write_wave(wavfile, 0.063, 1136.0);
  else
    write_wave(wavfile, 0.063, 568.0);
  if (ui & 0x8)
    write_wave(wavfile, 0.063, 1136.0);
  else
    write_wave(wavfile, 0.063, 568.0);
  ui = hex2ui(c3);
  if (ui & 0x1)
    write_wave(wavfile, 0.063, 1136.0);
  else
    write_wave(wavfile, 0.063, 568.0);
  if (ui & 0x2)
    write_wave(wavfile, 0.063, 1136.0);
  else
    write_wave(wavfile, 0.063, 568.0);
  if (ui & 0x4)
    write_wave(wavfile, 0.063, 1136.0);
  else
    write_wave(wavfile, 0.063, 568.0);
  if (ui & 0x8)
    write_wave(wavfile, 0.063, 1136.0);
  else
    write_wave(wavfile, 0.063, 568.0);
}


x86 assembly (clang, -O0):
<write_line>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %cl,%al
mov    %dl,%cl
mov    %sil,%dl
mov    %rdi,-0x8(%rbp)
mov    %dl,-0x9(%rbp)
mov    %cl,-0xa(%rbp)
mov    %al,-0xb(%rbp)
movsbl -0x9(%rbp),%edi
call   1040 <hex2ui@plt>
mov    %al,-0xc(%rbp)
movzbl -0xc(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     1176 <write_line+0x56>
mov    -0x8(%rbp),%rdi
movsd  0xe9c(%rip),%xmm0
movsd  0xea4(%rip),%xmm1
call   1030 <write_wave@plt>
jmp    118f <write_line+0x6f>
mov    -0x8(%rbp),%rdi
movsd  0xe7e(%rip),%xmm0
movsd  0xe7e(%rip),%xmm1
call   1030 <write_wave@plt>
movzbl -0xc(%rbp),%eax
and    $0x2,%eax
cmp    $0x0,%eax
je     11bd <write_line+0x9d>
mov    -0x8(%rbp),%rdi
movsd  0xe6d(%rip),%xmm0
movsd  0xe5d(%rip),%xmm1
call   1030 <write_wave@plt>
jmp    11d6 <write_line+0xb6>
mov    -0x8(%rbp),%rdi
movsd  0xe4f(%rip),%xmm0
movsd  0xe37(%rip),%xmm1
call   1030 <write_wave@plt>
movzbl -0xc(%rbp),%eax
and    $0x4,%eax
cmp    $0x0,%eax
je     1204 <write_line+0xe4>
mov    -0x8(%rbp),%rdi
movsd  0xe26(%rip),%xmm0
movsd  0xe16(%rip),%xmm1
call   1030 <write_wave@plt>
jmp    121d <write_line+0xfd>
mov    -0x8(%rbp),%rdi
movsd  0xe08(%rip),%xmm0
movsd  0xdf0(%rip),%xmm1
call   1030 <write_wave@plt>
movzbl -0xc(%rbp),%eax
and    $0x8,%eax
cmp    $0x0,%eax
je     124b <write_line+0x12b>
mov    -0x8(%rbp),%rdi
movsd  0xddf(%rip),%xmm0
movsd  0xdcf(%rip),%xmm1
call   1030 <write_wave@plt>
jmp    1264 <write_line+0x144>
mov    -0x8(%rbp),%rdi
movsd  0xdc1(%rip),%xmm0
movsd  0xda9(%rip),%xmm1
call   1030 <write_wave@plt>
movsbl -0xa(%rbp),%edi
call   1040 <hex2ui@plt>
mov    %al,-0xc(%rbp)
movzbl -0xc(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     129e <write_line+0x17e>
mov    -0x8(%rbp),%rdi
movsd  0xd8c(%rip),%xmm0
movsd  0xd7c(%rip),%xmm1
call   1030 <write_wave@plt>
jmp    12b7 <write_line+0x197>
mov    -0x8(%rbp),%rdi
movsd  0xd6e(%rip),%xmm0
movsd  0xd56(%rip),%xmm1
call   1030 <write_wave@plt>
movzbl -0xc(%rbp),%eax
and    $0x2,%eax
cmp    $0x0,%eax
je     12e5 <write_line+0x1c5>
mov    -0x8(%rbp),%rdi
movsd  0xd45(%rip),%xmm0
movsd  0xd35(%rip),%xmm1
call   1030 <write_wave@plt>
jmp    12fe <write_line+0x1de>
mov    -0x8(%rbp),%rdi
movsd  0xd27(%rip),%xmm0
movsd  0xd0f(%rip),%xmm1
call   1030 <write_wave@plt>
movzbl -0xc(%rbp),%eax
and    $0x4,%eax
cmp    $0x0,%eax
je     132c <write_line+0x20c>
mov    -0x8(%rbp),%rdi
movsd  0xcfe(%rip),%xmm0
movsd  0xcee(%rip),%xmm1
call   1030 <write_wave@plt>
jmp    1345 <write_line+0x225>
mov    -0x8(%rbp),%rdi
movsd  0xce0(%rip),%xmm0
movsd  0xcc8(%rip),%xmm1
call   1030 <write_wave@plt>
movzbl -0xc(%rbp),%eax
and    $0x8,%eax
cmp    $0x0,%eax
je     1373 <write_line+0x253>
mov    -0x8(%rbp),%rdi
movsd  0xcb7(%rip),%xmm0
movsd  0xca7(%rip),%xmm1
call   1030 <write_wave@plt>
jmp    138c <write_line+0x26c>
mov    -0x8(%rbp),%rdi
movsd  0xc99(%rip),%xmm0
movsd  0xc81(%rip),%xmm1
call   1030 <write_wave@plt>
movsbl -0xb(%rbp),%edi
call   1040 <hex2ui@plt>
mov    %al,-0xc(%rbp)
movzbl -0xc(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     13c6 <write_line+0x2a6>
mov    -0x8(%rbp),%rdi
movsd  0xc64(%rip),%xmm0
movsd  0xc54(%rip),%xmm1
call   1030 <write_wave@plt>
jmp    13df <write_line+0x2bf>
mov    -0x8(%rbp),%rdi
movsd  0xc46(%rip),%xmm0
movsd  0xc2e(%rip),%xmm1
call   1030 <write_wave@plt>
movzbl -0xc(%rbp),%eax
and    $0x2,%eax
cmp    $0x0,%eax
je     140d <write_line+0x2ed>
mov    -0x8(%rbp),%rdi
movsd  0xc1d(%rip),%xmm0
movsd  0xc0d(%rip),%xmm1
call   1030 <write_wave@plt>
jmp    1426 <write_line+0x306>
mov    -0x8(%rbp),%rdi
movsd  0xbff(%rip),%xmm0
movsd  0xbe7(%rip),%xmm1
call   1030 <write_wave@plt>
movzbl -0xc(%rbp),%eax
and    $0x4,%eax
cmp    $0x0,%eax
je     1454 <write_line+0x334>
mov    -0x8(%rbp),%rdi
movsd  0xbd6(%rip),%xmm0
movsd  0xbc6(%rip),%xmm1
call   1030 <write_wave@plt>
jmp    146d <write_line+0x34d>
mov    -0x8(%rbp),%rdi
movsd  0xbb8(%rip),%xmm0
movsd  0xba0(%rip),%xmm1
call   1030 <write_wave@plt>
movzbl -0xc(%rbp),%eax
and    $0x8,%eax
cmp    $0x0,%eax
je     149b <write_line+0x37b>
mov    -0x8(%rbp),%rdi
movsd  0xb8f(%rip),%xmm0
movsd  0xb7f(%rip),%xmm1
call   1030 <write_wave@plt>
jmp    14b4 <write_line+0x394>
mov    -0x8(%rbp),%rdi
movsd  0xb71(%rip),%xmm0
movsd  0xb59(%rip),%xmm1
call   1030 <write_wave@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_line>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %ecx,%r14d
mov    %edx,%r15d
mov    %rdi,%rbp
mov    %esi,%edi
call   1040 <hex2ui@plt>
mov    %eax,%ebx
movsd  0xebf(%rip),%xmm1
movsd  %xmm1,(%rsp)
test   $0x1,%al
je     1152 <write_line+0x32>
movsd  0xeb6(%rip),%xmm1
movsd  0xeb6(%rip),%xmm0
mov    %rbp,%rdi
call   1030 <write_wave@plt>
movsd  0xe96(%rip),%xmm1
test   $0x2,%bl
je     1177 <write_line+0x57>
movsd  0xe91(%rip),%xmm1
movsd  0xe99(%rip),%xmm0
mov    %rbp,%rdi
call   1030 <write_wave@plt>
movsd  0xe71(%rip),%xmm1
test   $0x4,%bl
je     119c <write_line+0x7c>
movsd  0xe6c(%rip),%xmm1
mov    %rbp,%rdi
movsd  0xe71(%rip),%xmm0
call   1030 <write_wave@plt>
movsd  0xe4c(%rip),%xmm1
test   $0x8,%bl
je     11c1 <write_line+0xa1>
movsd  0xe47(%rip),%xmm1
mov    %rbp,%rdi
movsd  0xe4c(%rip),%xmm0
call   1030 <write_wave@plt>
mov    %r15d,%edi
call   1040 <hex2ui@plt>
mov    %eax,%ebx
movsd  0xe1d(%rip),%xmm1
test   $0x1,%al
je     11ef <write_line+0xcf>
movsd  0xe19(%rip),%xmm1
mov    %rbp,%rdi
movsd  0xe1e(%rip),%xmm0
call   1030 <write_wave@plt>
movsd  0xdf9(%rip),%xmm1
test   $0x2,%bl
je     1214 <write_line+0xf4>
movsd  0xdf4(%rip),%xmm1
mov    %rbp,%rdi
movsd  0xdf9(%rip),%xmm0
call   1030 <write_wave@plt>
movsd  0xdd4(%rip),%xmm1
test   $0x4,%bl
je     1239 <write_line+0x119>
movsd  0xdcf(%rip),%xmm1
mov    %rbp,%rdi
movsd  0xdd4(%rip),%xmm0
call   1030 <write_wave@plt>
movsd  0xdaf(%rip),%xmm1
test   $0x8,%bl
je     125e <write_line+0x13e>
movsd  0xdaa(%rip),%xmm1
mov    %rbp,%rdi
movsd  0xdaf(%rip),%xmm0
call   1030 <write_wave@plt>
mov    %r14d,%edi
call   1040 <hex2ui@plt>
mov    %eax,%ebx
movsd  0xd80(%rip),%xmm1
test   $0x1,%al
je     128c <write_line+0x16c>
movsd  0xd7c(%rip),%xmm1
mov    %rbp,%rdi
movsd  0xd81(%rip),%xmm0
call   1030 <write_wave@plt>
movsd  0xd5c(%rip),%xmm1
test   $0x2,%bl
je     12b1 <write_line+0x191>
movsd  0xd57(%rip),%xmm1
mov    %rbp,%rdi
movsd  0xd5c(%rip),%xmm0
call   1030 <write_wave@plt>
movsd  0xd37(%rip),%xmm1
test   $0x4,%bl
je     12d6 <write_line+0x1b6>
movsd  0xd32(%rip),%xmm1
mov    %rbp,%rdi
movsd  0xd37(%rip),%xmm0
call   1030 <write_wave@plt>
test   $0x8,%bl
je     12f8 <write_line+0x1d8>
movsd  0xd15(%rip),%xmm0
movsd  %xmm0,(%rsp)
mov    %rbp,%rdi
movsd  0xd15(%rip),%xmm0
movsd  (%rsp),%xmm1
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <write_wave@plt>

LLVM IR (-O0):
define void @write_line(i32* %0, i8 signext %1, i8 signext %2, i8 signext %3) {
%5 = alloca i32*
%6 = alloca i8
%7 = alloca i8
%8 = alloca i8
%9 = alloca i8
store i32* %0, i32** %5
store i8 %1, i8* %6
store i8 %2, i8* %7
store i8 %3, i8* %8
%10 = load i8, i8* %6
%11 = call zeroext i8 @hex2ui(i8 signext %10)
store i8 %11, i8* %9
%12 = load i8, i8* %9
%13 = zext i8 %12 to i32
%14 = and i32 %13, 1
%15 = icmp ne i32 %14, 0
br i1 %15, label %16, label %19
16: ; preds = %4
%17 = load i32*, i32** %5
%18 = call i32 @write_wave(i32* %17, double 4.700000e-02, double 1.136000e+03)
br label %22
19: ; preds = %4
%20 = load i32*, i32** %5
%21 = call i32 @write_wave(i32* %20, double 4.700000e-02, double 5.680000e+02)
br label %22
22: ; preds = %19, %16
%23 = load i8, i8* %9
%24 = zext i8 %23 to i32
%25 = and i32 %24, 2
%26 = icmp ne i32 %25, 0
br i1 %26, label %27, label %30
27: ; preds = %22
%28 = load i32*, i32** %5
%29 = call i32 @write_wave(i32* %28, double 6.300000e-02, double 1.136000e+03)
br label %33
30: ; preds = %22
%31 = load i32*, i32** %5
%32 = call i32 @write_wave(i32* %31, double 6.300000e-02, double 5.680000e+02)
br label %33
33: ; preds = %30, %27
%34 = load i8, i8* %9
%35 = zext i8 %34 to i32
%36 = and i32 %35, 4
%37 = icmp ne i32 %36, 0
br i1 %37, label %38, label %41
38: ; preds = %33
%39 = load i32*, i32** %5
%40 = call i32 @write_wave(i32* %39, double 6.300000e-02, double 1.136000e+03)
br label %44
41: ; preds = %33
%42 = load i32*, i32** %5
%43 = call i32 @write_wave(i32* %42, double 6.300000e-02, double 5.680000e+02)
br label %44
44: ; preds = %41, %38
%45 = load i8, i8* %9
%46 = zext i8 %45 to i32
%47 = and i32 %46, 8
%48 = icmp ne i32 %47, 0
br i1 %48, label %49, label %52
49: ; preds = %44
%50 = load i32*, i32** %5
%51 = call i32 @write_wave(i32* %50, double 6.300000e-02, double 1.136000e+03)
br label %55
52: ; preds = %44
%53 = load i32*, i32** %5
%54 = call i32 @write_wave(i32* %53, double 6.300000e-02, double 5.680000e+02)
br label %55
55: ; preds = %52, %49
%56 = load i8, i8* %7
%57 = call zeroext i8 @hex2ui(i8 signext %56)
store i8 %57, i8* %9
%58 = load i8, i8* %9
%59 = zext i8 %58 to i32
%60 = and i32 %59, 1
%61 = icmp ne i32 %60, 0
br i1 %61, label %62, label %65
62: ; preds = %55
%63 = load i32*, i32** %5
%64 = call i32 @write_wave(i32* %63, double 6.300000e-02, double 1.136000e+03)
br label %68
65: ; preds = %55
%66 = load i32*, i32** %5
%67 = call i32 @write_wave(i32* %66, double 6.300000e-02, double 5.680000e+02)
br label %68
68: ; preds = %65, %62
%69 = load i8, i8* %9
%70 = zext i8 %69 to i32
%71 = and i32 %70, 2
%72 = icmp ne i32 %71, 0
br i1 %72, label %73, label %76
73: ; preds = %68
%74 = load i32*, i32** %5
%75 = call i32 @write_wave(i32* %74, double 6.300000e-02, double 1.136000e+03)
br label %79
76: ; preds = %68
%77 = load i32*, i32** %5
%78 = call i32 @write_wave(i32* %77, double 6.300000e-02, double 5.680000e+02)
br label %79
79: ; preds = %76, %73
%80 = load i8, i8* %9
%81 = zext i8 %80 to i32
%82 = and i32 %81, 4
%83 = icmp ne i32 %82, 0
br i1 %83, label %84, label %87
84: ; preds = %79
%85 = load i32*, i32** %5
%86 = call i32 @write_wave(i32* %85, double 6.300000e-02, double 1.136000e+03)
br label %90
87: ; preds = %79
%88 = load i32*, i32** %5
%89 = call i32 @write_wave(i32* %88, double 6.300000e-02, double 5.680000e+02)
br label %90
90: ; preds = %87, %84
%91 = load i8, i8* %9
%92 = zext i8 %91 to i32
%93 = and i32 %92, 8
%94 = icmp ne i32 %93, 0
br i1 %94, label %95, label %98
95: ; preds = %90
%96 = load i32*, i32** %5
%97 = call i32 @write_wave(i32* %96, double 6.300000e-02, double 1.136000e+03)
br label %101
98: ; preds = %90
%99 = load i32*, i32** %5
%100 = call i32 @write_wave(i32* %99, double 6.300000e-02, double 5.680000e+02)
br label %101
101: ; preds = %98, %95
%102 = load i8, i8* %8
%103 = call zeroext i8 @hex2ui(i8 signext %102)
store i8 %103, i8* %9
%104 = load i8, i8* %9
%105 = zext i8 %104 to i32
%106 = and i32 %105, 1
%107 = icmp ne i32 %106, 0
br i1 %107, label %108, label %111
108: ; preds = %101
%109 = load i32*, i32** %5
%110 = call i32 @write_wave(i32* %109, double 6.300000e-02, double 1.136000e+03)
br label %114
111: ; preds = %101
%112 = load i32*, i32** %5
%113 = call i32 @write_wave(i32* %112, double 6.300000e-02, double 5.680000e+02)
br label %114
114: ; preds = %111, %108
%115 = load i8, i8* %9
%116 = zext i8 %115 to i32
%117 = and i32 %116, 2
%118 = icmp ne i32 %117, 0
br i1 %118, label %119, label %122
119: ; preds = %114
%120 = load i32*, i32** %5
%121 = call i32 @write_wave(i32* %120, double 6.300000e-02, double 1.136000e+03)
br label %125
122: ; preds = %114
%123 = load i32*, i32** %5
%124 = call i32 @write_wave(i32* %123, double 6.300000e-02, double 5.680000e+02)
br label %125
125: ; preds = %122, %119
%126 = load i8, i8* %9
%127 = zext i8 %126 to i32
%128 = and i32 %127, 4
%129 = icmp ne i32 %128, 0
br i1 %129, label %130, label %133
130: ; preds = %125
%131 = load i32*, i32** %5
%132 = call i32 @write_wave(i32* %131, double 6.300000e-02, double 1.136000e+03)
br label %136
133: ; preds = %125
%134 = load i32*, i32** %5
%135 = call i32 @write_wave(i32* %134, double 6.300000e-02, double 5.680000e+02)
br label %136
136: ; preds = %133, %130
%137 = load i8, i8* %9
%138 = zext i8 %137 to i32
%139 = and i32 %138, 8
%140 = icmp ne i32 %139, 0
br i1 %140, label %141, label %144
141: ; preds = %136
%142 = load i32*, i32** %5
%143 = call i32 @write_wave(i32* %142, double 6.300000e-02, double 1.136000e+03)
br label %147
144: ; preds = %136
%145 = load i32*, i32** %5
%146 = call i32 @write_wave(i32* %145, double 6.300000e-02, double 5.680000e+02)
br label %147
147: ; preds = %144, %141
ret void
}

LLVM IR (-O2):
define void @write_line(i32* %0, i8 signext %1, i8 signext %2, i8 signext %3) {
%5 = tail call zeroext i8 @hex2ui(i8 signext %1)
%6 = zext i8 %5 to i32
%7 = and i32 %6, 1
%8 = icmp eq i32 %7, 0
%9 = select i1 %8, double 5.680000e+02, double 1.136000e+03
%10 = tail call i32 @write_wave(i32* %0, double 4.700000e-02, double %9)
%11 = and i32 %6, 2
%12 = icmp eq i32 %11, 0
%13 = select i1 %12, double 5.680000e+02, double 1.136000e+03
%14 = tail call i32 @write_wave(i32* %0, double 6.300000e-02, double %13)
%15 = and i32 %6, 4
%16 = icmp eq i32 %15, 0
%17 = select i1 %16, double 5.680000e+02, double 1.136000e+03
%18 = tail call i32 @write_wave(i32* %0, double 6.300000e-02, double %17)
%19 = and i32 %6, 8
%20 = icmp eq i32 %19, 0
%21 = select i1 %20, double 5.680000e+02, double 1.136000e+03
%22 = tail call i32 @write_wave(i32* %0, double 6.300000e-02, double %21)
%23 = tail call zeroext i8 @hex2ui(i8 signext %2)
%24 = zext i8 %23 to i32
%25 = and i32 %24, 1
%26 = icmp eq i32 %25, 0
%27 = select i1 %26, double 5.680000e+02, double 1.136000e+03
%28 = tail call i32 @write_wave(i32* %0, double 6.300000e-02, double %27)
%29 = and i32 %24, 2
%30 = icmp eq i32 %29, 0
%31 = select i1 %30, double 5.680000e+02, double 1.136000e+03
%32 = tail call i32 @write_wave(i32* %0, double 6.300000e-02, double %31)
%33 = and i32 %24, 4
%34 = icmp eq i32 %33, 0
%35 = select i1 %34, double 5.680000e+02, double 1.136000e+03
%36 = tail call i32 @write_wave(i32* %0, double 6.300000e-02, double %35)
%37 = and i32 %24, 8
%38 = icmp eq i32 %37, 0
%39 = select i1 %38, double 5.680000e+02, double 1.136000e+03
%40 = tail call i32 @write_wave(i32* %0, double 6.300000e-02, double %39)
%41 = tail call zeroext i8 @hex2ui(i8 signext %3)
%42 = zext i8 %41 to i32
%43 = and i32 %42, 1
%44 = icmp eq i32 %43, 0
%45 = select i1 %44, double 5.680000e+02, double 1.136000e+03
%46 = tail call i32 @write_wave(i32* %0, double 6.300000e-02, double %45)
%47 = and i32 %42, 2
%48 = icmp eq i32 %47, 0
%49 = select i1 %48, double 5.680000e+02, double 1.136000e+03
%50 = tail call i32 @write_wave(i32* %0, double 6.300000e-02, double %49)
%51 = and i32 %42, 4
%52 = icmp eq i32 %51, 0
%53 = select i1 %52, double 5.680000e+02, double 1.136000e+03
%54 = tail call i32 @write_wave(i32* %0, double 6.300000e-02, double %53)
%55 = and i32 %42, 8
%56 = icmp eq i32 %55, 0
%57 = select i1 %56, double 5.680000e+02, double 1.136000e+03
%58 = tail call i32 @write_wave(i32* %0, double 6.300000e-02, double %57)
ret void
}