#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*/ free(char *);
char *psys_lsb_distributor_id();
int /*<<< orphan*/ strcmp(char const *, char *);
int fallback_match_by_distro(const char **distros) {
  char *dist;
  dist = psys_lsb_distributor_id();
  if (!dist) {
    return 0;
  } else {
    int matching;
    const char **d;
    matching = 0;
    for (d = distros; *d; d++) {
      if (!strcmp(*d, dist)) {
        matching = 1;
        break;
      }
    }
    free(dist);
    return matching;
  }
}


x86 assembly (clang, -O0):
<fallback_match_by_distro>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    $0x0,%al
call   1050 <psys_lsb_distributor_id@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    115e <fallback_match_by_distro+0x2e>
movl   $0x0,-0x4(%rbp)
jmp    11c5 <fallback_match_by_distro+0x95>
movl   $0x0,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmpq   $0x0,(%rax)
je     11b6 <fallback_match_by_distro+0x86>
mov    -0x28(%rbp),%rax
mov    (%rax),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    11a0 <fallback_match_by_distro+0x70>
movl   $0x1,-0x1c(%rbp)
jmp    11b6 <fallback_match_by_distro+0x86>
jmp    11a5 <fallback_match_by_distro+0x75>
mov    -0x28(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x28(%rbp)
jmp    116d <fallback_match_by_distro+0x3d>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fallback_match_by_distro>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%rbp
xor    %r14d,%r14d
xor    %eax,%eax
call   1050 <psys_lsb_distributor_id@plt>
test   %rax,%rax
je     1189 <fallback_match_by_distro+0x59>
mov    %rax,%rbx
mov    0x0(%rbp),%rdi
xor    %r14d,%r14d
test   %rdi,%rdi
je     1181 <fallback_match_by_distro+0x51>
add    $0x8,%rbp
nopl   0x0(%rax)
mov    %rbx,%rsi
call   1040 <strcmp@plt>
test   %eax,%eax
je     117b <fallback_match_by_distro+0x4b>
mov    0x0(%rbp),%rdi
add    $0x8,%rbp
test   %rdi,%rdi
jne    1160 <fallback_match_by_distro+0x30>
jmp    1181 <fallback_match_by_distro+0x51>
mov    $0x1,%r14d
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r14d,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @fallback_match_by_distro(i8** %0) {
%2 = alloca i32
%3 = alloca i8**
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8**
store i8** %0, i8*** %3
%7 = call i8* (...) @psys_lsb_distributor_id()
store i8* %7, i8** %4
%8 = load i8*, i8** %4
%9 = icmp ne i8* %8, null
br i1 %9, label %11, label %10
10: ; preds = %1
store i32 0, i32* %2
br label %32
11: ; preds = %1
store i32 0, i32* %5
%12 = load i8**, i8*** %3
store i8** %12, i8*** %6
br label %13
13: ; preds = %25, %11
%14 = load i8**, i8*** %6
%15 = load i8*, i8** %14
%16 = icmp ne i8* %15, null
br i1 %16, label %17, label %28
17: ; preds = %13
%18 = load i8**, i8*** %6
%19 = load i8*, i8** %18
%20 = load i8*, i8** %4
%21 = call i32 @strcmp(i8* %19, i8* %20)
%22 = icmp ne i32 %21, 0
br i1 %22, label %24, label %23
23: ; preds = %17
store i32 1, i32* %5
br label %28
24: ; preds = %17
br label %25
25: ; preds = %24
%26 = load i8**, i8*** %6
%27 = getelementptr inbounds i8*, i8** %26, i32 1
store i8** %27, i8*** %6
br label %13
28: ; preds = %23, %13
%29 = load i8*, i8** %4
%30 = call i32 @free(i8* %29)
%31 = load i32, i32* %5
store i32 %31, i32* %2
br label %32
32: ; preds = %28, %10
%33 = load i32, i32* %2
ret i32 %33
}

LLVM IR (-O2):
define i32 @fallback_match_by_distro(i8** nocapture %0) {
%2 = tail call i8* (...) @psys_lsb_distributor_id()
%3 = icmp eq i8* %2, null
br i1 %3, label %19, label %4
4: ; preds = %1
%5 = load i8*, i8** %0
%6 = icmp eq i8* %5, null
br i1 %6, label %16, label %10
7: ; preds = %10
%8 = load i8*, i8** %15
%9 = icmp eq i8* %8, null
br i1 %9, label %16, label %10
10: ; preds = %4, %7
%11 = phi i8* [ %8, %7 ], [ %5, %4 ]
%12 = phi i8** [ %15, %7 ], [ %0, %4 ]
%13 = tail call i32 @strcmp(i8* %11, i8* %2)
%14 = icmp eq i32 %13, 0
%15 = getelementptr inbounds i8*, i8** %12, i64 1
br i1 %14, label %16, label %7
16: ; preds = %7, %10, %4
%17 = phi i32 [ 0, %4 ], [ 1, %10 ], [ 0, %7 ]
%18 = tail call i32 @free(i8* %2)
br label %19
19: ; preds = %1, %16
%20 = phi i32 [ %17, %16 ], [ 0, %1 ]
ret i32 %20
}