#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 net_device {
  int dummy;
};
struct ethtool_cmd {
  int /*<<< orphan*/ autoneg;
  int /*<<< orphan*/ duplex;
  int /*<<< orphan*/ speed;
};

/* Variables and functions */
int /*<<< orphan*/ AUTONEG_DISABLE;
int /*<<< orphan*/ DUPLEX_FULL;
int /*<<< orphan*/ SPEED_10000;
int be_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) {
  ecmd->speed = SPEED_10000;
  ecmd->duplex = DUPLEX_FULL;
  ecmd->autoneg = AUTONEG_DISABLE;
  return 0;
}


x86 assembly (clang, -O0):
<be_get_settings>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2ecd(%rip),%rax
mov    (%rax),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x8(%rax)
mov    0x2ec5(%rip),%rax
mov    (%rax),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x4(%rax)
mov    0x2e9d(%rip),%rax
mov    (%rax),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<be_get_settings>:
mov    0x2ed9(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x8(%rsi)
mov    0x2ed5(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x4(%rsi)
mov    0x2eb1(%rip),%rax
mov    (%rax),%eax
mov    %eax,(%rsi)
xor    %eax,%eax
ret

LLVM IR (-O0):
%struct.net_device = type { i32 }
%struct.ethtool_cmd = type { i32, i32, i32 }
@SPEED_10000 = global i32 0
@DUPLEX_FULL = global i32 0
@AUTONEG_DISABLE = global i32 0
define i32 @be_get_settings(%struct.net_device* %0, %struct.ethtool_cmd* %1) {
%3 = alloca %struct.net_device*
%4 = alloca %struct.ethtool_cmd*
store %struct.net_device* %0, %struct.net_device** %3
store %struct.ethtool_cmd* %1, %struct.ethtool_cmd** %4
%5 = load i32, i32* @SPEED_10000
%6 = load %struct.ethtool_cmd*, %struct.ethtool_cmd** %4
%7 = getelementptr inbounds %struct.ethtool_cmd, %struct.ethtool_cmd* %6, i32 0, i32 2
store i32 %5, i32* %7
%8 = load i32, i32* @DUPLEX_FULL
%9 = load %struct.ethtool_cmd*, %struct.ethtool_cmd** %4
%10 = getelementptr inbounds %struct.ethtool_cmd, %struct.ethtool_cmd* %9, i32 0, i32 1
store i32 %8, i32* %10
%11 = load i32, i32* @AUTONEG_DISABLE
%12 = load %struct.ethtool_cmd*, %struct.ethtool_cmd** %4
%13 = getelementptr inbounds %struct.ethtool_cmd, %struct.ethtool_cmd* %12, i32 0, i32 0
store i32 %11, i32* %13
ret i32 0
}

LLVM IR (-O2):
%struct.net_device = type { i32 }
%struct.ethtool_cmd = type { i32, i32, i32 }
@SPEED_10000 = global i32 0
@DUPLEX_FULL = global i32 0
@AUTONEG_DISABLE = global i32 0
define i32 @be_get_settings(%struct.net_device* nocapture readnone %0, %struct.ethtool_cmd* nocapture writeonly %1) {
%3 = load i32, i32* @SPEED_10000
%4 = getelementptr inbounds %struct.ethtool_cmd, %struct.ethtool_cmd* %1, i64 0, i32 2
store i32 %3, i32* %4
%5 = load i32, i32* @DUPLEX_FULL
%6 = getelementptr inbounds %struct.ethtool_cmd, %struct.ethtool_cmd* %1, i64 0, i32 1
store i32 %5, i32* %6
%7 = load i32, i32* @AUTONEG_DISABLE
%8 = getelementptr inbounds %struct.ethtool_cmd, %struct.ethtool_cmd* %1, i64 0, i32 0
store i32 %7, i32* %8
ret i32 0
}