#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 */
char *bse_getflashparam(char *);
void bse_setup(void) {
  char *name = bse_getflashparam("linuxboot");
  char *x = (char *)0xc0000100;
  if (name) {
    while (*name)
      *x++ = *name++;
  }
  *x = 0;
}


x86 assembly (clang, -O0):
<bse_setup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rdi
call   1030 <bse_getflashparam@plt>
mov    %rax,-0x8(%rbp)
mov    $0xc0000100,%eax
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     117a <bse_setup+0x6a>
jmp    1141 <bse_setup+0x31>
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1175 <bse_setup+0x65>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
mov    (%rax),%cl
mov    -0x10(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x10(%rbp)
mov    %cl,(%rax)
jmp    1141 <bse_setup+0x31>
jmp    117a <bse_setup+0x6a>
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bse_setup>:
push   %rbx
mov    $0xc0000100,%ebx
lea    0xee3(%rip),%rdi
call   1030 <bse_getflashparam@plt>
test   %rax,%rax
je     1151 <bse_setup+0x41>
mov    (%rax),%cl
test   %cl,%cl
je     1151 <bse_setup+0x41>
add    $0x1,%rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %cl,(%rbx)
add    $0x1,%rbx
movzbl (%rax),%ecx
add    $0x1,%rax
test   %cl,%cl
jne    1140 <bse_setup+0x30>
movb   $0x0,(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
@.str = [10 x i8] c"linuxboot\00"
define void @bse_setup() {
%1 = alloca i8*
%2 = alloca i8*
%3 = call i8* @bse_getflashparam(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
store i8* %3, i8** %1
store i8* inttoptr (i64 3221225728 to i8*), i8** %2
%4 = load i8*, i8** %1
%5 = icmp ne i8* %4, null
br i1 %5, label %6, label %18
6: ; preds = %0
br label %7
7: ; preds = %11, %6
%8 = load i8*, i8** %1
%9 = load i8, i8* %8
%10 = icmp ne i8 %9, 0
br i1 %10, label %11, label %17
11: ; preds = %7
%12 = load i8*, i8** %1
%13 = getelementptr inbounds i8, i8* %12, i32 1
store i8* %13, i8** %1
%14 = load i8, i8* %12
%15 = load i8*, i8** %2
%16 = getelementptr inbounds i8, i8* %15, i32 1
store i8* %16, i8** %2
store i8 %14, i8* %15
br label %7
17: ; preds = %7
br label %18
18: ; preds = %17, %0
%19 = load i8*, i8** %2
store i8 0, i8* %19
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"linuxboot\00"
define void @bse_setup() {
%1 = tail call i8* @bse_getflashparam(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%2 = icmp eq i8* %1, null
br i1 %2, label %14, label %3
3: ; preds = %0
%4 = load i8, i8* %1
%5 = icmp eq i8 %4, 0
br i1 %5, label %14, label %6
6: ; preds = %3, %6
%7 = phi i8 [ %12, %6 ], [ %4, %3 ]
%8 = phi i8* [ %11, %6 ], [ inttoptr (i64 3221225728 to i8*), %3 ]
%9 = phi i8* [ %10, %6 ], [ %1, %3 ]
%10 = getelementptr inbounds i8, i8* %9, i64 1
%11 = getelementptr inbounds i8, i8* %8, i64 1
store i8 %7, i8* %8
%12 = load i8, i8* %10
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %6
14: ; preds = %6, %3, %0
%15 = phi i8* [ inttoptr (i64 3221225728 to i8*), %0 ], [ inttoptr (i64 3221225728 to i8*), %3 ], [ %11, %6 ]
store i8 0, i8* %15
ret void
}