#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*/ printf(char *, ...);
int /*<<< orphan*/ snprintf(char *, int, char *, char *);
int /*<<< orphan*/ system(char *);
int mshell_ifc(char **args) {
  char *word;
  char real;
  if (args[1] == NULL) {
    printf("mshell_ifc called");
    system("ifconfig eth1");
  } else {
    char *word = args[1];
    printf("\n%s", word);
    char my_cmd[64];
    snprintf(my_cmd, 64, "ifconfig %s", word);
    system(my_cmd);
    return 1;
  }
  return 1;
}


x86 assembly (clang, -O0):
<mshell_ifc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpq   $0x0,0x8(%rax)
jne    116a <mshell_ifc+0x3a>
lea    0xeae(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xeb2(%rip),%rdi
call   1030 <system@plt>
jmp    11b6 <mshell_ifc+0x86>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rsi
lea    0xe9f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x70(%rbp),%rdi
mov    -0x28(%rbp),%rcx
mov    $0x40,%esi
lea    0xe88(%rip),%rdx
call   1050 <snprintf@plt>
lea    -0x70(%rbp),%rdi
call   1030 <system@plt>
movl   $0x1,-0x4(%rbp)
jmp    11bd <mshell_ifc+0x8d>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mshell_ifc>:
push   %r14
push   %rbx
sub    $0x48,%rsp
mov    0x8(%rdi),%rbx
test   %rbx,%rbx
je     1170 <mshell_ifc+0x40>
lea    0xed9(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xecc(%rip),%rdx
mov    %rsp,%r14
mov    %r14,%rdi
mov    $0x40,%esi
mov    %rbx,%rcx
call   1050 <snprintf@plt>
mov    %r14,%rdi
jmp    1185 <mshell_ifc+0x55>
lea    0xe89(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe8d(%rip),%rdi
call   1030 <system@plt>
mov    $0x1,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [18 x i8] c"mshell_ifc called\00"
@.str.1 = [14 x i8] c"ifconfig eth1\00"
@.str.2 = [4 x i8] c"\0A%s\00"
@.str.3 = [12 x i8] c"ifconfig %s\00"
define i32 @mshell_ifc(i8** %0) {
%2 = alloca i32
%3 = alloca i8**
%4 = alloca i8*
%5 = alloca i8
%6 = alloca i8*
%7 = alloca [64 x i8]
store i8** %0, i8*** %3
%8 = load i8**, i8*** %3
%9 = getelementptr inbounds i8*, i8** %8, i64 1
%10 = load i8*, i8** %9
%11 = icmp eq i8* %10, null
br i1 %11, label %12, label %15
12: ; preds = %1
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%14 = call i32 @system(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
br label %26
15: ; preds = %1
%16 = load i8**, i8*** %3
%17 = getelementptr inbounds i8*, i8** %16, i64 1
%18 = load i8*, i8** %17
store i8* %18, i8** %6
%19 = load i8*, i8** %6
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %19)
%21 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 0
%22 = load i8*, i8** %6
%23 = call i32 @snprintf(i8* %21, i32 64, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i8* %22)
%24 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 0
%25 = call i32 @system(i8* %24)
store i32 1, i32* %2
br label %27
26: ; preds = %12
store i32 1, i32* %2
br label %27
27: ; preds = %26, %15
%28 = load i32, i32* %2
ret i32 %28
}

LLVM IR (-O2):
@.str = [18 x i8] c"mshell_ifc called\00"
@.str.1 = [14 x i8] c"ifconfig eth1\00"
@.str.2 = [4 x i8] c"\0A%s\00"
@.str.3 = [12 x i8] c"ifconfig %s\00"
define i32 @mshell_ifc(i8** nocapture %0) {
%2 = alloca [64 x i8]
%3 = getelementptr inbounds i8*, i8** %0, i64 1
%4 = load i8*, i8** %3
%5 = icmp eq i8* %4, null
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%8 = tail call i32 @system(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
br label %14
9: ; preds = %1
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %4)
%11 = getelementptr inbounds [64 x i8], [64 x i8]* %2, i64 0, i64 0
%12 = call i32 @snprintf(i8* %11, i32 64, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i8* %4)
%13 = call i32 @system(i8* %11)
br label %14
14: ; preds = %6, %9
ret i32 1
}