#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 getNumArg(char const *);
int atcmdFake(const char *s, const char *vals) {
  int i;
  i = getNumArg(s) + '0';
  for (; *vals != '\0'; vals++)
    if (i == *vals)
      return 0;
  return 1;
}


x86 assembly (clang, -O0):
<atcmdFake>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <getNumArg@plt>
add    $0x30,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1173 <atcmdFake+0x63>
mov    -0x1c(%rbp),%eax
mov    -0x18(%rbp),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
jne    115d <atcmdFake+0x4d>
movl   $0x0,-0x4(%rbp)
jmp    117a <atcmdFake+0x6a>
jmp    1162 <atcmdFake+0x52>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    112f <atcmdFake+0x1f>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<atcmdFake>:
push   %rbx
mov    %rsi,%rbx
call   1030 <getNumArg@plt>
mov    %eax,%ecx
mov    (%rbx),%dl
mov    $0x1,%eax
test   %dl,%dl
je     1142 <atcmdFake+0x32>
add    $0x30,%ecx
add    $0x1,%rbx
nopl   (%rax)
movsbl %dl,%edx
cmp    %edx,%ecx
je     1144 <atcmdFake+0x34>
movzbl (%rbx),%edx
add    $0x1,%rbx
test   %dl,%dl
jne    1130 <atcmdFake+0x20>
pop    %rbx
ret
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @atcmdFake(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
%7 = load i8*, i8** %4
%8 = call i32 @getNumArg(i8* %7)
%9 = add nsw i32 %8, 48
store i32 %9, i32* %6
br label %10
10: ; preds = %23, %2
%11 = load i8*, i8** %5
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %26
15: ; preds = %10
%16 = load i32, i32* %6
%17 = load i8*, i8** %5
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = icmp eq i32 %16, %19
br i1 %20, label %21, label %22
21: ; preds = %15
store i32 0, i32* %3
br label %27
22: ; preds = %15
br label %23
23: ; preds = %22
%24 = load i8*, i8** %5
%25 = getelementptr inbounds i8, i8* %24, i32 1
store i8* %25, i8** %5
br label %10
26: ; preds = %10
store i32 1, i32* %3
br label %27
27: ; preds = %26, %21
%28 = load i32, i32* %3
ret i32 %28
}

LLVM IR (-O2):
define i32 @atcmdFake(i8* %0, i8* nocapture %1) {
%3 = tail call i32 @getNumArg(i8* %0)
%4 = add nsw i32 %3, 48
%5 = load i8, i8* %1
%6 = icmp eq i8 %5, 0
br i1 %6, label %16, label %10
7: ; preds = %10
%8 = load i8, i8* %15
%9 = icmp eq i8 %8, 0
br i1 %9, label %16, label %10
10: ; preds = %2, %7
%11 = phi i8 [ %8, %7 ], [ %5, %2 ]
%12 = phi i8* [ %15, %7 ], [ %1, %2 ]
%13 = sext i8 %11 to i32
%14 = icmp eq i32 %4, %13
%15 = getelementptr inbounds i8, i8* %12, i64 1
br i1 %14, label %16, label %7
16: ; preds = %10, %7, %2
%17 = phi i32 [ 1, %2 ], [ 1, %7 ], [ 0, %10 ]
ret i32 %17
}