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

/* Variables and functions */
int /*<<< orphan*/ logData(int /*<<< orphan*/ *, char *, char *, char *);
int /*<<< orphan*/ snprintf(char *, int, char *, char *, char *, char *);
char *strchr(char *, char);
void addUser(FILE *log, int sock, char *action) {
  char *p;
  char buf[1024];
  p = strchr(&action[1], ':');
  if (!p) {
    return;
  }
  *p = 0x0;
  logData(log, "Adding user: %s with pass: %s", &action[1], &p[1]);
  snprintf(buf, sizeof(buf) - 1, "echo %s > %s%s.txt", &p[1], "./users/",
           &action[1]);
  return;
}


x86 assembly (clang, -O0):
<addUser>:
push   %rbp
mov    %rsp,%rbp
sub    $0x420,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
add    $0x1,%rdi
mov    $0x3a,%esi
call   1040 <strchr@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    116c <addUser+0x3c>
jmp    11c2 <addUser+0x92>
mov    -0x20(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rdx
add    $0x1,%rdx
mov    -0x20(%rbp),%rcx
add    $0x1,%rcx
lea    0xe72(%rip),%rsi
call   1030 <logData@plt>
lea    -0x420(%rbp),%rdi
mov    -0x20(%rbp),%rcx
add    $0x1,%rcx
mov    -0x18(%rbp),%r9
add    $0x1,%r9
mov    $0x3ff,%esi
lea    0xe68(%rip),%rdx
lea    0xe74(%rip),%r8
call   1050 <snprintf@plt>
add    $0x420,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<addUser>:
push   %r15
push   %r14
push   %rbx
sub    $0x400,%rsp
mov    %rdx,%r14
mov    %rdi,%r15
add    $0x1,%r14
mov    %r14,%rdi
mov    $0x3a,%esi
call   1040 <strchr@plt>
test   %rax,%rax
je     1198 <addUser+0x68>
mov    %rax,%rbx
movb   $0x0,(%rax)
add    $0x1,%rbx
lea    0xe97(%rip),%rsi
mov    %r15,%rdi
mov    %r14,%rdx
mov    %rbx,%rcx
call   1030 <logData@plt>
lea    0xea0(%rip),%rdx
lea    0xeac(%rip),%r8
mov    %rsp,%rdi
mov    $0x3ff,%esi
mov    %rbx,%rcx
mov    %r14,%r9
call   1050 <snprintf@plt>
add    $0x400,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [30 x i8] c"Adding user: %s with pass: %s\00"
@.str.1 = [19 x i8] c"echo %s > %s%s.txt\00"
@.str.2 = [9 x i8] c"./users/\00"
define void @addUser(i32* %0, i32 %1, i8* %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca [1024 x i8]
store i32* %0, i32** %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%9 = load i8*, i8** %6
%10 = getelementptr inbounds i8, i8* %9, i64 1
%11 = call i8* @strchr(i8* %10, i8 signext 58)
store i8* %11, i8** %7
%12 = load i8*, i8** %7
%13 = icmp ne i8* %12, null
br i1 %13, label %15, label %14
14: ; preds = %3
br label %29
15: ; preds = %3
%16 = load i8*, i8** %7
store i8 0, i8* %16
%17 = load i32*, i32** %4
%18 = load i8*, i8** %6
%19 = getelementptr inbounds i8, i8* %18, i64 1
%20 = load i8*, i8** %7
%21 = getelementptr inbounds i8, i8* %20, i64 1
%22 = call i32 @logData(i32* %17, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* %19, i8* %21)
%23 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%24 = load i8*, i8** %7
%25 = getelementptr inbounds i8, i8* %24, i64 1
%26 = load i8*, i8** %6
%27 = getelementptr inbounds i8, i8* %26, i64 1
%28 = call i32 @snprintf(i8* %23, i32 1023, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %25, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* %27)
br label %29
29: ; preds = %15, %14
ret void
}

LLVM IR (-O2):
@.str = [30 x i8] c"Adding user: %s with pass: %s\00"
@.str.1 = [19 x i8] c"echo %s > %s%s.txt\00"
@.str.2 = [9 x i8] c"./users/\00"
define void @addUser(i32* %0, i32 %1, i8* %2) {
%4 = alloca [1024 x i8]
%5 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%6 = getelementptr inbounds i8, i8* %2, i64 1
%7 = tail call i8* @strchr(i8* %6, i8 signext 58)
%8 = icmp eq i8* %7, null
br i1 %8, label %13, label %9
9: ; preds = %3
store i8 0, i8* %7
%10 = getelementptr inbounds i8, i8* %7, i64 1
%11 = tail call i32 @logData(i32* %0, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* %6, i8* %10)
%12 = call i32 @snprintf(i8* %5, i32 1023, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %10, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* %6)
br label %13
13: ; preds = %3, %9
ret void
}