#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 int /*<<< orphan*/ buf;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ snprintf(char *, int, char *, char *, int);
int system(char *);
int if_mtu(char *name, int mtu) {
  char buf[128];
  snprintf(buf, sizeof(buf), "ifconfig %s mtu %d", name, mtu);
  int ret = system(buf);
  if (ret != 0) {
    printf("Could not set MTU for interface %s\n", name);
  }
  return ret;
}


x86 assembly (clang, -O0):
<if_mtu>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
lea    -0x90(%rbp),%rdi
mov    -0x8(%rbp),%rcx
mov    -0xc(%rbp),%r8d
mov    $0x80,%esi
lea    0xea3(%rip),%rdx
call   1050 <snprintf@plt>
lea    -0x90(%rbp),%rdi
call   1030 <system@plt>
mov    %eax,-0x94(%rbp)
cmpl   $0x0,-0x94(%rbp)
je     1191 <if_mtu+0x61>
mov    -0x8(%rbp),%rsi
lea    0xe87(%rip),%rdi
call   1040 <printf@plt>
mov    -0x94(%rbp),%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<if_mtu>:
push   %rbp
push   %rbx
sub    $0x88,%rsp
mov    %esi,%r8d
mov    %rdi,%rbx
lea    0xeba(%rip),%rdx
mov    %rsp,%rbp
mov    %rbp,%rdi
mov    $0x80,%esi
mov    %rbx,%rcx
call   1050 <snprintf@plt>
mov    %rbp,%rdi
call   1030 <system@plt>
mov    %eax,%ebp
test   %eax,%eax
je     1176 <if_mtu+0x46>
lea    0xea5(%rip),%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
mov    %ebp,%eax
add    $0x88,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [19 x i8] c"ifconfig %s mtu %d\00"
@.str.1 = [36 x i8] c"Could not set MTU for interface %s\0A\00"
define i32 @if_mtu(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca [128 x i8]
%6 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%7 = getelementptr inbounds [128 x i8], [128 x i8]* %5, i64 0, i64 0
%8 = load i8*, i8** %3
%9 = load i32, i32* %4
%10 = call i32 @snprintf(i8* %7, i32 128, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %8, i32 %9)
%11 = getelementptr inbounds [128 x i8], [128 x i8]* %5, i64 0, i64 0
%12 = call i32 @system(i8* %11)
store i32 %12, i32* %6
%13 = load i32, i32* %6
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %18
15: ; preds = %2
%16 = load i8*, i8** %3
%17 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0), i8* %16)
br label %18
18: ; preds = %15, %2
%19 = load i32, i32* %6
ret i32 %19
}

LLVM IR (-O2):
@.str = [19 x i8] c"ifconfig %s mtu %d\00"
@.str.1 = [36 x i8] c"Could not set MTU for interface %s\0A\00"
define i32 @if_mtu(i8* %0, i32 %1) {
%3 = alloca [128 x i8]
%4 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%5 = call i32 @snprintf(i8* %4, i32 128, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %1)
%6 = call i32 @system(i8* %4)
%7 = icmp eq i32 %6, 0
br i1 %7, label %10, label %8
8: ; preds = %2
%9 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0), i8* %0)
br label %10
10: ; preds = %8, %2
ret i32 %6
}