#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 inet_addr(char *);
int /*<<< orphan*/ printf(char *, int, char *, int, int, int);
int /*<<< orphan*/ sscanf(char *, char *, char *, char *, char *, char *,
                          char *, char *, char *, char *, char *, char *,
                          char *, char *, char *, char *, char *, char *);
int strlen(char *);
void get_arp_ip() {
  char *str = "10.11.12.1";
  char *p = str;
  char ips[16][16] = {0};
  sscanf(str,
         "%[^;];%[^;];%[^;];%[^;];%[^;];%[^;];%[^;];%[^;];%[^;];%[^;];%[^;];%[^"
         ";];%[^;];%[^;];%[^;];%[^;];",
         ips[0], ips[1], ips[2], ips[3], ips[4], ips[5], ips[6], ips[7], ips[8],
         ips[9], ips[10], ips[11], ips[12], ips[13], ips[14], ips[15]);
  int i, j;
  for (i = 0; i < 16; i++)
    printf("ips[%d] = %s, strlen(ips[%d])= %d, 0x%x\n", i, &ips[i][0], i,
           strlen(ips[i]), inet_addr(ips[i]));
}


x86 assembly (clang, -O0):
<get_arp_ip>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1b8,%rsp
lea    0xe95(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x38(%rbp)
lea    -0x140(%rbp),%rdi
xor    %esi,%esi
mov    $0x100,%edx
call   1050 <memset@plt>
mov    -0x30(%rbp),%rdi
lea    -0x140(%rbp),%rdx
lea    -0x140(%rbp),%rcx
add    $0x10,%rcx
lea    -0x140(%rbp),%r8
add    $0x20,%r8
lea    -0x140(%rbp),%r9
add    $0x30,%r9
lea    -0x140(%rbp),%rax
add    $0x40,%rax
lea    -0x140(%rbp),%rsi
add    $0x50,%rsi
mov    %rsi,-0x168(%rbp)
lea    -0x140(%rbp),%rsi
add    $0x60,%rsi
mov    %rsi,-0x160(%rbp)
lea    -0x140(%rbp),%rsi
add    $0x70,%rsi
mov    %rsi,-0x158(%rbp)
lea    -0x140(%rbp),%r13
add    $0x80,%r13
lea    -0x140(%rbp),%r12
add    $0x90,%r12
lea    -0x140(%rbp),%r15
add    $0xa0,%r15
lea    -0x140(%rbp),%r14
add    $0xb0,%r14
lea    -0x140(%rbp),%rbx
add    $0xc0,%rbx
lea    -0x140(%rbp),%r11
add    $0xd0,%r11
lea    -0x140(%rbp),%r10
add    $0xe0,%r10
lea    -0x140(%rbp),%rsi
add    $0xf0,%rsi
mov    %rsi,-0x150(%rbp)
lea    0xd96(%rip),%rsi
mov    %rax,(%rsp)
mov    -0x168(%rbp),%rax
mov    %rax,0x8(%rsp)
mov    -0x160(%rbp),%rax
mov    %rax,0x10(%rsp)
mov    -0x158(%rbp),%rax
mov    %rax,0x18(%rsp)
mov    -0x150(%rbp),%rax
mov    %r13,0x20(%rsp)
mov    %r12,0x28(%rsp)
mov    %r15,0x30(%rsp)
mov    %r14,0x38(%rsp)
mov    %rbx,0x40(%rsp)
mov    %r11,0x48(%rsp)
mov    %r10,0x50(%rsp)
mov    %rax,0x58(%rsp)
call   1070 <sscanf@plt>
movl   $0x0,-0x144(%rbp)
cmpl   $0x10,-0x144(%rbp)
jge    1393 <get_arp_ip+0x243>
mov    -0x144(%rbp),%eax
mov    %eax,-0x17c(%rbp)
movslq -0x144(%rbp),%rcx
lea    -0x140(%rbp),%rax
shl    $0x4,%rcx
add    %rcx,%rax
mov    %rax,-0x178(%rbp)
mov    -0x144(%rbp),%eax
mov    %eax,-0x170(%rbp)
movslq -0x144(%rbp),%rax
lea    -0x140(%rbp),%rdi
shl    $0x4,%rax
add    %rax,%rdi
call   1030 <strlen@plt>
mov    %eax,-0x16c(%rbp)
movslq -0x144(%rbp),%rax
lea    -0x140(%rbp),%rdi
shl    $0x4,%rax
add    %rax,%rdi
call   1060 <inet_addr@plt>
mov    -0x17c(%rbp),%esi
mov    -0x178(%rbp),%rdx
mov    -0x170(%rbp),%ecx
mov    -0x16c(%rbp),%r8d
mov    %eax,%r9d
lea    0xcf2(%rip),%rdi
call   1040 <printf@plt>
mov    -0x144(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x144(%rbp)
jmp    12db <get_arp_ip+0x18b>
add    $0x1b8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_arp_ip>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x108,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0xf0(%rsp)
movaps %xmm0,0xe0(%rsp)
movaps %xmm0,0xd0(%rsp)
movaps %xmm0,0xc0(%rsp)
movaps %xmm0,0xb0(%rsp)
movaps %xmm0,0xa0(%rsp)
movaps %xmm0,0x90(%rsp)
movaps %xmm0,0x80(%rsp)
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
lea    0x10(%rsp),%rcx
lea    0x20(%rsp),%r8
lea    0x30(%rsp),%r9
lea    0x80(%rsp),%r13
lea    0x90(%rsp),%rbx
lea    0xa0(%rsp),%rax
lea    0xb0(%rsp),%rbp
lea    0xc0(%rsp),%r10
lea    0xd0(%rsp),%r11
lea    0xe0(%rsp),%r15
lea    0xf0(%rsp),%r12
lea    0xdef(%rip),%rdi
lea    0xdf3(%rip),%rsi
mov    %rsp,%r14
mov    %r14,%rdx
push   %r12
push   %r15
push   %r11
push   %r10
push   %rbp
push   %rax
push   %rbx
push   %r13
lea    0xb0(%rsp),%rax
push   %rax
lea    0xa8(%rsp),%rax
push   %rax
lea    0xa0(%rsp),%rax
push   %rax
lea    0x98(%rsp),%rax
push   %rax
call   1060 <sscanf@plt>
add    $0x60,%rsp
xor    %ebx,%ebx
lea    0xe0b(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1030 <strlen@plt>
mov    %eax,%ebp
mov    %r14,%rdi
call   1050 <inet_addr@plt>
mov    %r15,%rdi
mov    %ebx,%esi
mov    %r14,%rdx
mov    %ebx,%ecx
mov    %ebp,%r8d
mov    %eax,%r9d
call   1040 <printf@plt>
add    $0x1,%rbx
add    $0x10,%r14
cmp    $0x10,%rbx
jne    1270 <get_arp_ip+0x130>
add    $0x108,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [11 x i8] c"10.11.12.1\00"
@.str.1 = [97 x i8] c"%[^;];%[^;];%[^;];%[^;];%[^;];%[^;];%[^;];%[^;];%[^;];%[^;];%[^;];%[^;];%[^;];%[^;];%[^;];%[^;];\00"
@.str.2 = [41 x i8] c"ips[%d] = %s, strlen(ips[%d])= %d, 0x%x\0A\00"
define void @get_arp_ip() {
%1 = alloca i8*
%2 = alloca i8*
%3 = alloca [16 x [16 x i8]]
%4 = alloca i32
%5 = alloca i32
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8** %1
%6 = load i8*, i8** %1
store i8* %6, i8** %2
%7 = bitcast [16 x [16 x i8]]* %3 to i8*
%8 = load i8*, i8** %1
%9 = getelementptr inbounds [16 x [16 x i8]], [16 x [16 x i8]]* %3, i64 0, i64 0
%10 = getelementptr inbounds [16 x i8], [16 x i8]* %9, i64 0, i64 0
%11 = getelementptr inbounds [16 x [16 x i8]], [16 x [16 x i8]]* %3, i64 0, i64 1
%12 = getelementptr inbounds [16 x i8], [16 x i8]* %11, i64 0, i64 0
%13 = getelementptr inbounds [16 x [16 x i8]], [16 x [16 x i8]]* %3, i64 0, i64 2
%14 = getelementptr inbounds [16 x i8], [16 x i8]* %13, i64 0, i64 0
%15 = getelementptr inbounds [16 x [16 x i8]], [16 x [16 x i8]]* %3, i64 0, i64 3
%16 = getelementptr inbounds [16 x i8], [16 x i8]* %15, i64 0, i64 0
%17 = getelementptr inbounds [16 x [16 x i8]], [16 x [16 x i8]]* %3, i64 0, i64 4
%18 = getelementptr inbounds [16 x i8], [16 x i8]* %17, i64 0, i64 0
%19 = getelementptr inbounds [16 x [16 x i8]], [16 x [16 x i8]]* %3, i64 0, i64 5
%20 = getelementptr inbounds [16 x i8], [16 x i8]* %19, i64 0, i64 0
%21 = getelementptr inbounds [16 x [16 x i8]], [16 x [16 x i8]]* %3, i64 0, i64 6
%22 = getelementptr inbounds [16 x i8], [16 x i8]* %21, i64 0, i64 0
%23 = getelementptr inbounds [16 x [16 x i8]], [16 x [16 x i8]]* %3, i64 0, i64 7
%24 = getelementptr inbounds [16 x i8], [16 x i8]* %23, i64 0, i64 0
%25 = getelementptr inbounds [16 x [16 x i8]], [16 x [16 x i8]]* %3, i64 0, i64 8
%26 = getelementptr inbounds [16 x i8], [16 x i8]* %25, i64 0, i64 0
%27 = getelementptr inbounds [16 x [16 x i8]], [16 x [16 x i8]]* %3, i64 0, i64 9
%28 = getelementptr inbounds [16 x i8], [16 x i8]* %27, i64 0, i64 0
%29 = getelementptr inbounds [16 x [16 x i8]], [16 x [16 x i8]]* %3, i64 0, i64 10
%30 = getelementptr inbounds [16 x i8], [16 x i8]* %29, i64 0, i64 0
%31 = getelementptr inbounds [16 x [16 x i8]], [16 x [16 x i8]]* %3, i64 0, i64 11
%32 = getelementptr inbounds [16 x i8], [16 x i8]* %31, i64 0, i64 0
%33 = getelementptr inbounds [16 x [16 x i8]], [16 x [16 x i8]]* %3, i64 0, i64 12
%34 = getelementptr inbounds [16 x i8], [16 x i8]* %33, i64 0, i64 0
%35 = getelementptr inbounds [16 x [16 x i8]], [16 x [16 x i8]]* %3, i64 0, i64 13
%36 = getelementptr inbounds [16 x i8], [16 x i8]* %35, i64 0, i64 0
%37 = getelementptr inbounds [16 x [16 x i8]], [16 x [16 x i8]]* %3, i64 0, i64 14
%38 = getelementptr inbounds [16 x i8], [16 x i8]* %37, i64 0, i64 0
%39 = getelementptr inbounds [16 x [16 x i8]], [16 x [16 x i8]]* %3, i64 0, i64 15
%40 = getelementptr inbounds [16 x i8], [16 x i8]* %39, i64 0, i64 0
%41 = call i32 @sscanf(i8* %8, i8* getelementptr inbounds ([97 x i8], [97 x i8]* @.str.1, i64 0, i64 0), i8* %10, i8* %12, i8* %14, i8* %16, i8* %18, i8* %20, i8* %22, i8* %24, i8* %26, i8* %28, i8* %30, i8* %32, i8* %34, i8* %36, i8* %38, i8* %40)
store i32 0, i32* %4
br label %42
42: ; preds = %63, %0
%43 = load i32, i32* %4
%44 = icmp slt i32 %43, 16
br i1 %44, label %45, label %66
45: ; preds = %42
%46 = load i32, i32* %4
%47 = load i32, i32* %4
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds [16 x [16 x i8]], [16 x [16 x i8]]* %3, i64 0, i64 %48
%50 = getelementptr inbounds [16 x i8], [16 x i8]* %49, i64 0, i64 0
%51 = load i32, i32* %4
%52 = load i32, i32* %4
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds [16 x [16 x i8]], [16 x [16 x i8]]* %3, i64 0, i64 %53
%55 = getelementptr inbounds [16 x i8], [16 x i8]* %54, i64 0, i64 0
%56 = call i32 @strlen(i8* %55)
%57 = load i32, i32* %4
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds [16 x [16 x i8]], [16 x [16 x i8]]* %3, i64 0, i64 %58
%60 = getelementptr inbounds [16 x i8], [16 x i8]* %59, i64 0, i64 0
%61 = call i32 @inet_addr(i8* %60)
%62 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0), i32 %46, i8* %50, i32 %51, i32 %56, i32 %61)
br label %63
63: ; preds = %45
%64 = load i32, i32* %4
%65 = add nsw i32 %64, 1
store i32 %65, i32* %4
br label %42
66: ; preds = %42
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"10.11.12.1\00"
@.str.1 = [97 x i8] c"%[^;];%[^;];%[^;];%[^;];%[^;];%[^;];%[^;];%[^;];%[^;];%[^;];%[^;];%[^;];%[^;];%[^;];%[^;];%[^;];\00"
@.str.2 = [41 x i8] c"ips[%d] = %s, strlen(ips[%d])= %d, 0x%x\0A\00"
define void @get_arp_ip() {
%1 = alloca [16 x [16 x i8]]
%2 = getelementptr inbounds [16 x [16 x i8]], [16 x [16 x i8]]* %1, i64 0, i64 0, i64 0
%3 = getelementptr inbounds [16 x [16 x i8]], [16 x [16 x i8]]* %1, i64 0, i64 1, i64 0
%4 = getelementptr inbounds [16 x [16 x i8]], [16 x [16 x i8]]* %1, i64 0, i64 2, i64 0
%5 = getelementptr inbounds [16 x [16 x i8]], [16 x [16 x i8]]* %1, i64 0, i64 3, i64 0
%6 = getelementptr inbounds [16 x [16 x i8]], [16 x [16 x i8]]* %1, i64 0, i64 4, i64 0
%7 = getelementptr inbounds [16 x [16 x i8]], [16 x [16 x i8]]* %1, i64 0, i64 5, i64 0
%8 = getelementptr inbounds [16 x [16 x i8]], [16 x [16 x i8]]* %1, i64 0, i64 6, i64 0
%9 = getelementptr inbounds [16 x [16 x i8]], [16 x [16 x i8]]* %1, i64 0, i64 7, i64 0
%10 = getelementptr inbounds [16 x [16 x i8]], [16 x [16 x i8]]* %1, i64 0, i64 8, i64 0
%11 = getelementptr inbounds [16 x [16 x i8]], [16 x [16 x i8]]* %1, i64 0, i64 9, i64 0
%12 = getelementptr inbounds [16 x [16 x i8]], [16 x [16 x i8]]* %1, i64 0, i64 10, i64 0
%13 = getelementptr inbounds [16 x [16 x i8]], [16 x [16 x i8]]* %1, i64 0, i64 11, i64 0
%14 = getelementptr inbounds [16 x [16 x i8]], [16 x [16 x i8]]* %1, i64 0, i64 12, i64 0
%15 = getelementptr inbounds [16 x [16 x i8]], [16 x [16 x i8]]* %1, i64 0, i64 13, i64 0
%16 = getelementptr inbounds [16 x [16 x i8]], [16 x [16 x i8]]* %1, i64 0, i64 14, i64 0
%17 = getelementptr inbounds [16 x [16 x i8]], [16 x [16 x i8]]* %1, i64 0, i64 15, i64 0
%18 = call i32 @sscanf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([97 x i8], [97 x i8]* @.str.1, i64 0, i64 0), i8* %2, i8* %3, i8* %4, i8* %5, i8* %6, i8* %7, i8* %8, i8* %9, i8* %10, i8* %11, i8* %12, i8* %13, i8* %14, i8* %15, i8* %16, i8* %17)
br label %19
19: ; preds = %0, %19
%20 = phi i64 [ 0, %0 ], [ %26, %19 ]
%21 = getelementptr inbounds [16 x [16 x i8]], [16 x [16 x i8]]* %1, i64 0, i64 %20, i64 0
%22 = call i32 @strlen(i8* %21)
%23 = call i32 @inet_addr(i8* %21)
%24 = trunc i64 %20 to i32
%25 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0), i32 %24, i8* %21, i32 %24, i32 %22, i32 %23)
%26 = add nuw nsw i64 %20, 1
%27 = icmp eq i64 %26, 16
br i1 %27, label %28, label %19
28: ; preds = %19
ret void
}