#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*/ strcpy(char *, char *);
int strlen(char *);
bool canConstruct(char *ransomNote, char *magazine) {
  int len = strlen(magazine);
  char maga[len + 1];
  strcpy(maga, magazine);
  char *mPos;
  int found;
  for (char *rPos = ransomNote; *rPos != '\0'; rPos++) {
    found = false;
    for (mPos = maga; *mPos != '\0'; mPos++) {
      if (*mPos == *rPos) {
        *mPos = ' ';
        found = true;
        break;
      }
    }
    if (!found) {
      return false;
    }
  }
  return true;
}


x86 assembly (clang, -O0):
<canConstruct>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %rsp,%rcx
mov    %rcx,-0x28(%rbp)
mov    %rax,%rcx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdi
sub    %rcx,%rdi
mov    %rdi,-0x58(%rbp)
mov    %rdi,%rsp
mov    %rax,-0x30(%rbp)
mov    -0x18(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1217 <canConstruct+0xf7>
mov    -0x58(%rbp),%rax
movl   $0x0,-0x3c(%rbp)
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     11e4 <canConstruct+0xc4>
mov    -0x38(%rbp),%rax
movsbl (%rax),%eax
mov    -0x48(%rbp),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
jne    11ce <canConstruct+0xae>
mov    -0x38(%rbp),%rax
movb   $0x20,(%rax)
movl   $0x1,-0x3c(%rbp)
jmp    11e4 <canConstruct+0xc4>
jmp    11d3 <canConstruct+0xb3>
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
jmp    1195 <canConstruct+0x75>
cmpl   $0x0,-0x3c(%rbp)
jne    1201 <canConstruct+0xe1>
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x4c(%rbp)
jmp    1225 <canConstruct+0x105>
jmp    1206 <canConstruct+0xe6>
mov    -0x48(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x48(%rbp)
jmp    1176 <canConstruct+0x56>
movl   $0x1,-0x4(%rbp)
movl   $0x1,-0x4c(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<canConstruct>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r15
mov    %rdi,%r14
mov    %rsi,%rdi
call   1040 <strlen@plt>
add    $0x1,%eax
mov    %rsp,%rbx
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
mov    %rbx,%rdi
mov    %r15,%rsi
call   1030 <strcpy@plt>
mov    (%r14),%cl
mov    $0x1,%eax
test   %cl,%cl
je     11a4 <canConstruct+0x84>
lea    0x1(%rbx),%rdi
mov    (%rbx),%dl
test   %dl,%dl
je     11a2 <canConstruct+0x82>
mov    %rdi,%rsi
cmp    %cl,%dl
je     1190 <canConstruct+0x70>
movzbl (%rsi),%edx
add    $0x1,%rsi
test   %dl,%dl
jne    1170 <canConstruct+0x50>
jmp    11a2 <canConstruct+0x82>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movb   $0x20,-0x1(%rsi)
mov    0x1(%r14),%cl
add    $0x1,%r14
test   %cl,%cl
jne    1167 <canConstruct+0x47>
jmp    11a4 <canConstruct+0x84>
xor    %eax,%eax
lea    -0x18(%rbp),%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @canConstruct(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i64
%9 = alloca i8*
%10 = alloca i32
%11 = alloca i8*
%12 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
%13 = load i8*, i8** %5
%14 = call i32 @strlen(i8* %13)
store i32 %14, i32* %6
%15 = load i32, i32* %6
%16 = add nsw i32 %15, 1
%17 = zext i32 %16 to i64
%18 = call i8* @llvm.stacksave()
store i8* %18, i8** %7
%19 = alloca i8, i64 %17
store i64 %17, i64* %8
%20 = load i8*, i8** %5
%21 = call i32 @strcpy(i8* %19, i8* %20)
%22 = load i8*, i8** %4
store i8* %22, i8** %11
br label %23
23: ; preds = %53, %2
%24 = load i8*, i8** %11
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
%27 = icmp ne i32 %26, 0
br i1 %27, label %28, label %56
28: ; preds = %23
store i32 0, i32* %10
store i8* %19, i8** %9
br label %29
29: ; preds = %45, %28
%30 = load i8*, i8** %9
%31 = load i8, i8* %30
%32 = sext i8 %31 to i32
%33 = icmp ne i32 %32, 0
br i1 %33, label %34, label %48
34: ; preds = %29
%35 = load i8*, i8** %9
%36 = load i8, i8* %35
%37 = sext i8 %36 to i32
%38 = load i8*, i8** %11
%39 = load i8, i8* %38
%40 = sext i8 %39 to i32
%41 = icmp eq i32 %37, %40
br i1 %41, label %42, label %44
42: ; preds = %34
%43 = load i8*, i8** %9
store i8 32, i8* %43
store i32 1, i32* %10
br label %48
44: ; preds = %34
br label %45
45: ; preds = %44
%46 = load i8*, i8** %9
%47 = getelementptr inbounds i8, i8* %46, i32 1
store i8* %47, i8** %9
br label %29
48: ; preds = %42, %29
%49 = load i32, i32* %10
%50 = icmp ne i32 %49, 0
br i1 %50, label %52, label %51
51: ; preds = %48
store i32 0, i32* %3
store i32 1, i32* %12
br label %57
52: ; preds = %48
br label %53
53: ; preds = %52
%54 = load i8*, i8** %11
%55 = getelementptr inbounds i8, i8* %54, i32 1
store i8* %55, i8** %11
br label %23
56: ; preds = %23
store i32 1, i32* %3
store i32 1, i32* %12
br label %57
57: ; preds = %56, %51
%58 = load i8*, i8** %7
%59 = load i32, i32* %3
ret i32 %59
}

LLVM IR (-O2):
define i32 @canConstruct(i8* nocapture %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %1)
%4 = add nsw i32 %3, 1
%5 = zext i32 %4 to i64
%6 = alloca i8, i64 %5
%7 = call i32 @strcpy(i8* %6, i8* %1)
%8 = load i8, i8* %0
%9 = icmp eq i8 %8, 0
br i1 %9, label %27, label %10
10: ; preds = %2, %23
%11 = phi i8 [ %25, %23 ], [ %8, %2 ]
%12 = phi i8* [ %24, %23 ], [ %0, %2 ]
%13 = load i8, i8* %6
%14 = icmp eq i8 %13, 0
br i1 %14, label %27, label %15
15: ; preds = %10, %19
%16 = phi i8 [ %21, %19 ], [ %13, %10 ]
%17 = phi i8* [ %20, %19 ], [ %6, %10 ]
%18 = icmp eq i8 %16, %11
br i1 %18, label %23, label %19
19: ; preds = %15
%20 = getelementptr inbounds i8, i8* %17, i64 1
%21 = load i8, i8* %20
%22 = icmp eq i8 %21, 0
br i1 %22, label %27, label %15
23: ; preds = %15
store i8 32, i8* %17
%24 = getelementptr inbounds i8, i8* %12, i64 1
%25 = load i8, i8* %24
%26 = icmp eq i8 %25, 0
br i1 %26, label %27, label %10
27: ; preds = %23, %10, %19, %2
%28 = phi i32 [ 1, %2 ], [ 0, %19 ], [ 0, %10 ], [ 1, %23 ]
ret i32 %28
}