int __attribute__((no, noclone))
badfunc(int u0, int u1, int u2, int u3, short *fsname,
        unsigned int fsname_len) {
  static const short ntfsW[] = {'N', 'T', 'F', 'S', 0};
  char superblock[2048 + 3300];
  int ret = 0;
  short *p;
  if (extfunc())
    return 0;
  p = (void *)extfunc();
  if (p != 0)
    goto done;
  extfunc(superblock);
  lstrcpynW(fsname, ntfsW, fsname_len);
  ret = 1;
done:
  return ret;
}


x86 assembly (clang, -O0):
<badfunc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1520,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8,-0x20(%rbp)
mov    %r9d,-0x24(%rbp)
movl   $0x0,-0x1514(%rbp)
mov    $0x0,%al
call   1030 <extfunc@plt>
cmp    $0x0,%eax
je     1165 <badfunc+0x45>
movl   $0x0,-0x4(%rbp)
jmp    11be <badfunc+0x9e>
mov    $0x0,%al
call   1030 <extfunc@plt>
cltq
mov    %rax,-0x1520(%rbp)
cmpq   $0x0,-0x1520(%rbp)
je     1188 <badfunc+0x68>
jmp    11b5 <badfunc+0x95>
lea    -0x1510(%rbp),%rdi
mov    $0x0,%al
call   1030 <extfunc@plt>
mov    -0x20(%rbp),%rdi
mov    -0x24(%rbp),%edx
lea    0xe5c(%rip),%rsi
mov    $0x0,%al
call   1040 <lstrcpynW@plt>
movl   $0x1,-0x1514(%rbp)
mov    -0x1514(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1520,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<badfunc>:
push   %rbp
push   %r14
push   %rbx
sub    $0x14f0,%rsp
mov    %r9d,%r14d
mov    %r8,%rbx
xor    %ebp,%ebp
xor    %eax,%eax
call   1030 <extfunc@plt>
test   %eax,%eax
jne    116e <badfunc+0x4e>
xor    %ebp,%ebp
xor    %eax,%eax
call   1030 <extfunc@plt>
test   %eax,%eax
jne    116e <badfunc+0x4e>
mov    %rsp,%rdi
xor    %eax,%eax
call   1030 <extfunc@plt>
lea    0xea4(%rip),%rsi
mov    %rbx,%rdi
mov    %r14d,%edx
xor    %eax,%eax
call   1040 <lstrcpynW@plt>
mov    $0x1,%ebp
mov    %ebp,%eax
add    $0x14f0,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@badfunc.ntfsW = internal constant [5 x i16] [i16 78, i16 84, i16 70, i16 83, i16 0]
define i32 @badfunc(i32 %0, i32 %1, i32 %2, i32 %3, i16* %4, i32 %5) {
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i16*
%13 = alloca i32
%14 = alloca [5348 x i8]
%15 = alloca i32
%16 = alloca i16*
store i32 %0, i32* %8
store i32 %1, i32* %9
store i32 %2, i32* %10
store i32 %3, i32* %11
store i16* %4, i16** %12
store i32 %5, i32* %13
store i32 0, i32* %15
%17 = call i32 (...) @extfunc()
%18 = icmp ne i32 %17, 0
br i1 %18, label %19, label %20
19: ; preds = %6
store i32 0, i32* %7
br label %36
20: ; preds = %6
%21 = call i32 (...) @extfunc()
%22 = sext i32 %21 to i64
%23 = inttoptr i64 %22 to i8*
%24 = bitcast i8* %23 to i16*
store i16* %24, i16** %16
%25 = load i16*, i16** %16
%26 = icmp ne i16* %25, null
br i1 %26, label %27, label %28
27: ; preds = %20
br label %34
28: ; preds = %20
%29 = getelementptr inbounds [5348 x i8], [5348 x i8]* %14, i64 0, i64 0
%30 = call i32 (i8*, ...) bitcast (i32 (...)* @extfunc to i32 (i8*, ...)*)(i8* %29)
%31 = load i16*, i16** %12
%32 = load i32, i32* %13
%33 = call i32 (i16*, i16*, i32, ...) bitcast (i32 (...)* @lstrcpynW to i32 (i16*, i16*, i32, ...)*)(i16* %31, i16* getelementptr inbounds ([5 x i16], [5 x i16]* @badfunc.ntfsW, i64 0, i64 0), i32 %32)
store i32 1, i32* %15
br label %34
34: ; preds = %28, %27
%35 = load i32, i32* %15
store i32 %35, i32* %7
br label %36
36: ; preds = %34, %19
%37 = load i32, i32* %7
ret i32 %37
}

LLVM IR (-O2):
@badfunc.ntfsW = internal constant [5 x i16] [i16 78, i16 84, i16 70, i16 83, i16 0]
define i32 @badfunc(i32 %0, i32 %1, i32 %2, i32 %3, i16* %4, i32 %5) {
%7 = alloca [5348 x i8]
%8 = getelementptr inbounds [5348 x i8], [5348 x i8]* %7, i64 0, i64 0
%9 = tail call i32 (...) @extfunc()
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %17
11: ; preds = %6
%12 = tail call i32 (...) @extfunc()
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %17
14: ; preds = %11
%15 = call i32 (i8*, ...) bitcast (i32 (...)* @extfunc to i32 (i8*, ...)*)(i8* %8)
%16 = call i32 (i16*, i16*, i32, ...) bitcast (i32 (...)* @lstrcpynW to i32 (i16*, i16*, i32, ...)*)(i16* %4, i16* getelementptr inbounds ([5 x i16], [5 x i16]* @badfunc.ntfsW, i64 0, i64 0), i32 %5)
br label %17
17: ; preds = %14, %11, %6
%18 = phi i32 [ 0, %6 ], [ 0, %11 ], [ 1, %14 ]
ret i32 %18
}