#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 matcher {
  int dummy;
};

/* Variables and functions */
char *next_file(struct matcher *);
char *next_group(struct matcher *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ puts(char const *);
int print_dups(struct matcher *m) {
  int first = 1;
  const char *file;
  while ((file = next_group(m))) {
    if (first)
      first = 0;
    else
      printf("\n");
    puts(file);
    while ((file = next_file(m)))
      puts(file);
  }
  return 0;
}


x86 assembly (clang, -O0):
<print_dups>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <next_group@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
je     11bf <print_dups+0x7f>
cmpl   $0x0,-0xc(%rbp)
je     1180 <print_dups+0x40>
movl   $0x0,-0xc(%rbp)
jmp    118c <print_dups+0x4c>
lea    0xe79(%rip),%rdi
call   1050 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <puts@plt>
mov    -0x8(%rbp),%rdi
call   1060 <next_file@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
je     11ba <print_dups+0x7a>
mov    -0x18(%rbp),%rdi
call   1030 <puts@plt>
jmp    1195 <print_dups+0x55>
jmp    1153 <print_dups+0x13>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_dups>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1050 <next_group@plt>
test   %rax,%rax
je     11a7 <print_dups+0x67>
mov    %rax,%r14
xor    %eax,%eax
jmp    1172 <print_dups+0x32>
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1050 <next_group@plt>
mov    %rax,%r14
mov    $0x1,%al
test   %r14,%r14
je     11a7 <print_dups+0x67>
test   $0x1,%al
je     1180 <print_dups+0x40>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %r14,%rdi
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1060 <next_file@plt>
test   %rax,%rax
je     1160 <print_dups+0x20>
mov    %rax,%rdi
jmp    1190 <print_dups+0x50>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.matcher = type { i32 }
@.str = [2 x i8] c"\0A\00"
define i32 @print_dups(%struct.matcher* %0) {
%2 = alloca %struct.matcher*
%3 = alloca i32
%4 = alloca i8*
store %struct.matcher* %0, %struct.matcher** %2
store i32 1, i32* %3
br label %5
5: ; preds = %25, %1
%6 = load %struct.matcher*, %struct.matcher** %2
%7 = call i8* @next_group(%struct.matcher* %6)
store i8* %7, i8** %4
%8 = icmp ne i8* %7, null
br i1 %8, label %9, label %26
9: ; preds = %5
%10 = load i32, i32* %3
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %9
store i32 0, i32* %3
br label %15
13: ; preds = %9
%14 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %15
15: ; preds = %13, %12
%16 = load i8*, i8** %4
%17 = call i32 @puts(i8* %16)
br label %18
18: ; preds = %22, %15
%19 = load %struct.matcher*, %struct.matcher** %2
%20 = call i8* @next_file(%struct.matcher* %19)
store i8* %20, i8** %4
%21 = icmp ne i8* %20, null
br i1 %21, label %22, label %25
22: ; preds = %18
%23 = load i8*, i8** %4
%24 = call i32 @puts(i8* %23)
br label %18
25: ; preds = %18
br label %5
26: ; preds = %5
ret i32 0
}

LLVM IR (-O2):
%struct.matcher = type { i32 }
define i32 @print_dups(%struct.matcher* %0) {
%2 = tail call i8* @next_group(%struct.matcher* %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %21, label %7
4: ; preds = %16, %12
%5 = tail call i8* @next_group(%struct.matcher* %0)
%6 = icmp eq i8* %5, null
br i1 %6, label %21, label %7
7: ; preds = %1, %4
%8 = phi i8* [ %5, %4 ], [ %2, %1 ]
%9 = phi i1 [ true, %4 ], [ false, %1 ]
br i1 %9, label %10, label %12
10: ; preds = %7
%11 = tail call i32 @putchar(i32 10)
br label %12
12: ; preds = %7, %10
%13 = tail call i32 @puts(i8* %8)
%14 = tail call i8* @next_file(%struct.matcher* %0)
%15 = icmp eq i8* %14, null
br i1 %15, label %4, label %16
16: ; preds = %12, %16
%17 = phi i8* [ %19, %16 ], [ %14, %12 ]
%18 = tail call i32 @puts(i8* %17)
%19 = tail call i8* @next_file(%struct.matcher* %0)
%20 = icmp eq i8* %19, null
br i1 %20, label %4, label %16
21: ; preds = %4, %1
ret i32 0
}