#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 /*<<< orphan*/ printf(char *, ...);
scalar_t__ strcmp(char *, char *);
void testProccessArgs(int *ac, char ***av) {
  char **argv = *av;
  if (*ac < 2) {
    return;
  }
  if (strcmp(argv[1], "--with-threads") == 0) {
    printf("number of threads is %s\n", argv[2]);
    *av += 2;
    *ac -= 2;
  } else if (strcmp(argv[1], "--without-threads") == 0) {
    printf("no threads\n");
    *av += 1;
    *ac -= 1;
  }
}


x86 assembly (clang, -O0):
<testProccessArgs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
cmpl   $0x2,(%rax)
jge    114d <testProccessArgs+0x2d>
jmp    11e9 <testProccessArgs+0xc9>
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xea4(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    119f <testProccessArgs+0x7f>
mov    -0x18(%rbp),%rax
mov    0x10(%rax),%rsi
lea    0xe95(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
add    $0x10,%rcx
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%ecx
sub    $0x2,%ecx
mov    %ecx,(%rax)
jmp    11e9 <testProccessArgs+0xc9>
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe7a(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    11e4 <testProccessArgs+0xc4>
lea    0xe76(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
add    $0x8,%rcx
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%ecx
sub    $0x1,%ecx
mov    %ecx,(%rax)
jmp    11e9 <testProccessArgs+0xc9>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testProccessArgs>:
push   %r15
push   %r14
push   %rbx
cmpl   $0x2,(%rdi)
jl     11ab <testProccessArgs+0x7b>
mov    %rsi,%r14
mov    %rdi,%r15
mov    (%rsi),%rbx
mov    0x8(%rbx),%rdi
lea    0xeb2(%rip),%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
je     1185 <testProccessArgs+0x55>
mov    0x8(%rbx),%rdi
lea    0xec5(%rip),%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
jne    11ab <testProccessArgs+0x7b>
lea    0xec6(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%eax
mov    $0x1,%ecx
jmp    11a1 <testProccessArgs+0x71>
mov    0x10(%rbx),%rsi
lea    0xe7f(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xfffffffe,%eax
mov    $0x2,%ecx
shl    $0x3,%rcx
add    %rcx,(%r14)
add    %eax,(%r15)
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [15 x i8] c"--with-threads\00"
@.str.1 = [25 x i8] c"number of threads is %s\0A\00"
@.str.2 = [18 x i8] c"--without-threads\00"
@.str.3 = [12 x i8] c"no threads\0A\00"
define void @testProccessArgs(i32* %0, i8*** %1) {
%3 = alloca i32*
%4 = alloca i8***
%5 = alloca i8**
store i32* %0, i32** %3
store i8*** %1, i8**** %4
%6 = load i8***, i8**** %4
%7 = load i8**, i8*** %6
store i8** %7, i8*** %5
%8 = load i32*, i32** %3
%9 = load i32, i32* %8
%10 = icmp slt i32 %9, 2
br i1 %10, label %11, label %12
11: ; preds = %2
br label %44
12: ; preds = %2
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 1
%15 = load i8*, i8** %14
%16 = call i64 @strcmp(i8* %15, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %29
18: ; preds = %12
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 2
%21 = load i8*, i8** %20
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8* %21)
%23 = load i8***, i8**** %4
%24 = load i8**, i8*** %23
%25 = getelementptr inbounds i8*, i8** %24, i64 2
store i8** %25, i8*** %23
%26 = load i32*, i32** %3
%27 = load i32, i32* %26
%28 = sub nsw i32 %27, 2
store i32 %28, i32* %26
br label %44
29: ; preds = %12
%30 = load i8**, i8*** %5
%31 = getelementptr inbounds i8*, i8** %30, i64 1
%32 = load i8*, i8** %31
%33 = call i64 @strcmp(i8* %32, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
%34 = icmp eq i64 %33, 0
br i1 %34, label %35, label %43
35: ; preds = %29
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
%37 = load i8***, i8**** %4
%38 = load i8**, i8*** %37
%39 = getelementptr inbounds i8*, i8** %38, i64 1
store i8** %39, i8*** %37
%40 = load i32*, i32** %3
%41 = load i32, i32* %40
%42 = sub nsw i32 %41, 1
store i32 %42, i32* %40
br label %43
43: ; preds = %35, %29
br label %44
44: ; preds = %11, %43, %18
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"--with-threads\00"
@.str.1 = [25 x i8] c"number of threads is %s\0A\00"
@.str.2 = [18 x i8] c"--without-threads\00"
@str = [11 x i8] c"no threads\00"
define void @testProccessArgs(i32* nocapture %0, i8*** nocapture %1) {
%3 = load i8**, i8*** %1
%4 = load i32, i32* %0
%5 = icmp slt i32 %4, 2
br i1 %5, label %28, label %6
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %3, i64 1
%8 = load i8*, i8** %7
%9 = tail call i64 @strcmp(i8* %8, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %15
11: ; preds = %6
%12 = getelementptr inbounds i8*, i8** %3, i64 2
%13 = load i8*, i8** %12
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8* %13)
br label %21
15: ; preds = %6
%16 = load i8*, i8** %7
%17 = tail call i64 @strcmp(i8* %16, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %28
19: ; preds = %15
%20 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0))
br label %21
21: ; preds = %19, %11
%22 = phi i64 [ 2, %11 ], [ 1, %19 ]
%23 = phi i32 [ -2, %11 ], [ -1, %19 ]
%24 = load i8**, i8*** %1
%25 = getelementptr inbounds i8*, i8** %24, i64 %22
store i8** %25, i8*** %1
%26 = load i32, i32* %0
%27 = add nsw i32 %26, %23
store i32 %27, i32* %0
br label %28
28: ; preds = %21, %15, %2
ret void
}