#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 */
char atoi(int /*<<< orphan*/);
int /*<<< orphan*/ *getopt(char *, char *);
int /*<<< orphan*/ strtok(int /*<<< orphan*/ *, char *);
char *getip(char *config2, char *token) {
  static char ip[4];
  ip[0] = atoi(strtok(getopt(config2, token), "."));
  ip[1] = atoi(strtok(NULL, "."));
  ip[2] = atoi(strtok(NULL, "."));
  ip[3] = atoi(strtok(NULL, "."));
  return ip;
}


x86 assembly (clang, -O0):
<getip>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <getopt@plt>
mov    %rax,%rdi
lea    0xea9(%rip),%rsi
call   1030 <strtok@plt>
mov    %eax,%edi
call   1050 <atoi@plt>
mov    %al,0x2ed0(%rip)
xor    %eax,%eax
mov    %eax,%edi
lea    0xe8c(%rip),%rsi
call   1030 <strtok@plt>
mov    %eax,%edi
call   1050 <atoi@plt>
mov    %al,0x2eb4(%rip)
xor    %eax,%eax
mov    %eax,%edi
lea    0xe6f(%rip),%rsi
call   1030 <strtok@plt>
mov    %eax,%edi
call   1050 <atoi@plt>
mov    %al,0x2e98(%rip)
xor    %eax,%eax
mov    %eax,%edi
lea    0xe52(%rip),%rsi
call   1030 <strtok@plt>
mov    %eax,%edi
call   1050 <atoi@plt>
mov    %al,0x2e7c(%rip)
lea    0x2e72(%rip),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getip>:
push   %r14
push   %rbx
push   %rax
call   1040 <getopt@plt>
lea    0xec0(%rip),%rbx
mov    %rax,%rdi
mov    %rbx,%rsi
call   1030 <strtok@plt>
mov    %eax,%edi
call   1050 <atoi@plt>
mov    %al,0x2ee1(%rip)
lea    0x2eda(%rip),%r14
xor    %edi,%edi
mov    %rbx,%rsi
call   1030 <strtok@plt>
mov    %eax,%edi
call   1050 <atoi@plt>
mov    %al,0x2ec4(%rip)
xor    %edi,%edi
mov    %rbx,%rsi
call   1030 <strtok@plt>
mov    %eax,%edi
call   1050 <atoi@plt>
mov    %al,0x2eae(%rip)
xor    %edi,%edi
mov    %rbx,%rsi
call   1030 <strtok@plt>
mov    %eax,%edi
call   1050 <atoi@plt>
mov    %al,0x2e98(%rip)
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@getip.ip = internal global [4 x i8] zeroinitializer
@.str = [2 x i8] c".\00"
define i8* @getip(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = load i8*, i8** %4
%7 = call i32* @getopt(i8* %5, i8* %6)
%8 = call i32 @strtok(i32* %7, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%9 = call signext i8 @atoi(i32 %8)
store i8 %9, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @getip.ip, i64 0, i64 0)
%10 = call i32 @strtok(i32* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%11 = call signext i8 @atoi(i32 %10)
store i8 %11, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @getip.ip, i64 0, i64 1)
%12 = call i32 @strtok(i32* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%13 = call signext i8 @atoi(i32 %12)
store i8 %13, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @getip.ip, i64 0, i64 2)
%14 = call i32 @strtok(i32* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%15 = call signext i8 @atoi(i32 %14)
store i8 %15, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @getip.ip, i64 0, i64 3)
ret i8* getelementptr inbounds ([4 x i8], [4 x i8]* @getip.ip, i64 0, i64 0)
}

LLVM IR (-O2):
@getip.ip = internal global [4 x i8] zeroinitializer
@.str = [2 x i8] c".\00"
define i8* @getip(i8* %0, i8* %1) {
%3 = tail call i32* @getopt(i8* %0, i8* %1)
%4 = tail call i32 @strtok(i32* %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%5 = tail call signext i8 @atoi(i32 %4)
store i8 %5, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @getip.ip, i64 0, i64 0)
%6 = tail call i32 @strtok(i32* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%7 = tail call signext i8 @atoi(i32 %6)
store i8 %7, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @getip.ip, i64 0, i64 1)
%8 = tail call i32 @strtok(i32* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%9 = tail call signext i8 @atoi(i32 %8)
store i8 %9, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @getip.ip, i64 0, i64 2)
%10 = tail call i32 @strtok(i32* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%11 = tail call signext i8 @atoi(i32 %10)
store i8 %11, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @getip.ip, i64 0, i64 3)
ret i8* getelementptr inbounds ([4 x i8], [4 x i8]* @getip.ip, i64 0, i64 0)
}