#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*/ atoi(char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ get_dev(int /*<<< orphan*/, char *);
int /*<<< orphan*/ get_ip(char *, char *);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char **argv) {
  char ip[16];
  char dev[16];
  if (argc < 2) {
    printf("Error: Enter the number of the network device\nExample getIp 1\n");
    exit(1);
  }
  get_dev(atoi(argv[1]), dev);
  printf("Dev :%s\n", dev);
  get_ip(dev, ip);
  printf("IP  :%s\n", ip);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x4(%rbp)
jge    1181 <main+0x31>
lea    0xe90(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <atoi@plt>
mov    %eax,%edi
lea    -0x30(%rbp),%rsi
call   1060 <get_dev@plt>
lea    -0x30(%rbp),%rsi
lea    0xe9b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x30(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1040 <get_ip@plt>
lea    -0x20(%rbp),%rsi
lea    0xe85(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x28,%rsp
cmp    $0x1,%edi
jle    11be <main+0x5e>
mov    0x8(%rsi),%rdi
call   1060 <atoi@plt>
mov    %rsp,%rbx
mov    %eax,%edi
mov    %rbx,%rsi
call   1070 <get_dev@plt>
lea    0xe77(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x10(%rsp),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <get_ip@plt>
lea    0xe5f(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret
lea    0xe4d(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@.str = [63 x i8] c"Error: Enter the number of the network device\0AExample getIp 1\0A\00"
@.str.1 = [9 x i8] c"Dev :%s\0A\00"
@.str.2 = [9 x i8] c"IP :%s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca [16 x i8]
%6 = alloca [16 x i8]
store i32 %0, i32* %3
store i8** %1, i8*** %4
%7 = load i32, i32* %3
%8 = icmp slt i32 %7, 2
br i1 %8, label %9, label %12
9: ; preds = %2
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @exit(i32 1)
unreachable
12: ; preds = %2
%13 = load i8**, i8*** %4
%14 = getelementptr inbounds i8*, i8** %13, i64 1
%15 = load i8*, i8** %14
%16 = call i32 @atoi(i8* %15)
%17 = getelementptr inbounds [16 x i8], [16 x i8]* %6, i64 0, i64 0
%18 = call i32 @get_dev(i32 %16, i8* %17)
%19 = getelementptr inbounds [16 x i8], [16 x i8]* %6, i64 0, i64 0
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* %19)
%21 = getelementptr inbounds [16 x i8], [16 x i8]* %6, i64 0, i64 0
%22 = getelementptr inbounds [16 x i8], [16 x i8]* %5, i64 0, i64 0
%23 = call i32 @get_ip(i8* %21, i8* %22)
%24 = getelementptr inbounds [16 x i8], [16 x i8]* %5, i64 0, i64 0
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* %24)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [9 x i8] c"Dev :%s\0A\00"
@.str.2 = [9 x i8] c"IP :%s\0A\00"
@str = [62 x i8] c"Error: Enter the number of the network device\0AExample getIp 1\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [16 x i8]
%4 = alloca [16 x i8]
%5 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 0
%7 = icmp slt i32 %0, 2
br i1 %7, label %8, label %11
8: ; preds = %2
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([62 x i8], [62 x i8]* @str, i64 0, i64 0))
%10 = tail call i32 @exit(i32 1)
unreachable
11: ; preds = %2
%12 = getelementptr inbounds i8*, i8** %1, i64 1
%13 = load i8*, i8** %12
%14 = tail call i32 @atoi(i8* %13)
%15 = call i32 @get_dev(i32 %14, i8* %6)
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* %6)
%17 = call i32 @get_ip(i8* %6, i8* %5)
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* %5)
ret i32 0
}