#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*/ set_interface_mtu(int, int, char **);
int /*<<< orphan*/ set_interface_usage();
scalar_t__ strncmp(char *, char *, int);
void set_interface(int sock, int argc, char **argv) {
  if (argc < 2) {
    set_interface_usage();
    return;
  }
  if (strncmp(argv[1], "mtu", 3) == 0) {
    set_interface_mtu(sock, (argc - 1), argv + 1);
    return;
  }
  set_interface_usage();
  return;
}


x86 assembly (clang, -O0):
<set_interface>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    1158 <set_interface+0x28>
mov    $0x0,%al
call   1040 <set_interface_usage@plt>
jmp    119d <set_interface+0x6d>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe99(%rip),%rsi
mov    $0x3,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    1196 <set_interface+0x66>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
sub    $0x1,%esi
mov    -0x10(%rbp),%rdx
add    $0x8,%rdx
call   1050 <set_interface_mtu@plt>
jmp    119d <set_interface+0x6d>
mov    $0x0,%al
call   1040 <set_interface_usage@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_interface>:
push   %rbp
push   %r14
push   %rbx
cmp    $0x1,%esi
jle    115b <set_interface+0x2b>
mov    %rdx,%rbx
mov    %esi,%ebp
mov    %edi,%r14d
mov    0x8(%rdx),%rdi
lea    0xeb4(%rip),%rsi
mov    $0x3,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     1166 <set_interface+0x36>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <set_interface_usage@plt>
add    $0x8,%rbx
add    $0xffffffff,%ebp
mov    %r14d,%edi
mov    %ebp,%esi
mov    %rbx,%rdx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1050 <set_interface_mtu@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"mtu\00"
define void @set_interface(i32 %0, i32 %1, i8** %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8**
store i32 %0, i32* %4
store i32 %1, i32* %5
store i8** %2, i8*** %6
%7 = load i32, i32* %5
%8 = icmp slt i32 %7, 2
br i1 %8, label %9, label %11
9: ; preds = %3
%10 = call i32 (...) @set_interface_usage()
br label %26
11: ; preds = %3
%12 = load i8**, i8*** %6
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
%15 = call i64 @strncmp(i8* %14, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 3)
%16 = icmp eq i64 %15, 0
br i1 %16, label %17, label %24
17: ; preds = %11
%18 = load i32, i32* %4
%19 = load i32, i32* %5
%20 = sub nsw i32 %19, 1
%21 = load i8**, i8*** %6
%22 = getelementptr inbounds i8*, i8** %21, i64 1
%23 = call i32 @set_interface_mtu(i32 %18, i32 %20, i8** %22)
br label %26
24: ; preds = %11
%25 = call i32 (...) @set_interface_usage()
br label %26
26: ; preds = %24, %17, %9
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"mtu\00"
define void @set_interface(i32 %0, i32 %1, i8** %2) {
%4 = icmp slt i32 %1, 2
br i1 %4, label %5, label %7
5: ; preds = %3
%6 = tail call i32 (...) @set_interface_usage()
br label %17
7: ; preds = %3
%8 = getelementptr inbounds i8*, i8** %2, i64 1
%9 = load i8*, i8** %8
%10 = tail call i64 @strncmp(i8* %9, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 3)
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %7
%13 = add nsw i32 %1, -1
%14 = tail call i32 @set_interface_mtu(i32 %0, i32 %13, i8** %8)
br label %17
15: ; preds = %7
%16 = tail call i32 (...) @set_interface_usage()
br label %17
17: ; preds = %15, %12, %5
ret void
}