#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 PORT_Atoi(char *);
scalar_t__ PORT_Strlen(char *);
char *strpbrk(char *, char *);
void getCertsToDelete(char *numlist, int len, int *certNums, int nCerts) {
  int j, num;
  char *numstr, *numend, *end;
  numstr = numlist;
  end = numstr + len - 1;
  while (numstr != end) {
    numend = strpbrk(numstr, ", \n");
    *numend = '\0';
    if (PORT_Strlen(numstr) == 0)
      return;
    num = PORT_Atoi(numstr);
    if (numstr == numlist)
      certNums[0] = num;
    for (j = 1; j < nCerts + 1; j++) {
      if (num == certNums[j]) {
        certNums[j] = -1;
        break;
      }
    }
    if (numend == end)
      break;
    numstr = strpbrk(numend + 1, "0123456789");
  }
}


x86 assembly (clang, -O0):
<getCertsToDelete>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
movslq -0xc(%rbp),%rcx
add    %rcx,%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x40(%rbp)
mov    -0x30(%rbp),%rax
cmp    -0x40(%rbp),%rax
je     1248 <getCertsToDelete+0x118>
mov    -0x30(%rbp),%rdi
lea    0xe86(%rip),%rsi
call   1040 <strpbrk@plt>
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x30(%rbp),%rdi
call   1030 <PORT_Strlen@plt>
cmp    $0x0,%rax
jne    11a2 <getCertsToDelete+0x72>
jmp    1248 <getCertsToDelete+0x118>
mov    -0x30(%rbp),%rdi
call   1050 <PORT_Atoi@plt>
mov    %eax,-0x24(%rbp)
mov    -0x30(%rbp),%rax
cmp    -0x8(%rbp),%rax
jne    11c5 <getCertsToDelete+0x95>
mov    -0x24(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
movl   $0x1,-0x20(%rbp)
mov    -0x20(%rbp),%eax
mov    -0x1c(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jge    1218 <getCertsToDelete+0xe8>
mov    -0x24(%rbp),%eax
mov    -0x18(%rbp),%rcx
movslq -0x20(%rbp),%rdx
cmp    (%rcx,%rdx,4),%eax
jne    1205 <getCertsToDelete+0xd5>
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
movl   $0xffffffff,(%rax,%rcx,4)
jmp    1218 <getCertsToDelete+0xe8>
jmp    120a <getCertsToDelete+0xda>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    11cc <getCertsToDelete+0x9c>
mov    -0x38(%rbp),%rax
cmp    -0x40(%rbp),%rax
jne    122b <getCertsToDelete+0xfb>
jmp    1248 <getCertsToDelete+0x118>
mov    -0x38(%rbp),%rdi
add    $0x1,%rdi
lea    0xdca(%rip),%rsi
call   1040 <strpbrk@plt>
mov    %rax,-0x30(%rbp)
jmp    1161 <getCertsToDelete+0x31>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getCertsToDelete>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rcx,(%rsp)
movslq %esi,%rax
lea    (%rdi,%rax,1),%r12
add    $0xffffffffffffffff,%r12
cmp    %rdi,%r12
je     11fb <getCertsToDelete+0xcb>
mov    %rdx,%rbx
mov    %rdi,%r13
mov    (%rsp),%rax
lea    0x1(%rax),%r14d
mov    %rdi,%r15
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r15,%rdi
lea    0xe86(%rip),%rsi
call   1040 <strpbrk@plt>
mov    %rax,%rbp
movb   $0x0,(%rax)
mov    %r15,%rdi
call   1030 <PORT_Strlen@plt>
test   %rax,%rax
je     11fb <getCertsToDelete+0xcb>
mov    %r15,%rdi
call   1050 <PORT_Atoi@plt>
cmp    %r13,%r15
je     11b0 <getCertsToDelete+0x80>
cmpl   $0x0,(%rsp)
jg     11b8 <getCertsToDelete+0x88>
jmp    11d7 <getCertsToDelete+0xa7>
nopw   0x0(%rax,%rax,1)
mov    %eax,(%rbx)
cmpl   $0x0,(%rsp)
jle    11d7 <getCertsToDelete+0xa7>
mov    $0x1,%ecx
nopl   (%rax)
cmp    (%rbx,%rcx,4),%eax
je     11d0 <getCertsToDelete+0xa0>
add    $0x1,%rcx
cmp    %rcx,%r14
jne    11c0 <getCertsToDelete+0x90>
jmp    11d7 <getCertsToDelete+0xa7>
movl   $0xffffffff,(%rbx,%rcx,4)
cmp    %r12,%rbp
je     11fb <getCertsToDelete+0xcb>
add    $0x1,%rbp
mov    %rbp,%rdi
lea    0xe1a(%rip),%rsi
call   1040 <strpbrk@plt>
mov    %rax,%r15
cmp    %r12,%rax
jne    1170 <getCertsToDelete+0x40>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c", \0A\00"
@.str.1 = [11 x i8] c"0123456789\00"
define void @getCertsToDelete(i8* %0, i32 %1, i32* nocapture %2, i32 %3) {
%5 = sext i32 %1 to i64
%6 = getelementptr inbounds i8, i8* %0, i64 %5
%7 = getelementptr inbounds i8, i8* %6, i64 -1
%8 = icmp eq i8* %7, %0
br i1 %8, label %40, label %9
9: ; preds = %4
%10 = icmp slt i32 %3, 1
%11 = add i32 %3, 1
%12 = zext i32 %11 to i64
br label %13
13: ; preds = %9, %36
%14 = phi i8* [ %0, %9 ], [ %38, %36 ]
%15 = tail call i8* @strpbrk(i8* %14, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
store i8 0, i8* %15
%16 = tail call i64 @PORT_Strlen(i8* %14)
%17 = icmp eq i64 %16, 0
br i1 %17, label %40, label %18
18: ; preds = %13
%19 = tail call i32 @PORT_Atoi(i8* %14)
%20 = icmp eq i8* %14, %0
br i1 %20, label %21, label %22
21: ; preds = %18
store i32 %19, i32* %2
br label %22
22: ; preds = %21, %18
br i1 %10, label %34, label %23
23: ; preds = %22, %31
%24 = phi i64 [ %32, %31 ], [ 1, %22 ]
%25 = getelementptr inbounds i32, i32* %2, i64 %24
%26 = load i32, i32* %25
%27 = icmp eq i32 %19, %26
br i1 %27, label %28, label %31
28: ; preds = %23
%29 = and i64 %24, 4294967295
%30 = getelementptr inbounds i32, i32* %2, i64 %29
store i32 -1, i32* %30
br label %34
31: ; preds = %23
%32 = add nuw nsw i64 %24, 1
%33 = icmp eq i64 %32, %12
br i1 %33, label %34, label %23
34: ; preds = %31, %22, %28
%35 = icmp eq i8* %15, %7
br i1 %35, label %40, label %36
36: ; preds = %34
%37 = getelementptr inbounds i8, i8* %15, i64 1
%38 = tail call i8* @strpbrk(i8* %37, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%39 = icmp eq i8* %38, %7
br i1 %39, label %40, label %13
40: ; preds = %13, %34, %36, %4
ret void
}