#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 */
struct RawData {
  int dummy;
};
struct RadarParm {
  int dummy;
};
struct DataMap {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ DataMapFree(struct DataMap *);
struct DataMap *DataMapRead(int);
int RadarParmDecode(struct DataMap *, struct RadarParm *);
int RawDecode(struct DataMap *, struct RawData *);
int RawRead(int fid, struct RadarParm *prm, struct RawData *raw) {
  int s;
  struct DataMap *ptr;
  ptr = DataMapRead(fid);
  if (ptr == NULL)
    return -1;
  s = RadarParmDecode(ptr, prm);
  if (s != 0) {
    DataMapFree(ptr);
    return s;
  }
  s = RawDecode(ptr, raw);
  DataMapFree(ptr);
  return s;
}


x86 assembly (clang, -O0):
<RawRead>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <DataMapRead@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    1176 <RawRead+0x36>
movl   $0xffffffff,-0x4(%rbp)
jmp    11c3 <RawRead+0x83>
mov    -0x28(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1060 <RadarParmDecode@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
je     11a4 <RawRead+0x64>
mov    -0x28(%rbp),%rdi
call   1040 <DataMapFree@plt>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11c3 <RawRead+0x83>
mov    -0x28(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1050 <RawDecode@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x28(%rbp),%rdi
call   1040 <DataMapFree@plt>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<RawRead>:
push   %rbp
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%rbp
call   1030 <DataMapRead@plt>
test   %rax,%rax
je     117f <RawRead+0x3f>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %rbp,%rsi
call   1060 <RadarParmDecode@plt>
mov    %eax,%ebp
test   %eax,%eax
jne    1175 <RawRead+0x35>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <RawDecode@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1040 <DataMapFree@plt>
jmp    1184 <RawRead+0x44>
mov    $0xffffffff,%ebp
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.RadarParm = type { i32 }
%struct.RawData = type { i32 }
%struct.DataMap = type { i32 }
define i32 @RawRead(i32 %0, %struct.RadarParm* %1, %struct.RawData* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca %struct.RadarParm*
%7 = alloca %struct.RawData*
%8 = alloca i32
%9 = alloca %struct.DataMap*
store i32 %0, i32* %5
store %struct.RadarParm* %1, %struct.RadarParm** %6
store %struct.RawData* %2, %struct.RawData** %7
%10 = load i32, i32* %5
%11 = call %struct.DataMap* @DataMapRead(i32 %10)
store %struct.DataMap* %11, %struct.DataMap** %9
%12 = load %struct.DataMap*, %struct.DataMap** %9
%13 = icmp eq %struct.DataMap* %12, null
br i1 %13, label %14, label %15
14: ; preds = %3
store i32 -1, i32* %4
br label %32
15: ; preds = %3
%16 = load %struct.DataMap*, %struct.DataMap** %9
%17 = load %struct.RadarParm*, %struct.RadarParm** %6
%18 = call i32 @RadarParmDecode(%struct.DataMap* %16, %struct.RadarParm* %17)
store i32 %18, i32* %8
%19 = load i32, i32* %8
%20 = icmp ne i32 %19, 0
br i1 %20, label %21, label %25
21: ; preds = %15
%22 = load %struct.DataMap*, %struct.DataMap** %9
%23 = call i32 @DataMapFree(%struct.DataMap* %22)
%24 = load i32, i32* %8
store i32 %24, i32* %4
br label %32
25: ; preds = %15
%26 = load %struct.DataMap*, %struct.DataMap** %9
%27 = load %struct.RawData*, %struct.RawData** %7
%28 = call i32 @RawDecode(%struct.DataMap* %26, %struct.RawData* %27)
store i32 %28, i32* %8
%29 = load %struct.DataMap*, %struct.DataMap** %9
%30 = call i32 @DataMapFree(%struct.DataMap* %29)
%31 = load i32, i32* %8
store i32 %31, i32* %4
br label %32
32: ; preds = %25, %21, %14
%33 = load i32, i32* %4
ret i32 %33
}

LLVM IR (-O2):
%struct.RadarParm = type { i32 }
%struct.RawData = type { i32 }
%struct.DataMap = type { i32 }
define i32 @RawRead(i32 %0, %struct.RadarParm* %1, %struct.RawData* %2) {
%4 = tail call %struct.DataMap* @DataMapRead(i32 %0)
%5 = icmp eq %struct.DataMap* %4, null
br i1 %5, label %14, label %6
6: ; preds = %3
%7 = tail call i32 @RadarParmDecode(%struct.DataMap* %4, %struct.RadarParm* %1)
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %6
%10 = tail call i32 @RawDecode(%struct.DataMap* %4, %struct.RawData* %2)
br label %11
11: ; preds = %6, %9
%12 = phi i32 [ %10, %9 ], [ %7, %6 ]
%13 = tail call i32 @DataMapFree(%struct.DataMap* %4)
br label %14
14: ; preds = %11, %3
%15 = phi i32 [ -1, %3 ], [ %12, %11 ]
ret i32 %15
}