#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*/ free(char *);
char *malloc(int);
scalar_t__ starts_with(char const *, char *);
int /*<<< orphan*/ strcpy(char *, char const *);
int strlen(char const *);
int parameter_name_is_under(const char *name, const char *tmp_name) {
  size_t name_len = strlen(name);
  size_t tmp_len = strlen(tmp_name) + 1;
  if (name_len <= tmp_len) {
    return 0;
  }
  int ret = 0;
  char *tmp_name_dot = malloc(sizeof(char) * (tmp_len + 1));
  strcpy(tmp_name_dot, tmp_name);
  tmp_name_dot[tmp_len - 1] = '.';
  tmp_name_dot[tmp_len] = '\0';
  if (starts_with(name, tmp_name_dot)) {
    ret = 1;
  }
  free(tmp_name_dot);
  return ret;
}


x86 assembly (clang, -O0):
<parameter_name_is_under>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <strlen@plt>
cltq
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <strlen@plt>
add    $0x1,%eax
cltq
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x28(%rbp),%rax
ja     119b <parameter_name_is_under+0x4b>
movl   $0x0,-0x4(%rbp)
jmp    120f <parameter_name_is_under+0xbf>
movl   $0x0,-0x2c(%rbp)
mov    -0x28(%rbp),%rax
add    $0x1,%rax
shl    $0x0,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <strcpy@plt>
mov    -0x38(%rbp),%rax
mov    -0x28(%rbp),%rcx
sub    $0x1,%rcx
movb   $0x2e,(%rax,%rcx,1)
mov    -0x38(%rbp),%rax
mov    -0x28(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x10(%rbp),%rdi
mov    -0x38(%rbp),%rsi
call   1070 <starts_with@plt>
cmp    $0x0,%rax
je     1200 <parameter_name_is_under+0xb0>
movl   $0x1,-0x2c(%rbp)
mov    -0x38(%rbp),%rdi
call   1030 <free@plt>
mov    -0x2c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parameter_name_is_under>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rsi,%r15
mov    %rdi,%r14
call   1050 <strlen@plt>
mov    %eax,%r12d
mov    %r15,%rdi
call   1050 <strlen@plt>
movslq %eax,%rbx
add    $0x1,%rbx
xor    %ebp,%ebp
cmp    %ebx,%r12d
jbe    11b8 <parameter_name_is_under+0x68>
add    $0x2,%eax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,%r12
mov    %rax,%rdi
mov    %r15,%rsi
call   1040 <strcpy@plt>
movw   $0x2e,-0x1(%rbx,%r12,1)
mov    %r14,%rdi
mov    %r12,%rsi
call   1070 <starts_with@plt>
xor    %ebp,%ebp
test   %rax,%rax
setne  %bpl
mov    %r12,%rdi
call   1030 <free@plt>
mov    %ebp,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @parameter_name_is_under(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i64
%8 = alloca i32
%9 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
%10 = load i8*, i8** %4
%11 = call i32 @strlen(i8* %10)
%12 = sext i32 %11 to i64
store i64 %12, i64* %6
%13 = load i8*, i8** %5
%14 = call i32 @strlen(i8* %13)
%15 = add nsw i32 %14, 1
%16 = sext i32 %15 to i64
store i64 %16, i64* %7
%17 = load i64, i64* %6
%18 = load i64, i64* %7
%19 = icmp ule i64 %17, %18
br i1 %19, label %20, label %21
20: ; preds = %2
store i32 0, i32* %3
br label %46
21: ; preds = %2
store i32 0, i32* %8
%22 = load i64, i64* %7
%23 = add i64 %22, 1
%24 = mul i64 1, %23
%25 = trunc i64 %24 to i32
%26 = call i8* @malloc(i32 %25)
store i8* %26, i8** %9
%27 = load i8*, i8** %9
%28 = load i8*, i8** %5
%29 = call i32 @strcpy(i8* %27, i8* %28)
%30 = load i8*, i8** %9
%31 = load i64, i64* %7
%32 = sub i64 %31, 1
%33 = getelementptr inbounds i8, i8* %30, i64 %32
store i8 46, i8* %33
%34 = load i8*, i8** %9
%35 = load i64, i64* %7
%36 = getelementptr inbounds i8, i8* %34, i64 %35
store i8 0, i8* %36
%37 = load i8*, i8** %4
%38 = load i8*, i8** %9
%39 = call i64 @starts_with(i8* %37, i8* %38)
%40 = icmp ne i64 %39, 0
br i1 %40, label %41, label %42
41: ; preds = %21
store i32 1, i32* %8
br label %42
42: ; preds = %41, %21
%43 = load i8*, i8** %9
%44 = call i32 @free(i8* %43)
%45 = load i32, i32* %8
store i32 %45, i32* %3
br label %46
46: ; preds = %42, %20
%47 = load i32, i32* %3
ret i32 %47
}

LLVM IR (-O2):
define i32 @parameter_name_is_under(i8* %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %0)
%4 = tail call i32 @strlen(i8* %1)
%5 = add nsw i32 %4, 1
%6 = sext i32 %5 to i64
%7 = icmp ugt i32 %3, %5
br i1 %7, label %8, label %19
8: ; preds = %2
%9 = add i32 %4, 2
%10 = tail call i8* @malloc(i32 %9)
%11 = tail call i32 @strcpy(i8* %10, i8* %1)
%12 = add nsw i64 %6, -1
%13 = getelementptr inbounds i8, i8* %10, i64 %12
store i8 46, i8* %13
%14 = getelementptr inbounds i8, i8* %10, i64 %6
store i8 0, i8* %14
%15 = tail call i64 @starts_with(i8* %0, i8* %10)
%16 = icmp ne i64 %15, 0
%17 = zext i1 %16 to i32
%18 = tail call i32 @free(i8* %10)
br label %19
19: ; preds = %2, %8
%20 = phi i32 [ %17, %8 ], [ 0, %2 ]
ret i32 %20
}