#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 ifreq {
  int ifr_mtu;
};

/* Variables and functions */
int /*<<< orphan*/ SIOCSIFMTU;
int atoi(char const *);
int /*<<< orphan*/ die(char *);
scalar_t__ ioctl(int, int /*<<< orphan*/, struct ifreq *);
void setmtu(int s, struct ifreq *ifr, const char *mtu) {
  int m = atoi(mtu);
  ifr->ifr_mtu = m;
  if (ioctl(s, SIOCSIFMTU, ifr) < 0)
    die("SIOCSIFMTU");
}


x86 assembly (clang, -O0):
<setmtu>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x4(%rbp),%edi
mov    0x2e7e(%rip),%rax
mov    (%rax),%esi
mov    -0x10(%rbp),%rdx
call   1030 <ioctl@plt>
cmp    $0x0,%rax
jge    1183 <setmtu+0x53>
lea    0xe82(%rip),%rdi
call   1040 <die@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setmtu>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
mov    %rdx,%rdi
call   1050 <atoi@plt>
mov    %eax,(%rbx)
mov    0x2e97(%rip),%rax
mov    (%rax),%esi
mov    %ebp,%edi
mov    %rbx,%rdx
call   1030 <ioctl@plt>
test   %rax,%rax
js     1161 <setmtu+0x31>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
lea    0xe98(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <die@plt>

LLVM IR (-O0):
%struct.ifreq = type { i32 }
@SIOCSIFMTU = global i32 0
@.str = [11 x i8] c"SIOCSIFMTU\00"
define void @setmtu(i32 %0, %struct.ifreq* %1, i8* %2) {
%4 = alloca i32
%5 = alloca %struct.ifreq*
%6 = alloca i8*
%7 = alloca i32
store i32 %0, i32* %4
store %struct.ifreq* %1, %struct.ifreq** %5
store i8* %2, i8** %6
%8 = load i8*, i8** %6
%9 = call i32 @atoi(i8* %8)
store i32 %9, i32* %7
%10 = load i32, i32* %7
%11 = load %struct.ifreq*, %struct.ifreq** %5
%12 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %11, i32 0, i32 0
store i32 %10, i32* %12
%13 = load i32, i32* %4
%14 = load i32, i32* @SIOCSIFMTU
%15 = load %struct.ifreq*, %struct.ifreq** %5
%16 = call i64 @ioctl(i32 %13, i32 %14, %struct.ifreq* %15)
%17 = icmp slt i64 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %3
%19 = call i32 @die(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
br label %20
20: ; preds = %18, %3
ret void
}

LLVM IR (-O2):
%struct.ifreq = type { i32 }
@SIOCSIFMTU = global i32 0
@.str = [11 x i8] c"SIOCSIFMTU\00"
define void @setmtu(i32 %0, %struct.ifreq* %1, i8* nocapture %2) {
%4 = tail call i32 @atoi(i8* %2)
%5 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %1, i64 0, i32 0
store i32 %4, i32* %5
%6 = load i32, i32* @SIOCSIFMTU
%7 = tail call i64 @ioctl(i32 %0, i32 %6, %struct.ifreq* %1)
%8 = icmp slt i64 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %3
%10 = tail call i32 @die(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
br label %11
11: ; preds = %9, %3
ret void
}