#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*/ show_result(int, int, char *);
void brute_force(int len, char *msg) {
  int offset = 1;
  while (offset < 26) {
    show_result(offset, len, msg);
    ++offset;
  }
}


x86 assembly (clang, -O0):
<brute_force>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
cmpl   $0x1a,-0x14(%rbp)
jge    114d <brute_force+0x3d>
mov    -0x14(%rbp),%edi
mov    -0x4(%rbp),%esi
mov    -0x10(%rbp),%rdx
call   1030 <show_result@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1126 <brute_force+0x16>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<brute_force>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
mov    $0x1,%edi
mov    %ebp,%esi
mov    %rbx,%rdx
call   1030 <show_result@plt>
mov    $0x2,%edi
mov    %ebp,%esi
mov    %rbx,%rdx
call   1030 <show_result@plt>
mov    $0x3,%edi
mov    %ebp,%esi
mov    %rbx,%rdx
call   1030 <show_result@plt>
mov    $0x4,%edi
mov    %ebp,%esi
mov    %rbx,%rdx
call   1030 <show_result@plt>
mov    $0x5,%edi
mov    %ebp,%esi
mov    %rbx,%rdx
call   1030 <show_result@plt>
mov    $0x6,%edi
mov    %ebp,%esi
mov    %rbx,%rdx
call   1030 <show_result@plt>
mov    $0x7,%edi
mov    %ebp,%esi
mov    %rbx,%rdx
call   1030 <show_result@plt>
mov    $0x8,%edi
mov    %ebp,%esi
mov    %rbx,%rdx
call   1030 <show_result@plt>
mov    $0x9,%edi
mov    %ebp,%esi
mov    %rbx,%rdx
call   1030 <show_result@plt>
mov    $0xa,%edi
mov    %ebp,%esi
mov    %rbx,%rdx
call   1030 <show_result@plt>
mov    $0xb,%edi
mov    %ebp,%esi
mov    %rbx,%rdx
call   1030 <show_result@plt>
mov    $0xc,%edi
mov    %ebp,%esi
mov    %rbx,%rdx
call   1030 <show_result@plt>
mov    $0xd,%edi
mov    %ebp,%esi
mov    %rbx,%rdx
call   1030 <show_result@plt>
mov    $0xe,%edi
mov    %ebp,%esi
mov    %rbx,%rdx
call   1030 <show_result@plt>
mov    $0xf,%edi
mov    %ebp,%esi
mov    %rbx,%rdx
call   1030 <show_result@plt>
mov    $0x10,%edi
mov    %ebp,%esi
mov    %rbx,%rdx
call   1030 <show_result@plt>
mov    $0x11,%edi
mov    %ebp,%esi
mov    %rbx,%rdx
call   1030 <show_result@plt>
mov    $0x12,%edi
mov    %ebp,%esi
mov    %rbx,%rdx
call   1030 <show_result@plt>
mov    $0x13,%edi
mov    %ebp,%esi
mov    %rbx,%rdx
call   1030 <show_result@plt>
mov    $0x14,%edi
mov    %ebp,%esi
mov    %rbx,%rdx
call   1030 <show_result@plt>
mov    $0x15,%edi
mov    %ebp,%esi
mov    %rbx,%rdx
call   1030 <show_result@plt>
mov    $0x16,%edi
mov    %ebp,%esi
mov    %rbx,%rdx
call   1030 <show_result@plt>
mov    $0x17,%edi
mov    %ebp,%esi
mov    %rbx,%rdx
call   1030 <show_result@plt>
mov    $0x18,%edi
mov    %ebp,%esi
mov    %rbx,%rdx
call   1030 <show_result@plt>
mov    $0x19,%edi
mov    %ebp,%esi
mov    %rbx,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <show_result@plt>

LLVM IR (-O0):
define void @brute_force(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
store i32 %0, i32* %3
store i8* %1, i8** %4
store i32 1, i32* %5
br label %6
6: ; preds = %9, %2
%7 = load i32, i32* %5
%8 = icmp slt i32 %7, 26
br i1 %8, label %9, label %16
9: ; preds = %6
%10 = load i32, i32* %5
%11 = load i32, i32* %3
%12 = load i8*, i8** %4
%13 = call i32 @show_result(i32 %10, i32 %11, i8* %12)
%14 = load i32, i32* %5
%15 = add nsw i32 %14, 1
store i32 %15, i32* %5
br label %6
16: ; preds = %6
ret void
}

LLVM IR (-O2):
define void @brute_force(i32 %0, i8* %1) {
%3 = tail call i32 @show_result(i32 1, i32 %0, i8* %1)
%4 = tail call i32 @show_result(i32 2, i32 %0, i8* %1)
%5 = tail call i32 @show_result(i32 3, i32 %0, i8* %1)
%6 = tail call i32 @show_result(i32 4, i32 %0, i8* %1)
%7 = tail call i32 @show_result(i32 5, i32 %0, i8* %1)
%8 = tail call i32 @show_result(i32 6, i32 %0, i8* %1)
%9 = tail call i32 @show_result(i32 7, i32 %0, i8* %1)
%10 = tail call i32 @show_result(i32 8, i32 %0, i8* %1)
%11 = tail call i32 @show_result(i32 9, i32 %0, i8* %1)
%12 = tail call i32 @show_result(i32 10, i32 %0, i8* %1)
%13 = tail call i32 @show_result(i32 11, i32 %0, i8* %1)
%14 = tail call i32 @show_result(i32 12, i32 %0, i8* %1)
%15 = tail call i32 @show_result(i32 13, i32 %0, i8* %1)
%16 = tail call i32 @show_result(i32 14, i32 %0, i8* %1)
%17 = tail call i32 @show_result(i32 15, i32 %0, i8* %1)
%18 = tail call i32 @show_result(i32 16, i32 %0, i8* %1)
%19 = tail call i32 @show_result(i32 17, i32 %0, i8* %1)
%20 = tail call i32 @show_result(i32 18, i32 %0, i8* %1)
%21 = tail call i32 @show_result(i32 19, i32 %0, i8* %1)
%22 = tail call i32 @show_result(i32 20, i32 %0, i8* %1)
%23 = tail call i32 @show_result(i32 21, i32 %0, i8* %1)
%24 = tail call i32 @show_result(i32 22, i32 %0, i8* %1)
%25 = tail call i32 @show_result(i32 23, i32 %0, i8* %1)
%26 = tail call i32 @show_result(i32 24, i32 %0, i8* %1)
%27 = tail call i32 @show_result(i32 25, i32 %0, i8* %1)
ret void
}