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

/* Variables and functions */
int /*<<< orphan*/ dcel_cleanup(struct hiena_dcel *);
struct hiena_dcel *dcel_source(int /*<<< orphan*/ *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ stderr;
int main() {
  int er;
  ;
  struct hiena_dcel *dc = NULL;
  if ((dc = dcel_source(NULL)) == NULL) {
    perror("err main:dcel_source() returned NULL");
    er++;
    ;
    goto cleanup;
  }
  fprintf(stderr, "data_cell_test: OK");
cleanup:
  dcel_cleanup(dc);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1050 <dcel_source@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
jne    1188 <main+0x48>
lea    0xe8b(%rip),%rdi
call   1060 <perror@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    119d <main+0x5d>
mov    0x2e51(%rip),%rax
mov    (%rax),%edi
lea    0xe8d(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <dcel_cleanup@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %edi,%edi
call   1050 <dcel_source@plt>
mov    %rax,%rbx
test   %rax,%rax
je     1171 <main+0x31>
mov    0x2e89(%rip),%rax
mov    (%rax),%edi
lea    0xec5(%rip),%rsi
call   1040 <fprintf@plt>
mov    %rbx,%rdi
call   1030 <dcel_cleanup@plt>
xor    %eax,%eax
pop    %rbx
ret
lea    0xe88(%rip),%rdi
call   1060 <perror@plt>
jmp    1165 <main+0x25>

LLVM IR (-O0):
%struct.hiena_dcel = type { i32 }
@.str = [37 x i8] c"err main:dcel_source() returned NULL\00"
@stderr = global i32 0
@.str.1 = [19 x i8] c"data_cell_test: OK\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca %struct.hiena_dcel*
store i32 0, i32* %1
store %struct.hiena_dcel* null, %struct.hiena_dcel** %3
%4 = call %struct.hiena_dcel* @dcel_source(i32* null)
store %struct.hiena_dcel* %4, %struct.hiena_dcel** %3
%5 = icmp eq %struct.hiena_dcel* %4, null
br i1 %5, label %6, label %10
6: ; preds = %0
%7 = call i32 @perror(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
%8 = load i32, i32* %2
%9 = add nsw i32 %8, 1
store i32 %9, i32* %2
br label %13
10: ; preds = %0
%11 = load i32, i32* @stderr
%12 = call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
br label %13
13: ; preds = %10, %6
%14 = load %struct.hiena_dcel*, %struct.hiena_dcel** %3
%15 = call i32 @dcel_cleanup(%struct.hiena_dcel* %14)
ret i32 0
}

LLVM IR (-O2):
%struct.hiena_dcel = type { i32 }
@.str = [37 x i8] c"err main:dcel_source() returned NULL\00"
@stderr = global i32 0
@.str.1 = [19 x i8] c"data_cell_test: OK\00"
define i32 @main() {
%1 = tail call %struct.hiena_dcel* @dcel_source(i32* null)
%2 = icmp eq %struct.hiena_dcel* %1, null
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 @perror(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
br label %8
5: ; preds = %0
%6 = load i32, i32* @stderr
%7 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
br label %8
8: ; preds = %5, %3
%9 = tail call i32 @dcel_cleanup(%struct.hiena_dcel* %1)
ret i32 0
}