void inter_set(s, t) {
  register int i;
  i = 1;
  while (i != len(s) + 1) {
    if (idx(t, val(s, i)) == 0) {
      str(s, i, val(s, len(s)));
      pop(s);
    } else {
      i = i + 1;
    }
  }
}


x86 assembly (clang, -O0):
<inter_set>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x0,%al
call   1030 <len@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
add    $0x1,%ecx
cmp    %ecx,%eax
je     1201 <inter_set+0xb1>
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    $0x0,%al
call   1060 <val@plt>
mov    -0x14(%rbp),%edi
mov    %eax,%esi
mov    $0x0,%al
call   1040 <idx@plt>
cmp    $0x0,%eax
jne    11f3 <inter_set+0xa3>
mov    -0x4(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x0,%al
call   1030 <len@plt>
mov    -0x20(%rbp),%edi
mov    %eax,%esi
mov    $0x0,%al
call   1060 <val@plt>
mov    -0x1c(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    %eax,%edx
mov    $0x0,%al
call   1070 <str@plt>
mov    -0x4(%rbp),%edi
mov    $0x0,%al
call   1050 <pop@plt>
jmp    11fc <inter_set+0xac>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1165 <inter_set+0x15>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<inter_set>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%r14d
mov    %edi,%ebp
xor    %eax,%eax
call   1030 <len@plt>
test   %eax,%eax
je     11ca <inter_set+0x7a>
mov    $0x1,%ebx
jmp    1183 <inter_set+0x33>
nopl   0x0(%rax,%rax,1)
add    $0x1,%ebx
mov    %ebp,%edi
xor    %eax,%eax
call   1030 <len@plt>
add    $0x1,%eax
cmp    %eax,%ebx
je     11ca <inter_set+0x7a>
mov    %ebp,%edi
mov    %ebx,%esi
xor    %eax,%eax
call   1060 <val@plt>
mov    %r14d,%edi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <idx@plt>
test   %eax,%eax
jne    1170 <inter_set+0x20>
mov    %ebp,%edi
xor    %eax,%eax
call   1030 <len@plt>
mov    %ebp,%edi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <val@plt>
mov    %ebp,%edi
mov    %ebx,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1070 <str@plt>
mov    %ebp,%edi
xor    %eax,%eax
call   1050 <pop@plt>
jmp    1173 <inter_set+0x23>
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @inter_set(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
store i32 1, i32* %5
br label %6
6: ; preds = %32, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %3
%9 = call i32 (i32, ...) bitcast (i32 (...)* @len to i32 (i32, ...)*)(i32 %8)
%10 = add nsw i32 %9, 1
%11 = icmp ne i32 %7, %10
br i1 %11, label %12, label %33
12: ; preds = %6
%13 = load i32, i32* %4
%14 = load i32, i32* %3
%15 = load i32, i32* %5
%16 = call i32 (i32, i32, ...) bitcast (i32 (...)* @val to i32 (i32, i32, ...)*)(i32 %14, i32 %15)
%17 = call i32 (i32, i32, ...) bitcast (i32 (...)* @idx to i32 (i32, i32, ...)*)(i32 %13, i32 %16)
%18 = icmp eq i32 %17, 0
br i1 %18, label %19, label %29
19: ; preds = %12
%20 = load i32, i32* %3
%21 = load i32, i32* %5
%22 = load i32, i32* %3
%23 = load i32, i32* %3
%24 = call i32 (i32, ...) bitcast (i32 (...)* @len to i32 (i32, ...)*)(i32 %23)
%25 = call i32 (i32, i32, ...) bitcast (i32 (...)* @val to i32 (i32, i32, ...)*)(i32 %22, i32 %24)
%26 = call i32 (i32, i32, i32, ...) bitcast (i32 (...)* @str to i32 (i32, i32, i32, ...)*)(i32 %20, i32 %21, i32 %25)
%27 = load i32, i32* %3
%28 = call i32 (i32, ...) bitcast (i32 (...)* @pop to i32 (i32, ...)*)(i32 %27)
br label %32
29: ; preds = %12
%30 = load i32, i32* %5
%31 = add nsw i32 %30, 1
store i32 %31, i32* %5
br label %32
32: ; preds = %29, %19
br label %6
33: ; preds = %6
ret void
}

LLVM IR (-O2):
define void @inter_set(i32 %0, i32 %1) {
%3 = tail call i32 (i32, ...) bitcast (i32 (...)* @len to i32 (i32, ...)*)(i32 %0)
%4 = icmp eq i32 %3, 0
br i1 %4, label %22, label %5
5: ; preds = %2, %17
%6 = phi i32 [ %18, %17 ], [ 1, %2 ]
%7 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @val to i32 (i32, i32, ...)*)(i32 %0, i32 %6)
%8 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @idx to i32 (i32, i32, ...)*)(i32 %1, i32 %7)
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %15
10: ; preds = %5
%11 = tail call i32 (i32, ...) bitcast (i32 (...)* @len to i32 (i32, ...)*)(i32 %0)
%12 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @val to i32 (i32, i32, ...)*)(i32 %0, i32 %11)
%13 = tail call i32 (i32, i32, i32, ...) bitcast (i32 (...)* @str to i32 (i32, i32, i32, ...)*)(i32 %0, i32 %6, i32 %12)
%14 = tail call i32 (i32, ...) bitcast (i32 (...)* @pop to i32 (i32, ...)*)(i32 %0)
br label %17
15: ; preds = %5
%16 = add nsw i32 %6, 1
br label %17
17: ; preds = %15, %10
%18 = phi i32 [ %6, %10 ], [ %16, %15 ]
%19 = tail call i32 (i32, ...) bitcast (i32 (...)* @len to i32 (i32, ...)*)(i32 %0)
%20 = add nsw i32 %19, 1
%21 = icmp eq i32 %18, %20
br i1 %21, label %22, label %5
22: ; preds = %17, %2
ret void
}