#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 */
struct archive {
  int dummy;
};

/* Variables and functions */
int archive_match_path_unmatched_inclusions(struct archive *);
int archive_match_path_unmatched_inclusions_next(struct archive *,
                                                 char const **);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ lafe_errc(int, int /*<<< orphan*/, char *);
int /*<<< orphan*/ lafe_warnc(int /*<<< orphan*/, char *, char const *,
                              char const *);
int unmatched_inclusions_warn(struct archive *matching, const char *msg) {
  const char *p;
  int r;
  if (matching == NULL)
    return (0);
  while ((r = archive_match_path_unmatched_inclusions_next(matching, &p)) == 0)
    lafe_warnc(0, "%s: %s", p, msg);
  if (r == (-30))
    lafe_errc(1, errno, "Out of memory");
  return (archive_match_path_unmatched_inclusions(matching));
}


x86 assembly (clang, -O0):
<unmatched_inclusions_warn>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1167 <unmatched_inclusions_warn+0x27>
movl   $0x0,-0x4(%rbp)
jmp    11d0 <unmatched_inclusions_warn+0x90>
jmp    116c <unmatched_inclusions_warn+0x2c>
mov    -0x10(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1060 <archive_match_path_unmatched_inclusions_next@plt>
mov    %eax,-0x24(%rbp)
cmp    $0x0,%eax
jne    11a0 <unmatched_inclusions_warn+0x60>
mov    -0x20(%rbp),%rdx
mov    -0x18(%rbp),%rcx
xor    %edi,%edi
lea    0xe6a(%rip),%rsi
call   1050 <lafe_warnc@plt>
jmp    116c <unmatched_inclusions_warn+0x2c>
cmpl   $0xffffffe2,-0x24(%rbp)
jne    11c4 <unmatched_inclusions_warn+0x84>
mov    0x2e2f(%rip),%rax
mov    (%rax),%esi
mov    $0x1,%edi
lea    0xe48(%rip),%rdx
call   1040 <lafe_errc@plt>
mov    -0x10(%rbp),%rdi
call   1030 <archive_match_path_unmatched_inclusions@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<unmatched_inclusions_warn>:
test   %rdi,%rdi
je     11b5 <unmatched_inclusions_warn+0x75>
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %rsp,%r15
lea    0xea3(%rip),%r12
nopl   (%rax)
mov    %r14,%rdi
mov    %r15,%rsi
call   1060 <archive_match_path_unmatched_inclusions_next@plt>
test   %eax,%eax
jne    1182 <unmatched_inclusions_warn+0x42>
mov    (%rsp),%rdx
xor    %edi,%edi
mov    %r12,%rsi
mov    %rbx,%rcx
call   1050 <lafe_warnc@plt>
jmp    1160 <unmatched_inclusions_warn+0x20>
cmp    $0xffffffe2,%eax
jne    11a1 <unmatched_inclusions_warn+0x61>
mov    0x2e52(%rip),%rax
mov    (%rax),%esi
lea    0xe70(%rip),%rdx
mov    $0x1,%edi
call   1040 <lafe_errc@plt>
mov    %r14,%rdi
call   1030 <archive_match_path_unmatched_inclusions@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
%struct.archive = type { i32 }
@.str = [7 x i8] c"%s: %s\00"
@errno = global i32 0
@.str.1 = [14 x i8] c"Out of memory\00"
define i32 @unmatched_inclusions_warn(%struct.archive* %0, i8* %1) {
%3 = alloca i32
%4 = alloca %struct.archive*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
store %struct.archive* %0, %struct.archive** %4
store i8* %1, i8** %5
%8 = load %struct.archive*, %struct.archive** %4
%9 = icmp eq %struct.archive* %8, null
br i1 %9, label %10, label %11
10: ; preds = %2
store i32 0, i32* %3
br label %29
11: ; preds = %2
br label %12
12: ; preds = %16, %11
%13 = load %struct.archive*, %struct.archive** %4
%14 = call i32 @archive_match_path_unmatched_inclusions_next(%struct.archive* %13, i8** %6)
store i32 %14, i32* %7
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %20
16: ; preds = %12
%17 = load i8*, i8** %6
%18 = load i8*, i8** %5
%19 = call i32 @lafe_warnc(i32 0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %17, i8* %18)
br label %12
20: ; preds = %12
%21 = load i32, i32* %7
%22 = icmp eq i32 %21, -30
br i1 %22, label %23, label %26
23: ; preds = %20
%24 = load i32, i32* @errno
%25 = call i32 @lafe_errc(i32 1, i32 %24, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
br label %26
26: ; preds = %23, %20
%27 = load %struct.archive*, %struct.archive** %4
%28 = call i32 @archive_match_path_unmatched_inclusions(%struct.archive* %27)
store i32 %28, i32* %3
br label %29
29: ; preds = %26, %10
%30 = load i32, i32* %3
ret i32 %30
}

LLVM IR (-O2):
%struct.archive = type { i32 }
@.str = [7 x i8] c"%s: %s\00"
@errno = global i32 0
@.str.1 = [14 x i8] c"Out of memory\00"
define i32 @unmatched_inclusions_warn(%struct.archive* %0, i8* %1) {
%3 = alloca i8*
%4 = bitcast i8** %3 to i8*
%5 = icmp eq %struct.archive* %0, null
br i1 %5, label %16, label %6
6: ; preds = %2, %8
%7 = call i32 @archive_match_path_unmatched_inclusions_next(%struct.archive* %0, i8** %3)
switch i32 %7, label %14 [
i32 0, label %8
i32 -30, label %11
]
8: ; preds = %6
%9 = load i8*, i8** %3
%10 = call i32 @lafe_warnc(i32 0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %9, i8* %1)
br label %6
11: ; preds = %6
%12 = load i32, i32* @errno
%13 = call i32 @lafe_errc(i32 1, i32 %12, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
br label %14
14: ; preds = %6, %11
%15 = call i32 @archive_match_path_unmatched_inclusions(%struct.archive* %0)
br label %16
16: ; preds = %2, %14
%17 = phi i32 [ %15, %14 ], [ 0, %2 ]
ret i32 %17
}