#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*/ memset(float *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, int, char *);
scalar_t__ strstr(char *, char *);
void fill_truth(char *path, char **labels, int k, float *truth) {
  int i;
  memset(truth, 0, k * sizeof(float));
  int count = 0;
  for (i = 0; i < k; ++i) {
    if (strstr(path, labels[i])) {
      truth[i] = 1;
      ++count;
    }
  }
  if (count != 1)
    printf("Too many or too few labels: %d, %s\n", count, path);
}


x86 assembly (clang, -O0):
<fill_truth>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
movslq -0x14(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edx
xor    %esi,%esi
call   1040 <memset@plt>
movl   $0x0,-0x28(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11c6 <fill_truth+0x96>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
call   1050 <strstr@plt>
cmp    $0x0,%rax
je     11b3 <fill_truth+0x83>
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
movss  0xe5b(%rip),%xmm0
movss  %xmm0,(%rax,%rcx,4)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    11b8 <fill_truth+0x88>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    116a <fill_truth+0x3a>
cmpl   $0x1,-0x28(%rbp)
je     11e3 <fill_truth+0xb3>
mov    -0x28(%rbp),%esi
mov    -0x8(%rbp),%rdx
lea    0xe26(%rip),%rdi
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fill_truth>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %edx,%r12d
mov    %rsi,%r13
mov    %rdi,%r15
lea    0x0(,%r12,4),%edx
xor    %ebp,%ebp
mov    %rcx,%rdi
xor    %esi,%esi
call   1040 <memset@plt>
test   %r12d,%r12d
jle    11ac <fill_truth+0x7c>
mov    %r12d,%r12d
xor    %ebx,%ebx
xor    %ebp,%ebp
jmp    1179 <fill_truth+0x49>
nopl   0x0(%rax)
add    $0x1,%rbx
cmp    %rbx,%r12
je     1198 <fill_truth+0x68>
mov    0x0(%r13,%rbx,8),%rsi
mov    %r15,%rdi
call   1050 <strstr@plt>
test   %rax,%rax
je     1170 <fill_truth+0x40>
movl   $0x3f800000,(%r14,%rbx,4)
3f
add    $0x1,%ebp
jmp    1170 <fill_truth+0x40>
cmp    $0x1,%ebp
jne    11ac <fill_truth+0x7c>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xe4d(%rip),%rdi
mov    %ebp,%esi
mov    %r15,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [36 x i8] c"Too many or too few labels: %d, %s\0A\00"
define void @fill_truth(i8* %0, i8** %1, i32 %2, float* %3) {
%5 = alloca i8*
%6 = alloca i8**
%7 = alloca i32
%8 = alloca float*
%9 = alloca i32
%10 = alloca i32
store i8* %0, i8** %5
store i8** %1, i8*** %6
store i32 %2, i32* %7
store float* %3, float** %8
%11 = load float*, float** %8
%12 = load i32, i32* %7
%13 = sext i32 %12 to i64
%14 = mul i64 %13, 4
%15 = trunc i64 %14 to i32
%16 = call i32 @memset(float* %11, i32 0, i32 %15)
store i32 0, i32* %10
store i32 0, i32* %9
br label %17
17: ; preds = %38, %4
%18 = load i32, i32* %9
%19 = load i32, i32* %7
%20 = icmp slt i32 %18, %19
br i1 %20, label %21, label %41
21: ; preds = %17
%22 = load i8*, i8** %5
%23 = load i8**, i8*** %6
%24 = load i32, i32* %9
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i8*, i8** %23, i64 %25
%27 = load i8*, i8** %26
%28 = call i64 @strstr(i8* %22, i8* %27)
%29 = icmp ne i64 %28, 0
br i1 %29, label %30, label %37
30: ; preds = %21
%31 = load float*, float** %8
%32 = load i32, i32* %9
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds float, float* %31, i64 %33
store float 1.000000e+00, float* %34
%35 = load i32, i32* %10
%36 = add nsw i32 %35, 1
store i32 %36, i32* %10
br label %37
37: ; preds = %30, %21
br label %38
38: ; preds = %37
%39 = load i32, i32* %9
%40 = add nsw i32 %39, 1
store i32 %40, i32* %9
br label %17
41: ; preds = %17
%42 = load i32, i32* %10
%43 = icmp ne i32 %42, 1
br i1 %43, label %44, label %48
44: ; preds = %41
%45 = load i32, i32* %10
%46 = load i8*, i8** %5
%47 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %45, i8* %46)
br label %48
48: ; preds = %44, %41
ret void
}

LLVM IR (-O2):
@.str = [36 x i8] c"Too many or too few labels: %d, %s\0A\00"
define void @fill_truth(i8* %0, i8** nocapture %1, i32 %2, float* %3) {
%5 = shl i32 %2, 2
%6 = tail call i32 @memset(float* %3, i32 0, i32 %5)
%7 = icmp sgt i32 %2, 0
br i1 %7, label %8, label %26
8: ; preds = %4
%9 = zext i32 %2 to i64
br label %10
10: ; preds = %8, %20
%11 = phi i64 [ 0, %8 ], [ %22, %20 ]
%12 = phi i32 [ 0, %8 ], [ %21, %20 ]
%13 = getelementptr inbounds i8*, i8** %1, i64 %11
%14 = load i8*, i8** %13
%15 = tail call i64 @strstr(i8* %0, i8* %14)
%16 = icmp eq i64 %15, 0
br i1 %16, label %20, label %17
17: ; preds = %10
%18 = getelementptr inbounds float, float* %3, i64 %11
store float 1.000000e+00, float* %18
%19 = add nsw i32 %12, 1
br label %20
20: ; preds = %10, %17
%21 = phi i32 [ %19, %17 ], [ %12, %10 ]
%22 = add nuw nsw i64 %11, 1
%23 = icmp eq i64 %22, %9
br i1 %23, label %24, label %10
24: ; preds = %20
%25 = icmp eq i32 %21, 1
br i1 %25, label %29, label %26
26: ; preds = %4, %24
%27 = phi i32 [ %21, %24 ], [ 0, %4 ]
%28 = tail call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %27, i8* %0)
br label %29
29: ; preds = %26, %24
ret void
}