#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 scalar_t__ uint32_t;

/* Variables and functions */
scalar_t__ getarp(scalar_t__);
int /*<<< orphan*/ getprefix();
scalar_t__ getroute();
int /*<<< orphan*/ puts(char *);
int main(void) {
  uint32_t gw = getroute();
  int rc = 0;
  if (gw) {
    if (getarp(gw)) {
      puts("gw not in ARP table");
      rc = 1;
    }
  } else {
    puts("default gateway not found");
    rc = 2;
  }
  if (1) {
    getprefix();
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <getroute@plt>
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1197 <main+0x57>
mov    -0x10(%rbp),%rdi
call   1050 <getarp@plt>
cmp    $0x0,%rax
je     1192 <main+0x52>
lea    0xe7a(%rip),%rdi
call   1030 <puts@plt>
movl   $0x1,-0x14(%rbp)
jmp    11aa <main+0x6a>
lea    0xe76(%rip),%rdi
call   1030 <puts@plt>
movl   $0x2,-0x14(%rbp)
mov    $0x0,%al
call   1060 <getprefix@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <getroute@plt>
test   %rax,%rax
je     1163 <main+0x23>
mov    %rax,%rdi
call   1050 <getarp@plt>
test   %rax,%rax
je     116f <main+0x2f>
lea    0xe9f(%rip),%rdi
jmp    116a <main+0x2a>
lea    0xeaa(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1060 <getprefix@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [20 x i8] c"gw not in ARP table\00"
@.str.1 = [26 x i8] c"default gateway not found\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i32
store i32 0, i32* %1
%4 = call i64 (...) @getroute()
store i64 %4, i64* %2
store i32 0, i32* %3
%5 = load i64, i64* %2
%6 = icmp ne i64 %5, 0
br i1 %6, label %7, label %14
7: ; preds = %0
%8 = load i64, i64* %2
%9 = call i64 @getarp(i64 %8)
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %7
%12 = call i32 @puts(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %3
br label %13
13: ; preds = %11, %7
br label %16
14: ; preds = %0
%15 = call i32 @puts(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
store i32 2, i32* %3
br label %16
16: ; preds = %14, %13
%17 = call i32 (...) @getprefix()
%18 = load i32, i32* %1
ret i32 %18
}

LLVM IR (-O2):
@.str = [20 x i8] c"gw not in ARP table\00"
@.str.1 = [26 x i8] c"default gateway not found\00"
define i32 @main() {
%1 = tail call i64 (...) @getroute()
%2 = icmp eq i64 %1, 0
br i1 %2, label %6, label %3
3: ; preds = %0
%4 = tail call i64 @getarp(i64 %1)
%5 = icmp eq i64 %4, 0
br i1 %5, label %9, label %6
6: ; preds = %0, %3
%7 = phi i8* [ getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), %3 ], [ getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), %0 ]
%8 = tail call i32 @puts(i8* dereferenceable(1) %7)
br label %9
9: ; preds = %6, %3
%10 = tail call i32 (...) @getprefix()
ret i32 0
}