#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 atoi(char *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ readFromServer(char *);
int strlen(char *);
int /*<<< orphan*/ strncpy(char *, char *, int);
char *strtok(char *, char *);
int getConfiguration(int *type, char *fname, int *nThread) {
  char conf[512];
  char *p;
  int i;
  readFromServer(conf);
  p = strtok(conf, ":");
  printf("%s\n", p);
  *type = atoi(p);
  p = strtok(NULL, ":");
  i = strlen(p);
  strncpy(fname, p, i);
  p = strtok(NULL, ":");
  *nThread = atoi(p);
  return 0;
}


x86 assembly (clang, -O0):
<getConfiguration>:
push   %rbp
mov    %rsp,%rbp
sub    $0x230,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
lea    -0x220(%rbp),%rdi
call   1060 <readFromServer@plt>
lea    -0x220(%rbp),%rdi
lea    0xe6f(%rip),%rsi
call   1070 <strtok@plt>
mov    %rax,-0x228(%rbp)
mov    -0x228(%rbp),%rsi
lea    0xe57(%rip),%rdi
call   1050 <printf@plt>
mov    -0x228(%rbp),%rdi
call   1080 <atoi@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
xor    %eax,%eax
mov    %eax,%edi
lea    0xe31(%rip),%rsi
call   1070 <strtok@plt>
mov    %rax,-0x228(%rbp)
mov    -0x228(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x22c(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x228(%rbp),%rsi
mov    -0x22c(%rbp),%edx
call   1030 <strncpy@plt>
xor    %eax,%eax
mov    %eax,%edi
lea    0xdf2(%rip),%rsi
call   1070 <strtok@plt>
mov    %rax,-0x228(%rbp)
mov    -0x228(%rbp),%rdi
call   1080 <atoi@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
xor    %eax,%eax
add    $0x230,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getConfiguration>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x200,%rsp
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%r13
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1060 <readFromServer@plt>
lea    0xe75(%rip),%r12
mov    %rbx,%rdi
mov    %r12,%rsi
call   1070 <strtok@plt>
mov    %rax,%rbx
lea    0xe62(%rip),%rdi
mov    %rax,%rsi
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1080 <atoi@plt>
mov    %eax,0x0(%r13)
xor    %edi,%edi
mov    %r12,%rsi
call   1070 <strtok@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <strlen@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <strncpy@plt>
xor    %edi,%edi
mov    %r12,%rsi
call   1070 <strtok@plt>
mov    %rax,%rdi
call   1080 <atoi@plt>
mov    %eax,(%r14)
xor    %eax,%eax
add    $0x200,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [2 x i8] c":\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @getConfiguration(i32* %0, i8* %1, i32* %2) {
%4 = alloca i32*
%5 = alloca i8*
%6 = alloca i32*
%7 = alloca [512 x i8]
%8 = alloca i8*
%9 = alloca i32
store i32* %0, i32** %4
store i8* %1, i8** %5
store i32* %2, i32** %6
%10 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 0
%11 = call i32 @readFromServer(i8* %10)
%12 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 0
%13 = call i8* @strtok(i8* %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i8* %13, i8** %8
%14 = load i8*, i8** %8
%15 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %14)
%16 = load i8*, i8** %8
%17 = call i32 @atoi(i8* %16)
%18 = load i32*, i32** %4
store i32 %17, i32* %18
%19 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i8* %19, i8** %8
%20 = load i8*, i8** %8
%21 = call i32 @strlen(i8* %20)
store i32 %21, i32* %9
%22 = load i8*, i8** %5
%23 = load i8*, i8** %8
%24 = load i32, i32* %9
%25 = call i32 @strncpy(i8* %22, i8* %23, i32 %24)
%26 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i8* %26, i8** %8
%27 = load i8*, i8** %8
%28 = call i32 @atoi(i8* %27)
%29 = load i32*, i32** %6
store i32 %28, i32* %29
ret i32 0
}

LLVM IR (-O2):
@.str = [2 x i8] c":\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @getConfiguration(i32* nocapture writeonly %0, i8* %1, i32* nocapture writeonly %2) {
%4 = alloca [512 x i8]
%5 = getelementptr inbounds [512 x i8], [512 x i8]* %4, i64 0, i64 0
%6 = call i32 @readFromServer(i8* %5)
%7 = call i8* @strtok(i8* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %7)
%9 = call i32 @atoi(i8* %7)
store i32 %9, i32* %0
%10 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @strlen(i8* %10)
%12 = call i32 @strncpy(i8* %1, i8* %10, i32 %11)
%13 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%14 = call i32 @atoi(i8* %13)
store i32 %14, i32* %2
ret i32 0
}