#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*/ uint32_t;
struct FormatType {
  int dummy;
};

/* Variables and functions */
int GetData(struct FormatType const *, char const *, int /*<<< orphan*/, int,
            int /*<<< orphan*/, int, unsigned char, int /*<<< orphan*/ *,
            int *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int, int);
int /*<<< orphan*/ stderr;
uint32_t dirfile_read_uint32_sample(const struct FormatType *F,
                                    const char *channelname, int index) {
  uint32_t sample;
  int status;
  int n = GetData(F, channelname, 0, index, 0, 1, 'U', &sample, &status);
  if (status != 0 || n != 1) {
    {
      if (status != 0)
        fprintf(stderr, "line %d: *** dirfile error code: %d\n", 160, status);
    };
    return 0;
  }
  return sample;
}


x86 assembly (clang, -O0):
<dirfile_read_uint32_sample>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%ecx
xor    %r8d,%r8d
mov    $0x1,%r9d
lea    -0x20(%rbp),%r10
lea    -0x24(%rbp),%rax
mov    %r8d,%edx
movl   $0x55,(%rsp)
mov    %r10,0x8(%rsp)
mov    %rax,0x10(%rsp)
call   1040 <GetData@plt>
mov    %eax,-0x28(%rbp)
cmpl   $0x0,-0x24(%rbp)
jne    117f <dirfile_read_uint32_sample+0x5f>
cmpl   $0x1,-0x28(%rbp)
je     11b2 <dirfile_read_uint32_sample+0x92>
cmpl   $0x0,-0x24(%rbp)
je     11a6 <dirfile_read_uint32_sample+0x86>
mov    0x2e50(%rip),%rax
mov    (%rax),%edi
mov    -0x24(%rbp),%ecx
lea    0xe64(%rip),%rsi
mov    $0xa0,%edx
call   1030 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
jmp    11b8 <dirfile_read_uint32_sample+0x98>
mov    -0x20(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dirfile_read_uint32_sample>:
push   %rbx
sub    $0x10,%rsp
mov    %edx,%ecx
sub    $0x8,%rsp
lea    0x10(%rsp),%rax
lea    0x14(%rsp),%r10
xor    %ebx,%ebx
xor    %edx,%edx
xor    %r8d,%r8d
mov    $0x1,%r9d
push   %rax
push   %r10
push   $0x55
call   1040 <GetData@plt>
add    $0x20,%rsp
mov    0x8(%rsp),%ecx
test   %ecx,%ecx
jne    1163 <dirfile_read_uint32_sample+0x43>
cmp    $0x1,%eax
jne    1163 <dirfile_read_uint32_sample+0x43>
mov    0xc(%rsp),%ebx
jmp    1181 <dirfile_read_uint32_sample+0x61>
test   %ecx,%ecx
je     1181 <dirfile_read_uint32_sample+0x61>
mov    0x2e72(%rip),%rax
mov    (%rax),%edi
lea    0xe89(%rip),%rsi
mov    $0xa0,%edx
call   1030 <fprintf@plt>
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.FormatType = type { i32 }
@stderr = global i32 0
@.str = [37 x i8] c"line %d: *** dirfile error code: %d\0A\00"
define i32 @dirfile_read_uint32_sample(%struct.FormatType* %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca %struct.FormatType*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store %struct.FormatType* %0, %struct.FormatType** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
%11 = load %struct.FormatType*, %struct.FormatType** %5
%12 = load i8*, i8** %6
%13 = load i32, i32* %7
%14 = call i32 @GetData(%struct.FormatType* %11, i8* %12, i32 0, i32 %13, i32 0, i32 1, i8 zeroext 85, i32* %8, i32* %9)
store i32 %14, i32* %10
%15 = load i32, i32* %9
%16 = icmp ne i32 %15, 0
br i1 %16, label %20, label %17
17: ; preds = %3
%18 = load i32, i32* %10
%19 = icmp ne i32 %18, 1
br i1 %19, label %20, label %28
20: ; preds = %17, %3
%21 = load i32, i32* %9
%22 = icmp ne i32 %21, 0
br i1 %22, label %23, label %27
23: ; preds = %20
%24 = load i32, i32* @stderr
%25 = load i32, i32* %9
%26 = call i32 @fprintf(i32 %24, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i32 160, i32 %25)
br label %27
27: ; preds = %23, %20
store i32 0, i32* %4
br label %30
28: ; preds = %17
%29 = load i32, i32* %8
store i32 %29, i32* %4
br label %30
30: ; preds = %28, %27
%31 = load i32, i32* %4
ret i32 %31
}

LLVM IR (-O2):
%struct.FormatType = type { i32 }
@stderr = global i32 0
@.str = [37 x i8] c"line %d: *** dirfile error code: %d\0A\00"
define i32 @dirfile_read_uint32_sample(%struct.FormatType* %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = bitcast i32* %4 to i8*
%7 = bitcast i32* %5 to i8*
%8 = call i32 @GetData(%struct.FormatType* %0, i8* %1, i32 0, i32 %2, i32 0, i32 1, i8 zeroext 85, i32* %4, i32* %5)
%9 = load i32, i32* %5
%10 = icmp ne i32 %9, 0
%11 = icmp ne i32 %8, 1
%12 = select i1 %10, i1 true, i1 %11
br i1 %12, label %13, label %17
13: ; preds = %3
br i1 %10, label %14, label %19
14: ; preds = %13
%15 = load i32, i32* @stderr
%16 = call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i32 160, i32 %9)
br label %19
17: ; preds = %3
%18 = load i32, i32* %4
br label %19
19: ; preds = %13, %14, %17
%20 = phi i32 [ %18, %17 ], [ 0, %14 ], [ 0, %13 ]
ret i32 %20
}