#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*/ ETHTOOL_GGRO;
int /*<<< orphan*/ ETHTOOL_GRXCSUM;
scalar_t__ get_ethtool_feature_val(char *, int /*<<< orphan*/);
int check_csum_offload(char *dev) {
  if (!dev) {
    return 0;
  }
  if (get_ethtool_feature_val(dev, ETHTOOL_GGRO) &&
      get_ethtool_feature_val(dev, ETHTOOL_GRXCSUM)) {
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<check_csum_offload>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1133 <check_csum_offload+0x23>
movl   $0x0,-0x4(%rbp)
jmp    117e <check_csum_offload+0x6e>
mov    -0x10(%rbp),%rdi
mov    0x2e9a(%rip),%rax
mov    (%rax),%esi
call   1030 <get_ethtool_feature_val@plt>
cmp    $0x0,%rax
je     1177 <check_csum_offload+0x67>
mov    -0x10(%rbp),%rdi
mov    0x2e8e(%rip),%rax
mov    (%rax),%esi
call   1030 <get_ethtool_feature_val@plt>
cmp    $0x0,%rax
je     1177 <check_csum_offload+0x67>
movl   $0x1,-0x4(%rbp)
jmp    117e <check_csum_offload+0x6e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_csum_offload>:
push   %rbx
xor    %eax,%eax
test   %rdi,%rdi
je     114c <check_csum_offload+0x3c>
mov    %rdi,%rbx
mov    0x2eb6(%rip),%rax
mov    (%rax),%esi
call   1030 <get_ethtool_feature_val@plt>
test   %rax,%rax
je     114e <check_csum_offload+0x3e>
mov    0x2eb3(%rip),%rax
mov    (%rax),%esi
mov    %rbx,%rdi
call   1030 <get_ethtool_feature_val@plt>
mov    %rax,%rcx
mov    $0x1,%eax
test   %rcx,%rcx
je     114e <check_csum_offload+0x3e>
pop    %rbx
ret
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@ETHTOOL_GGRO = global i32 0
@ETHTOOL_GRXCSUM = global i32 0
define i32 @check_csum_offload(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = icmp ne i8* %4, null
br i1 %5, label %7, label %6
6: ; preds = %1
store i32 0, i32* %2
br label %19
7: ; preds = %1
%8 = load i8*, i8** %3
%9 = load i32, i32* @ETHTOOL_GGRO
%10 = call i64 @get_ethtool_feature_val(i8* %8, i32 %9)
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %18
12: ; preds = %7
%13 = load i8*, i8** %3
%14 = load i32, i32* @ETHTOOL_GRXCSUM
%15 = call i64 @get_ethtool_feature_val(i8* %13, i32 %14)
%16 = icmp ne i64 %15, 0
br i1 %16, label %17, label %18
17: ; preds = %12
store i32 1, i32* %2
br label %19
18: ; preds = %12, %7
store i32 0, i32* %2
br label %19
19: ; preds = %18, %17, %6
%20 = load i32, i32* %2
ret i32 %20
}

LLVM IR (-O2):
@ETHTOOL_GGRO = global i32 0
@ETHTOOL_GRXCSUM = global i32 0
define i32 @check_csum_offload(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %12, label %3
3: ; preds = %1
%4 = load i32, i32* @ETHTOOL_GGRO
%5 = tail call i64 @get_ethtool_feature_val(i8* %0, i32 %4)
%6 = icmp eq i64 %5, 0
br i1 %6, label %11, label %7
7: ; preds = %3
%8 = load i32, i32* @ETHTOOL_GRXCSUM
%9 = tail call i64 @get_ethtool_feature_val(i8* %0, i32 %8)
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %7, %3
br label %12
12: ; preds = %7, %1, %11
%13 = phi i32 [ 0, %11 ], [ 0, %1 ], [ 1, %7 ]
ret i32 %13
}