#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*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stdout;
void get_secret(char buffer[]) {
  int i = 0;
  if (buffer[i] == '\0') {
    (void)fprintf(stdout, "No secret set.");
  }
  while (buffer[i] != '\0') {
    (void)fprintf(stdout, "%c", buffer[i]);
    i++;
  }
  (void)fprintf(stdout, "\n\n");
}


x86 assembly (clang, -O0):
<get_secret>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
jne    114f <get_secret+0x3f>
mov    0x2ea1(%rip),%rax
mov    (%rax),%edi
lea    0xeb8(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    1154 <get_secret+0x44>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     119a <get_secret+0x8a>
mov    0x2e70(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%edx
lea    0xe8a(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1154 <get_secret+0x44>
mov    0x2e3f(%rip),%rax
mov    (%rax),%edi
lea    0xe68(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_secret>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%al
test   %al,%al
jne    113b <get_secret+0x2b>
mov    0x2ebb(%rip),%rax
mov    (%rax),%edi
lea    0xed2(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%rbx),%al
test   %al,%al
je     116b <get_secret+0x5b>
add    $0x1,%rbx
mov    0x2e9a(%rip),%r15
lea    0xec2(%rip),%r14
nopl   (%rax)
movsbl %al,%edx
mov    (%r15),%edi
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1150 <get_secret+0x40>
mov    0x2e6e(%rip),%rax
mov    (%rax),%edi
lea    0xe97(%rip),%rsi
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stdout = global i32 0
@.str = [15 x i8] c"No secret set.\00"
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [3 x i8] c"\0A\0A\00"
define void @get_secret(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
%4 = load i8*, i8** %2
%5 = load i32, i32* %3
%6 = sext i32 %5 to i64
%7 = getelementptr inbounds i8, i8* %4, i64 %6
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %1
%12 = load i32, i32* @stdout
%13 = call i32 (i32, i8*, ...) @fprintf(i32 %12, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
br label %14
14: ; preds = %11, %1
br label %15
15: ; preds = %23, %14
%16 = load i8*, i8** %2
%17 = load i32, i32* %3
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i8, i8* %16, i64 %18
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = icmp ne i32 %21, 0
br i1 %22, label %23, label %34
23: ; preds = %15
%24 = load i32, i32* @stdout
%25 = load i8*, i8** %2
%26 = load i32, i32* %3
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i8, i8* %25, i64 %27
%29 = load i8, i8* %28
%30 = sext i8 %29 to i32
%31 = call i32 (i32, i8*, ...) @fprintf(i32 %24, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %30)
%32 = load i32, i32* %3
%33 = add nsw i32 %32, 1
store i32 %33, i32* %3
br label %15
34: ; preds = %15
%35 = load i32, i32* @stdout
%36 = call i32 (i32, i8*, ...) @fprintf(i32 %35, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [15 x i8] c"No secret set.\00"
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [3 x i8] c"\0A\0A\00"
define void @get_secret(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %4, label %9
4: ; preds = %1
%5 = load i32, i32* @stdout
%6 = tail call i32 (i32, i8*, ...) @fprintf(i32 %5, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%7 = load i8, i8* %0
%8 = icmp eq i8 %7, 0
br i1 %8, label %21, label %9
9: ; preds = %1, %4
%10 = phi i8 [ %7, %4 ], [ %2, %1 ]
br label %11
11: ; preds = %9, %11
%12 = phi i64 [ %17, %11 ], [ 0, %9 ]
%13 = phi i8 [ %19, %11 ], [ %10, %9 ]
%14 = sext i8 %13 to i32
%15 = load i32, i32* @stdout
%16 = tail call i32 (i32, i8*, ...) @fprintf(i32 %15, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %14)
%17 = add nuw i64 %12, 1
%18 = getelementptr inbounds i8, i8* %0, i64 %17
%19 = load i8, i8* %18
%20 = icmp eq i8 %19, 0
br i1 %20, label %21, label %11
21: ; preds = %11, %4
%22 = load i32, i32* @stdout
%23 = tail call i32 (i32, i8*, ...) @fprintf(i32 %22, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
ret void
}