#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 */
struct proxy_user {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ add_userperm(char *, char *, struct proxy_user **);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ strncat(char *, char *, int);
void *processperm(char *s, struct proxy_user **pu) {
  char name[80], value[80];
  int nvstate = 0;
  memset(name, 0, sizeof name);
  memset(value, 0, sizeof value);
  do {
    if (*s == ' ' || *s == '\t')
      continue;
    if (*s == ';' || *s == '#' || *s == '\r' || *s == '\n')
      break;
    if (*s == '=') {
      nvstate = 1;
      continue;
    }
    if (!nvstate)
      strncat(name, s, 1);
    else
      strncat(value, s, 1);
  } while (*(s++));
  add_userperm(name, value, pu);
  return 0;
}


x86 assembly (clang, -O0):
<processperm>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0xb4(%rbp)
lea    -0x60(%rbp),%rdi
xor    %esi,%esi
mov    $0x50,%edx
call   1040 <memset@plt>
lea    -0xb0(%rbp),%rdi
xor    %esi,%esi
mov    $0x50,%edx
call   1040 <memset@plt>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
je     1190 <processperm+0x60>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x9,%eax
jne    1195 <processperm+0x65>
jmp    1237 <processperm+0x107>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3b,%eax
je     11d5 <processperm+0xa5>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x23,%eax
je     11d5 <processperm+0xa5>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xd,%eax
je     11d5 <processperm+0xa5>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xa,%eax
jne    11da <processperm+0xaa>
jmp    124f <processperm+0x11f>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3d,%eax
jne    11f9 <processperm+0xc9>
movl   $0x1,-0xb4(%rbp)
jmp    1237 <processperm+0x107>
cmpl   $0x0,-0xb4(%rbp)
jne    121d <processperm+0xed>
lea    -0x60(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    $0x1,%edx
call   1050 <strncat@plt>
jmp    1232 <processperm+0x102>
lea    -0xb0(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    $0x1,%edx
call   1050 <strncat@plt>
jmp    1237 <processperm+0x107>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
cmpb   $0x0,(%rax)
jne    1170 <processperm+0x40>
lea    -0x60(%rbp),%rdi
lea    -0xb0(%rbp),%rsi
mov    -0x10(%rbp),%rdx
call   1030 <add_userperm@plt>
xor    %eax,%eax
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<processperm>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xb8,%rsp
mov    %rsi,0x8(%rsp)
mov    %rdi,%rbx
lea    0x60(%rsp),%r15
xor    %r14d,%r14d
mov    %r15,%rdi
xor    %esi,%esi
mov    $0x50,%edx
call   1040 <memset@plt>
lea    0x10(%rsp),%r12
mov    %r12,%rdi
xor    %esi,%esi
mov    $0x50,%edx
call   1040 <memset@plt>
movabs $0x100000200,%r13
jmp    11bb <processperm+0x8b>
movabs $0x800000800002400,%rcx
bt     %rax,%rcx
jb     11da <processperm+0xaa>
xor    %ebp,%ebp
test   %r14d,%r14d
setne  %bpl
mov    %r12,%rdi
cmove  %r15,%rdi
mov    %rbx,%rsi
mov    $0x1,%edx
call   1050 <strncat@plt>
movzbl (%rbx),%eax
mov    %ebp,%r14d
add    $0x1,%rbx
test   %al,%al
je     11da <processperm+0xaa>
movzbl (%rbx),%eax
cmp    $0x3d,%rax
ja     1190 <processperm+0x60>
bt     %rax,%r13
jb     11b3 <processperm+0x83>
cmp    $0x3d,%rax
jne    1180 <processperm+0x50>
mov    $0x1,%r14d
mov    $0x3d,%al
jmp    11b3 <processperm+0x83>
lea    0x60(%rsp),%rdi
lea    0x10(%rsp),%rsi
mov    0x8(%rsp),%rdx
call   1030 <add_userperm@plt>
xor    %eax,%eax
add    $0xb8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.proxy_user = type { i32 }
define i8* @processperm(i8* %0, %struct.proxy_user** %1) {
%3 = alloca i8*
%4 = alloca %struct.proxy_user**
%5 = alloca [80 x i8]
%6 = alloca [80 x i8]
%7 = alloca i32
store i8* %0, i8** %3
store %struct.proxy_user** %1, %struct.proxy_user*** %4
store i32 0, i32* %7
%8 = getelementptr inbounds [80 x i8], [80 x i8]* %5, i64 0, i64 0
%9 = call i32 @memset(i8* %8, i32 0, i32 80)
%10 = getelementptr inbounds [80 x i8], [80 x i8]* %6, i64 0, i64 0
%11 = call i32 @memset(i8* %10, i32 0, i32 80)
br label %12
12: ; preds = %62, %2
%13 = load i8*, i8** %3
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = icmp eq i32 %15, 32
br i1 %16, label %22, label %17
17: ; preds = %12
%18 = load i8*, i8** %3
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = icmp eq i32 %20, 9
br i1 %21, label %22, label %23
22: ; preds = %17, %12
br label %62
23: ; preds = %17
%24 = load i8*, i8** %3
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
%27 = icmp eq i32 %26, 59
br i1 %27, label %43, label %28
28: ; preds = %23
%29 = load i8*, i8** %3
%30 = load i8, i8* %29
%31 = sext i8 %30 to i32
%32 = icmp eq i32 %31, 35
br i1 %32, label %43, label %33
33: ; preds = %28
%34 = load i8*, i8** %3
%35 = load i8, i8* %34
%36 = sext i8 %35 to i32
%37 = icmp eq i32 %36, 13
br i1 %37, label %43, label %38
38: ; preds = %33
%39 = load i8*, i8** %3
%40 = load i8, i8* %39
%41 = sext i8 %40 to i32
%42 = icmp eq i32 %41, 10
br i1 %42, label %43, label %44
43: ; preds = %38, %33, %28, %23
br label %67
44: ; preds = %38
%45 = load i8*, i8** %3
%46 = load i8, i8* %45
%47 = sext i8 %46 to i32
%48 = icmp eq i32 %47, 61
br i1 %48, label %49, label %50
49: ; preds = %44
store i32 1, i32* %7
br label %62
50: ; preds = %44
%51 = load i32, i32* %7
%52 = icmp ne i32 %51, 0
br i1 %52, label %57, label %53
53: ; preds = %50
%54 = getelementptr inbounds [80 x i8], [80 x i8]* %5, i64 0, i64 0
%55 = load i8*, i8** %3
%56 = call i32 @strncat(i8* %54, i8* %55, i32 1)
br label %61
57: ; preds = %50
%58 = getelementptr inbounds [80 x i8], [80 x i8]* %6, i64 0, i64 0
%59 = load i8*, i8** %3
%60 = call i32 @strncat(i8* %58, i8* %59, i32 1)
br label %61
61: ; preds = %57, %53
br label %62
62: ; preds = %61, %49, %22
%63 = load i8*, i8** %3
%64 = getelementptr inbounds i8, i8* %63, i32 1
store i8* %64, i8** %3
%65 = load i8, i8* %63
%66 = icmp ne i8 %65, 0
br i1 %66, label %12, label %67
67: ; preds = %62, %43
%68 = getelementptr inbounds [80 x i8], [80 x i8]* %5, i64 0, i64 0
%69 = getelementptr inbounds [80 x i8], [80 x i8]* %6, i64 0, i64 0
%70 = load %struct.proxy_user**, %struct.proxy_user*** %4
%71 = call i32 @add_userperm(i8* %68, i8* %69, %struct.proxy_user** %70)
ret i8* null
}

LLVM IR (-O2):
%struct.proxy_user = type { i32 }
define noalias i8* @processperm(i8* %0, %struct.proxy_user** %1) {
%3 = alloca [80 x i8]
%4 = alloca [80 x i8]
%5 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 0
%7 = call i32 @memset(i8* %5, i32 0, i32 80)
%8 = call i32 @memset(i8* %6, i32 0, i32 80)
br label %9
9: ; preds = %21, %2
%10 = phi i8* [ %0, %2 ], [ %24, %21 ]
%11 = phi i32 [ 0, %2 ], [ %23, %21 ]
%12 = load i8, i8* %10
switch i8 %12, label %14 [
i8 32, label %21
i8 9, label %21
i8 59, label %26
i8 35, label %26
i8 13, label %26
i8 10, label %26
i8 61, label %13
]
13: ; preds = %9
br label %21
14: ; preds = %9
%15 = icmp eq i32 %11, 0
%16 = select i1 %15, i8* %5, i8* %6
%17 = xor i1 %15, true
%18 = zext i1 %17 to i32
%19 = call i32 @strncat(i8* %16, i8* %10, i32 1)
%20 = load i8, i8* %10
br label %21
21: ; preds = %14, %9, %9, %13
%22 = phi i8 [ %20, %14 ], [ %12, %9 ], [ %12, %9 ], [ 61, %13 ]
%23 = phi i32 [ %18, %14 ], [ %11, %9 ], [ %11, %9 ], [ 1, %13 ]
%24 = getelementptr inbounds i8, i8* %10, i64 1
%25 = icmp eq i8 %22, 0
br i1 %25, label %26, label %9
26: ; preds = %9, %9, %9, %9, %21
%27 = call i32 @add_userperm(i8* %5, i8* %6, %struct.proxy_user** %1)
ret i8* null
}