#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 dfi_cpu {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ zg_exit(int);
void check_cpu(struct dfi_cpu *cpu, const char *note_str) {
  if (cpu)
    return;
  do {
    do {
      fprintf(stderr, "%s: ", "zgetdump");
      fprintf(stderr, "Invalid ELF dump (%s before prstatus found)", note_str);
      fprintf(stderr, "\n");
    } while (0);
    zg_exit(1);
  } while (0);
}


x86 assembly (clang, -O0):
<check_cpu>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1140 <check_cpu+0x20>
jmp    11a4 <check_cpu+0x84>
jmp    1145 <check_cpu+0x25>
jmp    114a <check_cpu+0x2a>
mov    0x2e8f(%rip),%rax
mov    (%rax),%edi
lea    0xea6(%rip),%rsi
lea    0xea4(%rip),%rdx
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2e71(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xe92(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2e56(%rip),%rax
mov    (%rax),%edi
lea    0xea7(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <zg_exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_cpu>:
test   %rdi,%rdi
je     1126 <check_cpu+0x6>
ret
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    0x2eac(%rip),%r14
mov    (%r14),%edi
lea    0xec2(%rip),%rsi
lea    0xec0(%rip),%rdx
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%r14),%edi
lea    0xeb8(%rip),%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%r14),%edi
lea    0xed0(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    $0x1,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <zg_exit@plt>

LLVM IR (-O0):
%struct.dfi_cpu = type { i32 }
@stderr = global i32 0
@.str = [5 x i8] c"%s: \00"
@.str.1 = [9 x i8] c"zgetdump\00"
@.str.2 = [44 x i8] c"Invalid ELF dump (%s before prstatus found)\00"
@.str.3 = [2 x i8] c"\0A\00"
define void @check_cpu(%struct.dfi_cpu* %0, i8* %1) {
%3 = alloca %struct.dfi_cpu*
%4 = alloca i8*
store %struct.dfi_cpu* %0, %struct.dfi_cpu** %3
store i8* %1, i8** %4
%5 = load %struct.dfi_cpu*, %struct.dfi_cpu** %3
%6 = icmp ne %struct.dfi_cpu* %5, null
br i1 %6, label %7, label %8
7: ; preds = %2
br label %20
8: ; preds = %2
br label %9
9: ; preds = %8
br label %10
10: ; preds = %9
%11 = load i32, i32* @stderr
%12 = call i32 (i32, i8*, ...) @fprintf(i32 %11, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%13 = load i32, i32* @stderr
%14 = load i8*, i8** %4
%15 = call i32 (i32, i8*, ...) @fprintf(i32 %13, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.2, i64 0, i64 0), i8* %14)
%16 = load i32, i32* @stderr
%17 = call i32 (i32, i8*, ...) @fprintf(i32 %16, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %18
18: ; preds = %10
%19 = call i32 @zg_exit(i32 1)
br label %20
20: ; preds = %7, %18
ret void
}

LLVM IR (-O2):
%struct.dfi_cpu = type { i32 }
@stderr = global i32 0
@.str = [5 x i8] c"%s: \00"
@.str.1 = [9 x i8] c"zgetdump\00"
@.str.2 = [44 x i8] c"Invalid ELF dump (%s before prstatus found)\00"
@.str.3 = [2 x i8] c"\0A\00"
define void @check_cpu(%struct.dfi_cpu* readnone %0, i8* %1) {
%3 = icmp eq %struct.dfi_cpu* %0, null
br i1 %3, label %4, label %12
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = tail call i32 (i32, i8*, ...) @fprintf(i32 %5, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%7 = load i32, i32* @stderr
%8 = tail call i32 (i32, i8*, ...) @fprintf(i32 %7, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.2, i64 0, i64 0), i8* %1)
%9 = load i32, i32* @stderr
%10 = tail call i32 (i32, i8*, ...) @fprintf(i32 %9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%11 = tail call i32 @zg_exit(i32 1)
br label %12
12: ; preds = %2, %4
ret void
}