#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 */
typedef int /*<<< orphan*/ regex_t;

/* Variables and functions */
int /*<<< orphan*/ read_sources(int, int /*<<< orphan*/);
int /*<<< orphan*/ send_parameters(int, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int configure_kismet_server(int sockfd, regex_t source_reg) {
  char text[1024];
  strcpy(text, "!1 capability source\n");
  send_parameters(sockfd, text);
  strcpy(text, "!1 enable source username,uuid\n");
  send_parameters(sockfd, text);
  read_sources(sockfd, source_reg);
  strcpy(text, "!3 enable client bssid,mac,type,channel\n");
  send_parameters(sockfd, text);
  strcpy(text, "!4 enable clisrc signal_dbm,uuid\n");
  send_parameters(sockfd, text);
  strcpy(text, "!5 enable bssid bssid,type\n");
  send_parameters(sockfd, text);
  strcpy(text, "!6 enable bssidsrc signal_dbm,uuid\n");
  send_parameters(sockfd, text);
  return 0;
}


x86 assembly (clang, -O0):
<configure_kismet_server>:
push   %rbp
mov    %rsp,%rbp
sub    $0x410,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
lea    -0x410(%rbp),%rdi
lea    0xeb1(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x4(%rbp),%edi
lea    -0x410(%rbp),%rsi
call   1040 <send_parameters@plt>
lea    -0x410(%rbp),%rdi
lea    0xea5(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x4(%rbp),%edi
lea    -0x410(%rbp),%rsi
call   1040 <send_parameters@plt>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1050 <read_sources@plt>
lea    -0x410(%rbp),%rdi
lea    0xe98(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x4(%rbp),%edi
lea    -0x410(%rbp),%rsi
call   1040 <send_parameters@plt>
lea    -0x410(%rbp),%rdi
lea    0xe9f(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x4(%rbp),%edi
lea    -0x410(%rbp),%rsi
call   1040 <send_parameters@plt>
lea    -0x410(%rbp),%rdi
lea    0xe9f(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x4(%rbp),%edi
lea    -0x410(%rbp),%rsi
call   1040 <send_parameters@plt>
lea    -0x410(%rbp),%rdi
lea    0xe99(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x4(%rbp),%edi
lea    -0x410(%rbp),%rsi
call   1040 <send_parameters@plt>
xor    %eax,%eax
add    $0x410,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<configure_kismet_server>:
push   %rbp
push   %r14
push   %rbx
sub    $0x400,%rsp
mov    %esi,%ebp
mov    %edi,%ebx
lea    0xeba(%rip),%rsi
mov    %rsp,%r14
mov    %r14,%rdi
call   1030 <strcpy@plt>
mov    %ebx,%edi
mov    %r14,%rsi
call   1040 <send_parameters@plt>
lea    0xeb4(%rip),%rsi
mov    %r14,%rdi
call   1030 <strcpy@plt>
mov    %ebx,%edi
mov    %r14,%rsi
call   1040 <send_parameters@plt>
mov    %ebx,%edi
mov    %ebp,%esi
call   1050 <read_sources@plt>
lea    0xeb2(%rip),%rsi
mov    %r14,%rdi
call   1030 <strcpy@plt>
mov    %ebx,%edi
mov    %r14,%rsi
call   1040 <send_parameters@plt>
lea    0xec2(%rip),%rsi
mov    %r14,%rdi
call   1030 <strcpy@plt>
mov    %ebx,%edi
mov    %r14,%rsi
call   1040 <send_parameters@plt>
lea    0xecb(%rip),%rsi
mov    %r14,%rdi
call   1030 <strcpy@plt>
mov    %ebx,%edi
mov    %r14,%rsi
call   1040 <send_parameters@plt>
lea    0xece(%rip),%rsi
mov    %r14,%rdi
call   1030 <strcpy@plt>
mov    %ebx,%edi
mov    %r14,%rsi
call   1040 <send_parameters@plt>
xor    %eax,%eax
add    $0x400,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [22 x i8] c"!1 capability source\0A\00"
@.str.1 = [32 x i8] c"!1 enable source username,uuid\0A\00"
@.str.2 = [41 x i8] c"!3 enable client bssid,mac,type,channel\0A\00"
@.str.3 = [34 x i8] c"!4 enable clisrc signal_dbm,uuid\0A\00"
@.str.4 = [28 x i8] c"!5 enable bssid bssid,type\0A\00"
@.str.5 = [36 x i8] c"!6 enable bssidsrc signal_dbm,uuid\0A\00"
define i32 @configure_kismet_server(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca [1024 x i8]
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%7 = call i32 @strcpy(i8* %6, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%8 = load i32, i32* %3
%9 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%10 = call i32 @send_parameters(i32 %8, i8* %9)
%11 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%12 = call i32 @strcpy(i8* %11, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0))
%13 = load i32, i32* %3
%14 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%15 = call i32 @send_parameters(i32 %13, i8* %14)
%16 = load i32, i32* %3
%17 = load i32, i32* %4
%18 = call i32 @read_sources(i32 %16, i32 %17)
%19 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%20 = call i32 @strcpy(i8* %19, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0))
%21 = load i32, i32* %3
%22 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%23 = call i32 @send_parameters(i32 %21, i8* %22)
%24 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%25 = call i32 @strcpy(i8* %24, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0))
%26 = load i32, i32* %3
%27 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%28 = call i32 @send_parameters(i32 %26, i8* %27)
%29 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%30 = call i32 @strcpy(i8* %29, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.4, i64 0, i64 0))
%31 = load i32, i32* %3
%32 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%33 = call i32 @send_parameters(i32 %31, i8* %32)
%34 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%35 = call i32 @strcpy(i8* %34, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.5, i64 0, i64 0))
%36 = load i32, i32* %3
%37 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%38 = call i32 @send_parameters(i32 %36, i8* %37)
ret i32 0
}

LLVM IR (-O2):
@.str = [22 x i8] c"!1 capability source\0A\00"
@.str.1 = [32 x i8] c"!1 enable source username,uuid\0A\00"
@.str.2 = [41 x i8] c"!3 enable client bssid,mac,type,channel\0A\00"
@.str.3 = [34 x i8] c"!4 enable clisrc signal_dbm,uuid\0A\00"
@.str.4 = [28 x i8] c"!5 enable bssid bssid,type\0A\00"
@.str.5 = [36 x i8] c"!6 enable bssidsrc signal_dbm,uuid\0A\00"
define i32 @configure_kismet_server(i32 %0, i32 %1) {
%3 = alloca [1024 x i8]
%4 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%5 = call i32 @strcpy(i8* %4, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @send_parameters(i32 %0, i8* %4)
%7 = call i32 @strcpy(i8* %4, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 @send_parameters(i32 %0, i8* %4)
%9 = call i32 @read_sources(i32 %0, i32 %1)
%10 = call i32 @strcpy(i8* %4, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0))
%11 = call i32 @send_parameters(i32 %0, i8* %4)
%12 = call i32 @strcpy(i8* %4, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0))
%13 = call i32 @send_parameters(i32 %0, i8* %4)
%14 = call i32 @strcpy(i8* %4, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.4, i64 0, i64 0))
%15 = call i32 @send_parameters(i32 %0, i8* %4)
%16 = call i32 @strcpy(i8* %4, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.5, i64 0, i64 0))
%17 = call i32 @send_parameters(i32 %0, i8* %4)
ret i32 0
}