#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 */
scalar_t__ malloc(int);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ *strchr(char *, char);
int strlen(char *);
char *_str_diff(char *str1, char *str2) {
  int m = strlen(str1);
  int n = strlen(str2);
  int i;
  char *diff = (char *)malloc(sizeof(char));
  for (i = 0; i < m; i++) {
    if (strchr(str2, str1[i]) == NULL) {
      strcat(diff, str1 + i);
    }
  }
  return diff;
}


x86 assembly (clang, -O0):
<_str_diff>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x18(%rbp)
mov    $0x1,%edi
call   1050 <malloc@plt>
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11cf <_str_diff+0x8f>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsbl (%rax,%rcx,1),%esi
call   1040 <strchr@plt>
cmp    $0x0,%rax
jne    11bc <_str_diff+0x7c>
mov    -0x28(%rbp),%rdi
mov    -0x8(%rbp),%rsi
movslq -0x1c(%rbp),%rax
add    %rax,%rsi
call   1060 <strcat@plt>
jmp    11c1 <_str_diff+0x81>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    117d <_str_diff+0x3d>
mov    -0x28(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_str_diff>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1030 <strlen@plt>
mov    %eax,%ebp
mov    %r14,%rdi
call   1030 <strlen@plt>
mov    $0x1,%edi
call   1050 <malloc@plt>
mov    %rax,%r15
test   %ebp,%ebp
jle    11a7 <_str_diff+0x67>
mov    %ebp,%ebp
jmp    118a <_str_diff+0x4a>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x1,%rbx
add    $0xffffffffffffffff,%rbp
je     11a7 <_str_diff+0x67>
movsbl (%rbx),%esi
mov    %r14,%rdi
call   1040 <strchr@plt>
test   %rax,%rax
jne    1180 <_str_diff+0x40>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1060 <strcat@plt>
jmp    1180 <_str_diff+0x40>
mov    %r15,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i8* @_str_diff(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%9 = load i8*, i8** %3
%10 = call i32 @strlen(i8* %9)
store i32 %10, i32* %5
%11 = load i8*, i8** %4
%12 = call i32 @strlen(i8* %11)
store i32 %12, i32* %6
%13 = call i64 @malloc(i32 1)
%14 = inttoptr i64 %13 to i8*
store i8* %14, i8** %8
store i32 0, i32* %7
br label %15
15: ; preds = %36, %2
%16 = load i32, i32* %7
%17 = load i32, i32* %5
%18 = icmp slt i32 %16, %17
br i1 %18, label %19, label %39
19: ; preds = %15
%20 = load i8*, i8** %4
%21 = load i8*, i8** %3
%22 = load i32, i32* %7
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i8, i8* %21, i64 %23
%25 = load i8, i8* %24
%26 = call i32* @strchr(i8* %20, i8 signext %25)
%27 = icmp eq i32* %26, null
br i1 %27, label %28, label %35
28: ; preds = %19
%29 = load i8*, i8** %8
%30 = load i8*, i8** %3
%31 = load i32, i32* %7
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i8, i8* %30, i64 %32
%34 = call i32 @strcat(i8* %29, i8* %33)
br label %35
35: ; preds = %28, %19
br label %36
36: ; preds = %35
%37 = load i32, i32* %7
%38 = add nsw i32 %37, 1
store i32 %38, i32* %7
br label %15
39: ; preds = %15
%40 = load i8*, i8** %8
ret i8* %40
}

LLVM IR (-O2):
define i8* @_str_diff(i8* %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %0)
%4 = tail call i32 @strlen(i8* %1)
%5 = tail call i64 @malloc(i32 1)
%6 = inttoptr i64 %5 to i8*
%7 = icmp sgt i32 %3, 0
br i1 %7, label %8, label %21
8: ; preds = %2
%9 = zext i32 %3 to i64
br label %10
10: ; preds = %8, %18
%11 = phi i64 [ 0, %8 ], [ %19, %18 ]
%12 = getelementptr inbounds i8, i8* %0, i64 %11
%13 = load i8, i8* %12
%14 = tail call i32* @strchr(i8* %1, i8 signext %13)
%15 = icmp eq i32* %14, null
br i1 %15, label %16, label %18
16: ; preds = %10
%17 = tail call i32 @strcat(i8* %6, i8* %12)
br label %18
18: ; preds = %10, %16
%19 = add nuw nsw i64 %11, 1
%20 = icmp eq i64 %19, %9
br i1 %20, label %21, label %10
21: ; preds = %18, %2
ret i8* %6
}