#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*/ printf(char *, ...);
scalar_t__ strncmp(char *, char *, int);
void print_groups(char words[100][100], int same_chars, int numwords) {
  char *proto_str = words[1];
  for (int i = 0; i < numwords; i++) {
    if (strncmp(proto_str, words[i], same_chars) == 0)
      printf("%s\n", words[i]);
    else {
      printf("\n");
      printf("%s\n", words[i]);
      proto_str = words[i];
    }
  }
}


x86 assembly (clang, -O0):
<print_groups>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rax
add    $0x64,%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    11e9 <print_groups+0xc9>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
movslq -0x1c(%rbp),%rax
imul   $0x64,%rax,%rax
add    %rax,%rsi
mov    -0xc(%rbp),%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    1198 <print_groups+0x78>
mov    -0x8(%rbp),%rsi
movslq -0x1c(%rbp),%rax
imul   $0x64,%rax,%rax
add    %rax,%rsi
lea    0xe74(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11d6 <print_groups+0xb6>
lea    0xe63(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rsi
movslq -0x1c(%rbp),%rax
imul   $0x64,%rax,%rax
add    %rax,%rsi
lea    0xe44(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
imul   $0x64,%rcx,%rcx
add    %rcx,%rax
mov    %rax,-0x18(%rbp)
jmp    11db <print_groups+0xbb>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1145 <print_groups+0x25>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_groups>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
test   %edx,%edx
jle    1184 <print_groups+0x54>
mov    %esi,%r14d
mov    %rdi,%rbx
lea    0x64(%rdi),%r15
mov    %edx,%ebp
jmp    1162 <print_groups+0x32>
nopl   0x0(%rax)
mov    %rbx,%rdi
call   1050 <puts@plt>
add    $0x64,%rbx
add    $0xffffffffffffffff,%rbp
je     1184 <print_groups+0x54>
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %r14d,%edx
call   1040 <strncmp@plt>
test   %rax,%rax
je     1150 <print_groups+0x20>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %rbx,%r15
jmp    1150 <print_groups+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @print_groups([100 x i8]* %0, i32 %1, i32 %2) {
%4 = icmp sgt i32 %2, 0
br i1 %4, label %5, label %8
5: ; preds = %3
%6 = getelementptr inbounds [100 x i8], [100 x i8]* %0, i64 1, i64 0
%7 = zext i32 %2 to i64
br label %9
8: ; preds = %17, %3
ret void
9: ; preds = %5, %17
%10 = phi i64 [ 0, %5 ], [ %20, %17 ]
%11 = phi i8* [ %6, %5 ], [ %18, %17 ]
%12 = getelementptr inbounds [100 x i8], [100 x i8]* %0, i64 %10, i64 0
%13 = tail call i64 @strncmp(i8* %11, i8* %12, i32 %1)
%14 = icmp eq i64 %13, 0
br i1 %14, label %17, label %15
15: ; preds = %9
%16 = tail call i32 @putchar(i32 10)
br label %17
17: ; preds = %9, %15
%18 = phi i8* [ %12, %15 ], [ %11, %9 ]
%19 = tail call i32 @puts(i8* dereferenceable(1) %12)
%20 = add nuw nsw i64 %10, 1
%21 = icmp eq i64 %20, %7
br i1 %21, label %8, label %9
}