#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 */

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ comm_ping();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ serial_close();
int /*<<< orphan*/ serial_open();
int /*<<< orphan*/ sleep(int);
int main(int argc, char **argv) {
  if (!serial_open())
    exit(EXIT_FAILURE);
  sleep(3);
  if (!comm_ping()) {
    printf("main: Geen reactie op CTX_PING.\n");
    serial_close();
    exit(EXIT_FAILURE);
  }
  serial_close();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1060 <serial_open@plt>
cmp    $0x0,%eax
jne    1194 <main+0x34>
mov    0x2e53(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>
mov    $0x3,%edi
call   1080 <sleep@plt>
mov    $0x0,%al
call   1040 <comm_ping@plt>
cmp    $0x0,%eax
jne    11cf <main+0x6f>
lea    0xe4b(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1050 <serial_close@plt>
mov    0x2e18(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>
mov    $0x0,%al
call   1050 <serial_close@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1060 <serial_open@plt>
test   %eax,%eax
je     119f <main+0x3f>
mov    $0x3,%edi
call   1080 <sleep@plt>
xor    %eax,%eax
call   1040 <comm_ping@plt>
test   %eax,%eax
je     118c <main+0x2c>
xor    %eax,%eax
call   1050 <serial_close@plt>
xor    %eax,%eax
pop    %rcx
ret
lea    0xe6d(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1050 <serial_close@plt>
mov    0x2e3a(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@EXIT_FAILURE = global i32 0
@.str = [33 x i8] c"main: Geen reactie op CTX_PING.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 (...) @serial_open()
%7 = icmp ne i32 %6, 0
br i1 %7, label %11, label %8
8: ; preds = %2
%9 = load i32, i32* @EXIT_FAILURE
%10 = call i32 @exit(i32 %9)
unreachable
11: ; preds = %2
%12 = call i32 @sleep(i32 3)
%13 = call i32 (...) @comm_ping()
%14 = icmp ne i32 %13, 0
br i1 %14, label %20, label %15
15: ; preds = %11
%16 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%17 = call i32 (...) @serial_close()
%18 = load i32, i32* @EXIT_FAILURE
%19 = call i32 @exit(i32 %18)
unreachable
20: ; preds = %11
%21 = call i32 (...) @serial_close()
ret i32 0
}

LLVM IR (-O2):
@EXIT_FAILURE = global i32 0
@str = [32 x i8] c"main: Geen reactie op CTX_PING.\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @serial_open()
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %2
%6 = load i32, i32* @EXIT_FAILURE
%7 = tail call i32 @exit(i32 %6)
unreachable
8: ; preds = %2
%9 = tail call i32 @sleep(i32 3)
%10 = tail call i32 (...) @comm_ping()
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %17
12: ; preds = %8
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str, i64 0, i64 0))
%14 = tail call i32 (...) @serial_close()
%15 = load i32, i32* @EXIT_FAILURE
%16 = tail call i32 @exit(i32 %15)
unreachable
17: ; preds = %8
%18 = tail call i32 (...) @serial_close()
ret i32 0
}