#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*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char const *, char *);
int /*<<< orphan*/ printf(char *, char const *);
int /*<<< orphan*/ sscanf(char *, char *, int *, ...);
void readInfoFile(const char *input_info_file, int *mic_num,
                  int *wav_sample_rate, float *d_sampled_p0) {
  FILE *fr;
  int val1;
  int val2;
  float val3;
  float val4;
  char line[80];
  fr = fopen(input_info_file, "rt");
  if (fr == NULL) {
    printf("Can't read input file: %s\n", input_info_file);
    exit(-1);
  }
  if (fgets(line, 80, fr) == NULL) {
    printf("Input file %s is empty\n", input_info_file);
    exit(-1);
  }
  sscanf(line, "%d", &*mic_num);
  if (fgets(line, 80, fr) == NULL) {
    printf("Input file %s has no sample rate\n", input_info_file);
    exit(-1);
  }
  sscanf(line, "%d", &*wav_sample_rate);
  if (fgets(line, 80, fr) == NULL) {
    printf("Input file %s has no coordinates\n", input_info_file);
    exit(-1);
  }
  while (fgets(line, 80, fr) != NULL)
    sscanf(line, "%d %d %e %e", &val1, &val2, &val3, &val4);
  *d_sampled_p0 = val4;
  fclose(fr);
}


x86 assembly (clang, -O0):
<readInfoFile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe7a(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    11b4 <readInfoFile+0x54>
mov    -0x8(%rbp),%rsi
lea    0xe5e(%rip),%rdi
call   1040 <printf@plt>
mov    $0xffffffff,%edi
call   1080 <exit@plt>
lea    -0x90(%rbp),%rdi
mov    -0x28(%rbp),%rdx
mov    $0x50,%esi
call   1050 <fgets@plt>
cmp    $0x0,%rax
jne    11ed <readInfoFile+0x8d>
mov    -0x8(%rbp),%rsi
lea    0xe40(%rip),%rdi
call   1040 <printf@plt>
mov    $0xffffffff,%edi
call   1080 <exit@plt>
lea    -0x90(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xe37(%rip),%rsi
mov    $0x0,%al
call   1060 <sscanf@plt>
lea    -0x90(%rbp),%rdi
mov    -0x28(%rbp),%rdx
mov    $0x50,%esi
call   1050 <fgets@plt>
cmp    $0x0,%rax
jne    123f <readInfoFile+0xdf>
mov    -0x8(%rbp),%rsi
lea    0xe09(%rip),%rdi
call   1040 <printf@plt>
mov    $0xffffffff,%edi
call   1080 <exit@plt>
lea    -0x90(%rbp),%rdi
mov    -0x18(%rbp),%rdx
lea    0xde5(%rip),%rsi
mov    $0x0,%al
call   1060 <sscanf@plt>
lea    -0x90(%rbp),%rdi
mov    -0x28(%rbp),%rdx
mov    $0x50,%esi
call   1050 <fgets@plt>
cmp    $0x0,%rax
jne    1291 <readInfoFile+0x131>
mov    -0x8(%rbp),%rsi
lea    0xdd9(%rip),%rdi
call   1040 <printf@plt>
mov    $0xffffffff,%edi
call   1080 <exit@plt>
jmp    1296 <readInfoFile+0x136>
lea    -0x90(%rbp),%rdi
mov    -0x28(%rbp),%rdx
mov    $0x50,%esi
call   1050 <fgets@plt>
cmp    $0x0,%rax
je     12df <readInfoFile+0x17f>
lea    -0x90(%rbp),%rdi
lea    0xdba(%rip),%rsi
lea    -0x2c(%rbp),%rdx
lea    -0x30(%rbp),%rcx
lea    -0x34(%rbp),%r8
lea    -0x38(%rbp),%r9
mov    $0x0,%al
call   1060 <sscanf@plt>
jmp    1296 <readInfoFile+0x136>
movss  -0x38(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movss  %xmm0,(%rax)
mov    -0x28(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readInfoFile>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
mov    %rcx,%rbp
mov    %rdx,%r12
mov    %rsi,%r13
mov    %rdi,%r15
lea    0xe7f(%rip),%rsi
call   1070 <fopen@plt>
test   %rax,%rax
je     12ab <readInfoFile+0x14b>
mov    %rax,%r14
lea    0x20(%rsp),%rdi
mov    $0x50,%esi
mov    %rax,%rdx
call   1050 <fgets@plt>
test   %rax,%rax
je     12b4 <readInfoFile+0x154>
lea    0xe82(%rip),%rsi
lea    0x20(%rsp),%rbx
mov    %rbx,%rdi
mov    %r13,%rdx
xor    %eax,%eax
call   1060 <sscanf@plt>
mov    %rbx,%rdi
mov    $0x50,%esi
mov    %r14,%rdx
call   1050 <fgets@plt>
test   %rax,%rax
je     12bd <readInfoFile+0x15d>
lea    0xe50(%rip),%rsi
lea    0x20(%rsp),%rbx
mov    %rbx,%rdi
mov    %r12,%rdx
xor    %eax,%eax
call   1060 <sscanf@plt>
mov    %rbx,%rdi
mov    $0x50,%esi
mov    %r14,%rdx
call   1050 <fgets@plt>
test   %rax,%rax
je     12c6 <readInfoFile+0x166>
lea    0x20(%rsp),%rdi
mov    $0x50,%esi
mov    %r14,%rdx
call   1050 <fgets@plt>
test   %rax,%rax
je     128f <readInfoFile+0x12f>
mov    %rbp,0x8(%rsp)
lea    0x20(%rsp),%rbx
lea    0x1c(%rsp),%r12
lea    0x18(%rsp),%r13
lea    0x14(%rsp),%rbp
lea    0x4(%rsp),%r15
cs nopw 0x0(%rax,%rax,1)
mov    %rbx,%rdi
lea    0xe23(%rip),%rsi
mov    %r12,%rdx
mov    %r13,%rcx
mov    %rbp,%r8
mov    %r15,%r9
xor    %eax,%eax
call   1060 <sscanf@plt>
mov    %rbx,%rdi
mov    $0x50,%esi
mov    %r14,%rdx
call   1050 <fgets@plt>
test   %rax,%rax
jne    1250 <readInfoFile+0xf0>
movss  0x4(%rsp),%xmm0
mov    0x8(%rsp),%rbp
jmp    128f <readInfoFile+0x12f>
movss  %xmm0,0x0(%rbp)
mov    %r14,%rdi
call   1030 <fclose@plt>
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xd51(%rip),%rdi
jmp    12cd <readInfoFile+0x16d>
lea    0xd63(%rip),%rdi
jmp    12cd <readInfoFile+0x16d>
lea    0xd75(%rip),%rdi
jmp    12cd <readInfoFile+0x16d>
lea    0xd8e(%rip),%rdi
mov    %r15,%rsi
call   1040 <printf@plt>
mov    $0xffffffff,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"rt\00"
@.str.1 = [27 x i8] c"Can't read input file: %s\0A\00"
@.str.2 = [24 x i8] c"Input file %s is empty\0A\00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [34 x i8] c"Input file %s has no sample rate\0A\00"
@.str.5 = [34 x i8] c"Input file %s has no coordinates\0A\00"
@.str.6 = [12 x i8] c"%d %d %e %e\00"
define void @readInfoFile(i8* %0, i32* %1, i32* %2, float* %3) {
%5 = alloca i8*
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca float*
%9 = alloca i32*
%10 = alloca i32
%11 = alloca i32
%12 = alloca float
%13 = alloca float
%14 = alloca [80 x i8]
store i8* %0, i8** %5
store i32* %1, i32** %6
store i32* %2, i32** %7
store float* %3, float** %8
%15 = load i8*, i8** %5
%16 = call i32* @fopen(i8* %15, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32* %16, i32** %9
%17 = load i32*, i32** %9
%18 = icmp eq i32* %17, null
br i1 %18, label %19, label %23
19: ; preds = %4
%20 = load i8*, i8** %5
%21 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i8* %20)
%22 = call i32 @exit(i32 -1)
unreachable
23: ; preds = %4
%24 = getelementptr inbounds [80 x i8], [80 x i8]* %14, i64 0, i64 0
%25 = load i32*, i32** %9
%26 = call i32* @fgets(i8* %24, i32 80, i32* %25)
%27 = icmp eq i32* %26, null
br i1 %27, label %28, label %32
28: ; preds = %23
%29 = load i8*, i8** %5
%30 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i8* %29)
%31 = call i32 @exit(i32 -1)
unreachable
32: ; preds = %23
%33 = getelementptr inbounds [80 x i8], [80 x i8]* %14, i64 0, i64 0
%34 = load i32*, i32** %6
%35 = call i32 (i8*, i8*, i32*, ...) @sscanf(i8* %33, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %34)
%36 = getelementptr inbounds [80 x i8], [80 x i8]* %14, i64 0, i64 0
%37 = load i32*, i32** %9
%38 = call i32* @fgets(i8* %36, i32 80, i32* %37)
%39 = icmp eq i32* %38, null
br i1 %39, label %40, label %44
40: ; preds = %32
%41 = load i8*, i8** %5
%42 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0), i8* %41)
%43 = call i32 @exit(i32 -1)
unreachable
44: ; preds = %32
%45 = getelementptr inbounds [80 x i8], [80 x i8]* %14, i64 0, i64 0
%46 = load i32*, i32** %7
%47 = call i32 (i8*, i8*, i32*, ...) @sscanf(i8* %45, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %46)
%48 = getelementptr inbounds [80 x i8], [80 x i8]* %14, i64 0, i64 0
%49 = load i32*, i32** %9
%50 = call i32* @fgets(i8* %48, i32 80, i32* %49)
%51 = icmp eq i32* %50, null
br i1 %51, label %52, label %56
52: ; preds = %44
%53 = load i8*, i8** %5
%54 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.5, i64 0, i64 0), i8* %53)
%55 = call i32 @exit(i32 -1)
unreachable
56: ; preds = %44
br label %57
57: ; preds = %62, %56
%58 = getelementptr inbounds [80 x i8], [80 x i8]* %14, i64 0, i64 0
%59 = load i32*, i32** %9
%60 = call i32* @fgets(i8* %58, i32 80, i32* %59)
%61 = icmp ne i32* %60, null
br i1 %61, label %62, label %65
62: ; preds = %57
%63 = getelementptr inbounds [80 x i8], [80 x i8]* %14, i64 0, i64 0
%64 = call i32 (i8*, i8*, i32*, ...) @sscanf(i8* %63, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0), i32* %10, i32* %11, float* %12, float* %13)
br label %57
65: ; preds = %57
%66 = load float, float* %13
%67 = load float*, float** %8
store float %66, float* %67
%68 = load i32*, i32** %9
%69 = call i32 @fclose(i32* %68)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"rt\00"
@.str.1 = [27 x i8] c"Can't read input file: %s\0A\00"
@.str.2 = [24 x i8] c"Input file %s is empty\0A\00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [34 x i8] c"Input file %s has no sample rate\0A\00"
@.str.5 = [34 x i8] c"Input file %s has no coordinates\0A\00"
@.str.6 = [12 x i8] c"%d %d %e %e\00"
define void @readInfoFile(i8* %0, i32* %1, i32* %2, float* nocapture writeonly %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca float
%8 = alloca float
%9 = alloca [80 x i8]
%10 = bitcast i32* %5 to i8*
%11 = bitcast i32* %6 to i8*
%12 = bitcast float* %7 to i8*
%13 = bitcast float* %8 to i8*
%14 = getelementptr inbounds [80 x i8], [80 x i8]* %9, i64 0, i64 0
%15 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%16 = icmp eq i32* %15, null
br i1 %16, label %17, label %20
17: ; preds = %4
%18 = tail call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%19 = tail call i32 @exit(i32 -1)
unreachable
20: ; preds = %4
%21 = call i32* @fgets(i8* %14, i32 80, i32* %15)
%22 = icmp eq i32* %21, null
br i1 %22, label %23, label %26
23: ; preds = %20
%24 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i8* %0)
%25 = call i32 @exit(i32 -1)
unreachable
26: ; preds = %20
%27 = call i32 (i8*, i8*, i32*, ...) @sscanf(i8* %14, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %1)
%28 = call i32* @fgets(i8* %14, i32 80, i32* %15)
%29 = icmp eq i32* %28, null
br i1 %29, label %30, label %33
30: ; preds = %26
%31 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0), i8* %0)
%32 = call i32 @exit(i32 -1)
unreachable
33: ; preds = %26
%34 = call i32 (i8*, i8*, i32*, ...) @sscanf(i8* %14, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %2)
%35 = call i32* @fgets(i8* %14, i32 80, i32* %15)
%36 = icmp eq i32* %35, null
br i1 %36, label %40, label %37
37: ; preds = %33
%38 = call i32* @fgets(i8* %14, i32 80, i32* %15)
%39 = icmp eq i32* %38, null
br i1 %39, label %49, label %43
40: ; preds = %33
%41 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.5, i64 0, i64 0), i8* %0)
%42 = call i32 @exit(i32 -1)
unreachable
43: ; preds = %37, %43
%44 = call i32 (i8*, i8*, i32*, ...) @sscanf(i8* %14, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0), i32* %5, i32* %6, float* %7, float* %8)
%45 = call i32* @fgets(i8* %14, i32 80, i32* %15)
%46 = icmp eq i32* %45, null
br i1 %46, label %47, label %43
47: ; preds = %43
%48 = load float, float* %8
br label %49
49: ; preds = %47, %37
%50 = phi float [ %48, %47 ], [ undef, %37 ]
store float %50, float* %3
%51 = call i32 @fclose(i32* %15)
ret void
}