#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 strlen(char const *);
scalar_t__ strncmp(char const *, char const *, int);
int is_param(const char *param, const char *buf) {
  int plen;
  plen = strlen(param);
  if (strncmp(buf, param, plen) != 0)
    return (0);
  buf += plen;
  if ((unsigned char)*buf > ' ')
    return (0);
  return (1);
}


x86 assembly (clang, -O0):
<is_param>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
je     1162 <is_param+0x42>
movl   $0x0,-0x4(%rbp)
jmp    1196 <is_param+0x76>
mov    -0x1c(%rbp),%ecx
mov    -0x18(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movzbl (%rax),%eax
cmp    $0x20,%eax
jle    118f <is_param+0x6f>
movl   $0x0,-0x4(%rbp)
jmp    1196 <is_param+0x76>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_param>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
call   1040 <strlen@plt>
mov    %eax,%ebp
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <strncmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
jne    1155 <is_param+0x35>
movslq %ebp,%rcx
xor    %eax,%eax
cmpb   $0x21,(%r14,%rcx,1)
setb   %al
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @is_param(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 @strlen(i8* %7)
store i32 %8, i32* %6
%9 = load i8*, i8** %5
%10 = load i8*, i8** %4
%11 = load i32, i32* %6
%12 = call i64 @strncmp(i8* %9, i8* %10, i32 %11)
%13 = icmp ne i64 %12, 0
br i1 %13, label %14, label %15
14: ; preds = %2
store i32 0, i32* %3
br label %26
15: ; preds = %2
%16 = load i32, i32* %6
%17 = load i8*, i8** %5
%18 = sext i32 %16 to i64
%19 = getelementptr inbounds i8, i8* %17, i64 %18
store i8* %19, i8** %5
%20 = load i8*, i8** %5
%21 = load i8, i8* %20
%22 = zext i8 %21 to i32
%23 = icmp sgt i32 %22, 32
br i1 %23, label %24, label %25
24: ; preds = %15
store i32 0, i32* %3
br label %26
25: ; preds = %15
store i32 1, i32* %3
br label %26
26: ; preds = %25, %24, %14
%27 = load i32, i32* %3
ret i32 %27
}

LLVM IR (-O2):
define i32 @is_param(i8* %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %0)
%4 = tail call i64 @strncmp(i8* %1, i8* %0, i32 %3)
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %12
6: ; preds = %2
%7 = sext i32 %3 to i64
%8 = getelementptr inbounds i8, i8* %1, i64 %7
%9 = load i8, i8* %8
%10 = icmp ult i8 %9, 33
%11 = zext i1 %10 to i32
br label %12
12: ; preds = %6, %2
%13 = phi i32 [ 0, %2 ], [ %11, %6 ]
ret i32 %13
}