xunge/DecIR huggingface dataset:
/* Variables and functions */
char *GetCvar(char const *);
int atoi(char *);
int /*<<< orphan*/ strcmp(char *, char *);
int /*<<< orphan*/ xfree(char *);
int GetCvarInt(const char *var_name) {
  int ret;
  char *buff = GetCvar(var_name);
  if (!strcmp(buff, ""))
    ret = 0;
  else
    ret = atoi(buff);
  xfree(buff);
  return ret;
}


x86 assembly (clang, -O0):
<GetCvarInt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <GetCvar@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xe9c(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    117e <GetCvarInt+0x3e>
movl   $0x0,-0xc(%rbp)
jmp    118a <GetCvarInt+0x4a>
mov    -0x18(%rbp),%rdi
call   1060 <atoi@plt>
mov    %eax,-0xc(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <xfree@plt>
mov    -0xc(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetCvarInt>:
push   %rbp
push   %rbx
push   %rax
call   1040 <GetCvar@plt>
mov    %rax,%rbx
cmpb   $0x0,(%rax)
je     114c <GetCvarInt+0x1c>
mov    %rbx,%rdi
call   1050 <atoi@plt>
mov    %eax,%ebp
jmp    114e <GetCvarInt+0x1e>
xor    %ebp,%ebp
mov    %rbx,%rdi
call   1030 <xfree@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
define i32 @GetCvarInt(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i8*
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i8* @GetCvar(i8* %5)
store i8* %6, i8** %4
%7 = load i8*, i8** %4
%8 = call i32 @strcmp(i8* %7, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%9 = icmp ne i32 %8, 0
br i1 %9, label %11, label %10
10: ; preds = %1
store i32 0, i32* %3
br label %14
11: ; preds = %1
%12 = load i8*, i8** %4
%13 = call i32 @atoi(i8* %12)
store i32 %13, i32* %3
br label %14
14: ; preds = %11, %10
%15 = load i8*, i8** %4
%16 = call i32 @xfree(i8* %15)
%17 = load i32, i32* %3
ret i32 %17
}

LLVM IR (-O2):
define i32 @GetCvarInt(i8* %0) {
%2 = tail call i8* @GetCvar(i8* %0)
%3 = load i8, i8* %2
%4 = icmp eq i8 %3, 0
br i1 %4, label %7, label %5
5: ; preds = %1
%6 = tail call i32 @atoi(i8* %2)
br label %7
7: ; preds = %1, %5
%8 = phi i32 [ %6, %5 ], [ 0, %1 ]
%9 = tail call i32 @xfree(i8* %2)
ret i32 %8
}
void writeNCgrid(const char *gridfile, int gridID, int *grid_imask) {
  Error_(__func__, "netCDF support not compiled in!");
}


x86 assembly (clang, -O0):
<writeNCgrid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
lea    0xed6(%rip),%rdi
lea    0xedb(%rip),%rsi
mov    $0x0,%al
call   1030 <Error_@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<writeNCgrid>:
lea    0xee9(%rip),%rdi
lea    0xeee(%rip),%rsi
xor    %eax,%eax
jmp    1030 <Error_@plt>

LLVM IR (-O0):
@__func__.writeNCgrid = [12 x i8] c"writeNCgrid\00"
@.str = [32 x i8] c"netCDF support not compiled in!\00"
define void @writeNCgrid(i8* %0, i32 %1, i32* %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32*
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32* %2, i32** %6
%7 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @Error_ to i32 (i8*, i8*, ...)*)(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @__func__.writeNCgrid, i64 0, i64 0), i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@__func__.writeNCgrid = [12 x i8] c"writeNCgrid\00"
@.str = [32 x i8] c"netCDF support not compiled in!\00"
define void @writeNCgrid(i8* nocapture readnone %0, i32 %1, i32* nocapture readnone %2) {
%4 = tail call i32 (i8*, i8*, ...) bitcast (i32 (...)* @Error_ to i32 (i8*, i8*, ...)*)(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @__func__.writeNCgrid, i64 0, i64 0), i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
ret void
}
int decode2(int x, int y, int z) {
  int t = (z - y) & 0x7FFF;
  return (x ^ t) * t;
}


x86 assembly (clang, -O0):
<decode2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0xc(%rbp),%eax
sub    -0x8(%rbp),%eax
and    $0x7fff,%eax
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
xor    -0x10(%rbp),%eax
imul   -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<decode2>:
mov    %edi,%eax
sub    %esi,%edx
and    $0x7fff,%edx
xor    %edx,%eax
imul   %edx,%eax
ret

LLVM IR (-O0):
define i32 @decode2(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i32, i32* %6
%9 = load i32, i32* %5
%10 = sub nsw i32 %8, %9
%11 = and i32 %10, 32767
store i32 %11, i32* %7
%12 = load i32, i32* %4
%13 = load i32, i32* %7
%14 = xor i32 %12, %13
%15 = load i32, i32* %7
%16 = mul nsw i32 %14, %15
ret i32 %16
}

LLVM IR (-O2):
define i32 @decode2(i32 %0, i32 %1, i32 %2) {
%4 = sub nsw i32 %2, %1
%5 = and i32 %4, 32767
%6 = xor i32 %5, %0
%7 = mul nsw i32 %6, %5
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ gds_swap2bytes(unsigned char *);
int /*<<< orphan*/ write(int, short *, int);
void gds_write_sref(int fd) {
  static short int count, token;
  count = 4;
  gds_swap2bytes((unsigned char *)&count);
  write(fd, &count, 2);
  token = 0x0A00;
  gds_swap2bytes((unsigned char *)&token);
  write(fd, &token, 2);
}


x86 assembly (clang, -O0):
<gds_write_sref>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movw   $0x4,0x2efe(%rip)
lea    0x2ef7(%rip),%rdi
call   1040 <gds_swap2bytes@plt>
mov    -0x4(%rbp),%edi
lea    0x2ee8(%rip),%rsi
mov    $0x2,%edx
call   1030 <write@plt>
movw   $0xa00,0x2ed7(%rip)
lea    0x2ed0(%rip),%rdi
call   1040 <gds_swap2bytes@plt>
mov    -0x4(%rbp),%edi
lea    0x2ec1(%rip),%rsi
mov    $0x2,%edx
call   1030 <write@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gds_write_sref>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
movw   $0x4,0x2f03(%rip)
lea    0x2efc(%rip),%r14
mov    %r14,%rdi
call   1040 <gds_swap2bytes@plt>
mov    %ebx,%edi
mov    %r14,%rsi
mov    $0x2,%edx
call   1030 <write@plt>
movw   $0xa00,0x2ede(%rip)
lea    0x2ed7(%rip),%r14
mov    %r14,%rdi
call   1040 <gds_swap2bytes@plt>
mov    %ebx,%edi
mov    %r14,%rsi
mov    $0x2,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <write@plt>

LLVM IR (-O0):
@gds_write_sref.count = internal global i16 0
@gds_write_sref.token = internal global i16 0
define void @gds_write_sref(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
store i16 4, i16* @gds_write_sref.count
%3 = call i32 @gds_swap2bytes(i8* bitcast (i16* @gds_write_sref.count to i8*))
%4 = load i32, i32* %2
%5 = call i32 @write(i32 %4, i16* @gds_write_sref.count, i32 2)
store i16 2560, i16* @gds_write_sref.token
%6 = call i32 @gds_swap2bytes(i8* bitcast (i16* @gds_write_sref.token to i8*))
%7 = load i32, i32* %2
%8 = call i32 @write(i32 %7, i16* @gds_write_sref.token, i32 2)
ret void
}

LLVM IR (-O2):
@gds_write_sref.count = internal global i16 0
@gds_write_sref.token = internal global i16 0
define void @gds_write_sref(i32 %0) {
store i16 4, i16* @gds_write_sref.count
%2 = tail call i32 @gds_swap2bytes(i8* bitcast (i16* @gds_write_sref.count to i8*))
%3 = tail call i32 @write(i32 %0, i16* @gds_write_sref.count, i32 2)
store i16 2560, i16* @gds_write_sref.token
%4 = tail call i32 @gds_swap2bytes(i8* bitcast (i16* @gds_write_sref.token to i8*))
%5 = tail call i32 @write(i32 %0, i16* @gds_write_sref.token, i32 2)
ret void
}
/* Type definitions */
struct sigaction {
  void (*sa_handler)(int);
  scalar_t__ sa_flags;
  int /*<<< orphan*/ sa_mask;
};

/* Variables and functions */
int /*<<< orphan*/ sigaction(int, struct sigaction *, int /*<<< orphan*/ *);
int /*<<< orphan*/ sigemptyset(int /*<<< orphan*/ *);
void signals_register(int signal, void (*handler)(int)) {
  struct sigaction signal_action;
  sigemptyset(&signal_action.sa_mask);
  signal_action.sa_flags = 0;
  signal_action.sa_handler = handler;
  sigaction(signal, &signal_action, NULL);
}


x86 assembly (clang, -O0):
<signals_register>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x28(%rbp),%rdi
add    $0x10,%rdi
call   1040 <sigemptyset@plt>
movq   $0x0,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x28(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edx
call   1030 <sigaction@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<signals_register>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0x10(%rsp),%rdi
call   1040 <sigemptyset@plt>
movq   $0x0,0x8(%rsp)
mov    %rbx,(%rsp)
mov    %rsp,%rsi
mov    %ebp,%edi
xor    %edx,%edx
call   1030 <sigaction@plt>
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.sigaction = type { void (i32)*, i64, i32 }
define void @signals_register(i32 %0, void (i32)* %1) {
%3 = alloca i32
%4 = alloca void (i32)*
%5 = alloca %struct.sigaction
store i32 %0, i32* %3
store void (i32)* %1, void (i32)** %4
%6 = getelementptr inbounds %struct.sigaction, %struct.sigaction* %5, i32 0, i32 2
%7 = call i32 @sigemptyset(i32* %6)
%8 = getelementptr inbounds %struct.sigaction, %struct.sigaction* %5, i32 0, i32 1
store i64 0, i64* %8
%9 = load void (i32)*, void (i32)** %4
%10 = getelementptr inbounds %struct.sigaction, %struct.sigaction* %5, i32 0, i32 0
store void (i32)* %9, void (i32)** %10
%11 = load i32, i32* %3
%12 = call i32 @sigaction(i32 %11, %struct.sigaction* %5, i32* null)
ret void
}

LLVM IR (-O2):
%struct.sigaction = type { void (i32)*, i64, i32 }
define void @signals_register(i32 %0, void (i32)* %1) {
%3 = alloca %struct.sigaction
%4 = bitcast %struct.sigaction* %3 to i8*
%5 = getelementptr inbounds %struct.sigaction, %struct.sigaction* %3, i64 0, i32 2
%6 = call i32 @sigemptyset(i32* %5)
%7 = getelementptr inbounds %struct.sigaction, %struct.sigaction* %3, i64 0, i32 1
store i64 0, i64* %7
%8 = getelementptr inbounds %struct.sigaction, %struct.sigaction* %3, i64 0, i32 0
store void (i32)* %1, void (i32)** %8
%9 = call i32 @sigaction(i32 %0, %struct.sigaction* %3, i32* null)
ret void
}
void simsystem(string) char *string;
{}


x86 assembly (clang, -O0):
<simsystem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<simsystem>:
ret

LLVM IR (-O0):
define void @simsystem(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
ret void
}

LLVM IR (-O2):
define void @simsystem(i8* nocapture %0) {
ret void
}
/* Variables and functions */
int japi_label(int, char *);
int j_label(int arg0, char *arg1) { return (japi_label(arg0, arg1)); }


x86 assembly (clang, -O0):
<j_label>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <japi_label@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<j_label>:
jmp    1030 <japi_label@plt>

LLVM IR (-O0):
define i32 @j_label(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
%5 = load i32, i32* %3
%6 = load i8*, i8** %4
%7 = call i32 @japi_label(i32 %5, i8* %6)
ret i32 %7
}

LLVM IR (-O2):
define i32 @j_label(i32 %0, i8* %1) {
%3 = tail call i32 @japi_label(i32 %0, i8* %1)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ handle_40(int /*<<< orphan*/);
int gen_40() {
  handle_40(0);
  return 0;
}


x86 assembly (clang, -O0):
<gen_40>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1030 <handle_40@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<gen_40>:
push   %rax
xor    %edi,%edi
call   1030 <handle_40@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @gen_40() {
%1 = call i32 @handle_40(i32 0)
ret i32 0
}

LLVM IR (-O2):
define i32 @gen_40() {
%1 = tail call i32 @handle_40(i32 0)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ uid_t;

/* Variables and functions */
int /*<<< orphan*/ ENOSYS;
int /*<<< orphan*/ __set_errno(int /*<<< orphan*/);
int __getresuid(uid_t *ruid, uid_t *euid, uid_t *suid) {
  __set_errno(ENOSYS);
  return -1;
}


x86 assembly (clang, -O0):
<__getresuid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
call   1030 <__set_errno@plt>
mov    $0xffffffff,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__getresuid>:
push   %rax
mov    0x2ed0(%rip),%rax
mov    (%rax),%edi
call   1030 <__set_errno@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
@ENOSYS = global i32 0
define i32 @__getresuid(i32* %0, i32* %1, i32* %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32*
store i32* %0, i32** %4
store i32* %1, i32** %5
store i32* %2, i32** %6
%7 = load i32, i32* @ENOSYS
%8 = call i32 @__set_errno(i32 %7)
ret i32 -1
}

LLVM IR (-O2):
@ENOSYS = global i32 0
define i32 @__getresuid(i32* nocapture readnone %0, i32* nocapture readnone %1, i32* nocapture readnone %2) {
%4 = load i32, i32* @ENOSYS
%5 = tail call i32 @__set_errno(i32 %4)
ret i32 -1
}
unsigned addval_398(unsigned x) { return x + 3232022921U; }


x86 assembly (clang, -O0):
<addval_398>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xc0a4c189,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<addval_398>:
lea    -0x3f5b3e77(%rdi),%eax
ret

LLVM IR (-O0):
define i32 @addval_398(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = add i32 %3, -1062944375
ret i32 %4
}

LLVM IR (-O2):
define i32 @addval_398(i32 %0) {
%2 = add i32 %0, -1062944375
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ assert(int /*<<< orphan*/);
char *malloc(scalar_t__);
int /*<<< orphan*/ strcpy(char *, char const *);
scalar_t__ strlen(char const *);
char *string_make_copy(const char *s) {
  assert(s != NULL);
  char *ret = malloc(strlen(s) + 1);
  strcpy(ret, s);
  return ret;
}


x86 assembly (clang, -O0):
<string_make_copy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,%rdi
add    $0x1,%rdi
call   1060 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<string_make_copy>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
xor    %edi,%edi
test   %r14,%r14
setne  %dil
call   1050 <assert@plt>
mov    %r14,%rdi
call   1040 <strlen@plt>
lea    0x1(%rax),%rdi
call   1060 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @string_make_copy(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = icmp ne i8* %4, null
%6 = zext i1 %5 to i32
%7 = call i32 @assert(i32 %6)
%8 = load i8*, i8** %2
%9 = call i64 @strlen(i8* %8)
%10 = add nsw i64 %9, 1
%11 = call i8* @malloc(i64 %10)
store i8* %11, i8** %3
%12 = load i8*, i8** %3
%13 = load i8*, i8** %2
%14 = call i32 @strcpy(i8* %12, i8* %13)
%15 = load i8*, i8** %3
ret i8* %15
}

LLVM IR (-O2):
define i8* @string_make_copy(i8* %0) {
%2 = icmp ne i8* %0, null
%3 = zext i1 %2 to i32
%4 = tail call i32 @assert(i32 %3)
%5 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%6 = add nsw i64 %5, 1
%7 = tail call i8* @malloc(i64 %6)
%8 = tail call i32 @strcpy(i8* %7, i8* %0)
ret i8* %7
}
/* Type definitions */
typedef scalar_t__ uint32_t;

/* Variables and functions */
int __semihost(int, scalar_t__ *);
scalar_t__ strlen(char const *);
int semihost_rename(const char *old_name, const char *new_name) {
  uint32_t args[4];
  args[0] = (uint32_t)old_name;
  args[1] = (uint32_t)strlen(old_name);
  args[0] = (uint32_t)new_name;
  args[1] = (uint32_t)strlen(new_name);
  return __semihost((0xf), args);
}


x86 assembly (clang, -O0):
<semihost_rename>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x28(%rbp)
lea    -0x30(%rbp),%rsi
mov    $0xf,%edi
call   1040 <__semihost@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<semihost_rename>:
sub    $0x28,%rsp
mov    %rsi,%rdi
mov    %rsi,(%rsp)
call   1030 <strlen@plt>
mov    %rax,0x8(%rsp)
mov    %rsp,%rsi
mov    $0xf,%edi
call   1040 <__semihost@plt>
add    $0x28,%rsp
ret

LLVM IR (-O0):
define i32 @semihost_rename(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca [4 x i64]
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %3
%7 = ptrtoint i8* %6 to i64
%8 = getelementptr inbounds [4 x i64], [4 x i64]* %5, i64 0, i64 0
store i64 %7, i64* %8
%9 = load i8*, i8** %3
%10 = call i64 @strlen(i8* %9)
%11 = getelementptr inbounds [4 x i64], [4 x i64]* %5, i64 0, i64 1
store i64 %10, i64* %11
%12 = load i8*, i8** %4
%13 = ptrtoint i8* %12 to i64
%14 = getelementptr inbounds [4 x i64], [4 x i64]* %5, i64 0, i64 0
store i64 %13, i64* %14
%15 = load i8*, i8** %4
%16 = call i64 @strlen(i8* %15)
%17 = getelementptr inbounds [4 x i64], [4 x i64]* %5, i64 0, i64 1
store i64 %16, i64* %17
%18 = getelementptr inbounds [4 x i64], [4 x i64]* %5, i64 0, i64 0
%19 = call i32 @__semihost(i32 15, i64* %18)
ret i32 %19
}

LLVM IR (-O2):
define i32 @semihost_rename(i8* %0, i8* %1) {
%3 = alloca [4 x i64]
%4 = bitcast [4 x i64]* %3 to i8*
%5 = getelementptr inbounds [4 x i64], [4 x i64]* %3, i64 0, i64 0
%6 = getelementptr inbounds [4 x i64], [4 x i64]* %3, i64 0, i64 1
%7 = ptrtoint i8* %1 to i64
store i64 %7, i64* %5
%8 = tail call i64 @strlen(i8* dereferenceable(1) %1)
store i64 %8, i64* %6
%9 = call i32 @__semihost(i32 15, i64* %5)
ret i32 %9
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
uint32_t _rand_next_xorshift32(unsigned *s) {
  *s ^= *s << 5;
  *s ^= *s >> 9;
  *s ^= *s << 28;
  return (uint32_t)*s;
}


x86 assembly (clang, -O0):
<_rand_next_xorshift32>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%ecx
shl    $0x5,%ecx
mov    -0x8(%rbp),%rax
xor    (%rax),%ecx
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%ecx
shr    $0x9,%ecx
mov    -0x8(%rbp),%rax
xor    (%rax),%ecx
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%ecx
shl    $0x1c,%ecx
mov    -0x8(%rbp),%rax
xor    (%rax),%ecx
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_rand_next_xorshift32>:
mov    (%rdi),%eax
mov    %eax,%ecx
shl    $0x5,%ecx
xor    %eax,%ecx
mov    %ecx,%edx
shr    $0x9,%edx
xor    %ecx,%edx
mov    %edx,%eax
shl    $0x1c,%eax
xor    %edx,%eax
mov    %eax,(%rdi)
ret

LLVM IR (-O0):
define i32 @_rand_next_xorshift32(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = load i32, i32* %3
%5 = shl i32 %4, 5
%6 = load i32*, i32** %2
%7 = load i32, i32* %6
%8 = xor i32 %7, %5
store i32 %8, i32* %6
%9 = load i32*, i32** %2
%10 = load i32, i32* %9
%11 = lshr i32 %10, 9
%12 = load i32*, i32** %2
%13 = load i32, i32* %12
%14 = xor i32 %13, %11
store i32 %14, i32* %12
%15 = load i32*, i32** %2
%16 = load i32, i32* %15
%17 = shl i32 %16, 28
%18 = load i32*, i32** %2
%19 = load i32, i32* %18
%20 = xor i32 %19, %17
store i32 %20, i32* %18
%21 = load i32*, i32** %2
%22 = load i32, i32* %21
ret i32 %22
}

LLVM IR (-O2):
define i32 @_rand_next_xorshift32(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = shl i32 %2, 5
%4 = xor i32 %3, %2
%5 = lshr i32 %4, 9
%6 = xor i32 %5, %4
%7 = shl i32 %6, 28
%8 = xor i32 %7, %6
store i32 %8, i32* %0
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ make_error(char *);
void level() {
  char *level_name __attribute__((unused)) = "level name";
  make_error("called from level");
}


x86 assembly (clang, -O0):
<level>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rax
mov    %rax,-0x8(%rbp)
lea    0xee1(%rip),%rdi
call   1030 <make_error@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<level>:
lea    0xee9(%rip),%rdi
jmp    1030 <make_error@plt>

LLVM IR (-O0):
@.str = [11 x i8] c"level name\00"
@.str.1 = [18 x i8] c"called from level\00"
define void @level() {
%1 = alloca i8*
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8** %1
%2 = call i32 @make_error(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str.1 = [18 x i8] c"called from level\00"
define void @level() {
%1 = tail call i32 @make_error(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ die(char *, char *);
void __attribute__((noreturn)) usage(char *argv0) {
  die("Usage: %s mapdb keyring src-hdkdir dst-hdkdir chunks-per-dir", argv0);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xed9(%rip),%rdi
call   1030 <die@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
mov    %rdi,%rsi
lea    0xee5(%rip),%rdi
call   1030 <die@plt>

LLVM IR (-O0):
@.str = [61 x i8] c"Usage: %s mapdb keyring src-hdkdir dst-hdkdir chunks-per-dir\00"
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @die(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str, i64 0, i64 0), i8* %3)
unreachable
}

LLVM IR (-O2):
@.str = [61 x i8] c"Usage: %s mapdb keyring src-hdkdir dst-hdkdir chunks-per-dir\00"
define void @usage(i8* %0) {
%2 = tail call i32 @die(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str, i64 0, i64 0), i8* %0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ srand(unsigned int);
scalar_t__ time(int /*<<< orphan*/ *);
void init() { srand((unsigned int)time(NULL)); }


x86 assembly (clang, -O0):
<init>:
push   %rbp
mov    %rsp,%rbp
xor    %eax,%eax
mov    %eax,%edi
call   1040 <time@plt>
mov    %eax,%edi
call   1030 <srand@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<init>:
push   %rax
xor    %edi,%edi
call   1040 <time@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <srand@plt>

LLVM IR (-O0):
define void @init() {
%1 = call i64 @time(i32* null)
%2 = trunc i64 %1 to i32
%3 = call i32 @srand(i32 %2)
ret void
}

LLVM IR (-O2):
define void @init() {
%1 = tail call i64 @time(i32* null)
%2 = trunc i64 %1 to i32
%3 = tail call i32 @srand(i32 %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ grava_li(int, char *);
void rot9_sem() { grava_li(1, "$IF"); }


x86 assembly (clang, -O0):
<rot9_sem>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
lea    0xee0(%rip),%rsi
call   1030 <grava_li@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<rot9_sem>:
lea    0xee9(%rip),%rsi
mov    $0x1,%edi
jmp    1030 <grava_li@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"$IF\00"
define void @rot9_sem() {
%1 = call i32 @grava_li(i32 1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"$IF\00"
define void @rot9_sem() {
%1 = tail call i32 @grava_li(i32 1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int posix_memalign(void **, int, size_t);
int /*<<< orphan*/ stderr;
void *xmalloc(size_t num) {
  void *cur = NULL;
  int ret = posix_memalign(&cur, 32, num);
  if (!cur || ret) {
    fprintf(stderr, "[PolyBench] posix_memalign: cannot allocate memory");
    exit(1);
  }
  return cur;
}


x86 assembly (clang, -O0):
<xmalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rdx
lea    -0x10(%rbp),%rdi
mov    $0x20,%esi
call   1050 <posix_memalign@plt>
mov    %eax,-0x14(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     116e <xmalloc+0x3e>
cmpl   $0x0,-0x14(%rbp)
je     118d <xmalloc+0x5d>
mov    0x2e6b(%rip),%rax
mov    (%rax),%edi
lea    0xe82(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xmalloc>:
push   %rax
mov    %rdi,%rdx
movq   $0x0,(%rsp)
mov    %rsp,%rdi
mov    $0x20,%esi
call   1050 <posix_memalign@plt>
mov    %eax,%ecx
mov    (%rsp),%rax
test   %rax,%rax
je     115a <xmalloc+0x2a>
test   %ecx,%ecx
jne    115a <xmalloc+0x2a>
pop    %rcx
ret
mov    0x2e7f(%rip),%rax
mov    (%rax),%edi
lea    0xe96(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [51 x i8] c"[PolyBench] posix_memalign: cannot allocate memory\00"
define i8* @xmalloc(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
%4 = alloca i32
store i64 %0, i64* %2
store i8* null, i8** %3
%5 = load i64, i64* %2
%6 = call i32 @posix_memalign(i8** %3, i32 32, i64 %5)
store i32 %6, i32* %4
%7 = load i8*, i8** %3
%8 = icmp ne i8* %7, null
br i1 %8, label %9, label %12
9: ; preds = %1
%10 = load i32, i32* %4
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %16
12: ; preds = %9, %1
%13 = load i32, i32* @stderr
%14 = call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0))
%15 = call i32 @exit(i32 1)
unreachable
16: ; preds = %9
%17 = load i8*, i8** %3
ret i8* %17
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [51 x i8] c"[PolyBench] posix_memalign: cannot allocate memory\00"
define i8* @xmalloc(i64 %0) {
%2 = alloca i8*
%3 = bitcast i8** %2 to i8*
store i8* null, i8** %2
%4 = call i32 @posix_memalign(i8** %2, i32 32, i64 %0)
%5 = load i8*, i8** %2
%6 = icmp eq i8* %5, null
%7 = icmp ne i32 %4, 0
%8 = select i1 %6, i1 true, i1 %7
br i1 %8, label %9, label %13
9: ; preds = %1
%10 = load i32, i32* @stderr
%11 = call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0))
%12 = call i32 @exit(i32 1)
unreachable
13: ; preds = %1
ret i8* %5
}
void Change_Endianness(long *src) {
  int little_endian;
  little_endian = Check_CPU();
  if (little_endian)
    return;
  unsigned char str[4], string[4];
  memcpy(str, src, 4);
  int t, s;
  for (t = 0, s = 3; t < 4; t++) {
    string[t] = str[s];
    s--;
  }
  memcpy(src, string, 4);
}


x86 assembly (clang, -O0):
<Change_Endianness>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1030 <Check_CPU@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1135 <Change_Endianness+0x25>
jmp    1186 <Change_Endianness+0x76>
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x3,-0x1c(%rbp)
cmpl   $0x4,-0x18(%rbp)
jge    117d <Change_Endianness+0x6d>
movslq -0x1c(%rbp),%rax
mov    -0x10(%rbp,%rax,1),%cl
movslq -0x18(%rbp),%rax
mov    %cl,-0x14(%rbp,%rax,1)
mov    -0x1c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    114c <Change_Endianness+0x3c>
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
mov    %ecx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Change_Endianness>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1030 <Check_CPU@plt>
test   %eax,%eax
je     1121 <Change_Endianness+0x11>
pop    %rbx
ret
mov    (%rbx),%eax
bswap  %eax
mov    %eax,(%rbx)
pop    %rbx
ret

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

LLVM IR (-O2):
define void @Change_Endianness(i64* nocapture %0) {
%2 = tail call i32 (...) @Check_CPU()
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = bitcast i64* %0 to i32*
%6 = load i32, i32* %5
%7 = call i32 @llvm.bswap.i32(i32 %6)
store i32 %7, i32* %5
br label %8
8: ; preds = %1, %4
ret void
}
/* Variables and functions */
void const *GppcFinfoV1();
const void *pg_finfo_int8plusfunc(void) { return GppcFinfoV1(); }


x86 assembly (clang, -O0):
<pg_finfo_int8plusfunc>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <GppcFinfoV1@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<pg_finfo_int8plusfunc>:
xor    %eax,%eax
jmp    1030 <GppcFinfoV1@plt>

LLVM IR (-O0):
define i8* @pg_finfo_int8plusfunc() {
%1 = call i8* (...) @GppcFinfoV1()
ret i8* %1
}

LLVM IR (-O2):
define i8* @pg_finfo_int8plusfunc() {
%1 = tail call i8* (...) @GppcFinfoV1()
ret i8* %1
}
/* Type definitions */
typedef int uint64_t;
struct timeval {
  int tv_sec;
  int tv_usec;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
uint64_t pd_get_timestamp() {
  struct timeval now;
  gettimeofday(&now, NULL);
  return (now.tv_sec * 1000 + now.tv_usec / 1000);
}


x86 assembly (clang, -O0):
<pd_get_timestamp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x8(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <gettimeofday@plt>
imul   $0x3e8,-0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
add    %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pd_get_timestamp>:
push   %rax
mov    %rsp,%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
imul   $0x3e8,(%rsp),%ecx
movslq 0x4(%rsp),%rax
imul   $0x10624dd3,%rax,%rax
mov    %rax,%rdx
shr    $0x3f,%rdx
sar    $0x26,%rax
add    %edx,%eax
add    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.timeval = type { i32, i32 }
define i32 @pd_get_timestamp() {
%1 = alloca %struct.timeval
%2 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%3 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 0
%4 = load i32, i32* %3
%5 = mul nsw i32 %4, 1000
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 1
%7 = load i32, i32* %6
%8 = sdiv i32 %7, 1000
%9 = add nsw i32 %5, %8
ret i32 %9
}

LLVM IR (-O2):
%struct.timeval = type { i32, i32 }
define i32 @pd_get_timestamp() {
%1 = alloca %struct.timeval
%2 = bitcast %struct.timeval* %1 to i8*
%3 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%5 = load i32, i32* %4
%6 = mul nsw i32 %5, 1000
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%8 = load i32, i32* %7
%9 = sdiv i32 %8, 1000
%10 = add nsw i32 %9, %6
ret i32 %10
}
/* Variables and functions */
int Pop();
int /*<<< orphan*/ Push(int);
int CmdRShift(void) {
  int operand2;
  operand2 = Pop();
  Push(Pop() >> operand2);
  return 0;
}


x86 assembly (clang, -O0):
<CmdRShift>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <Pop@plt>
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1030 <Pop@plt>
mov    %eax,%edi
mov    -0x4(%rbp),%ecx
sar    %cl,%edi
call   1040 <Push@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CmdRShift>:
push   %rbx
xor    %eax,%eax
call   1030 <Pop@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1030 <Pop@plt>
mov    %ebx,%ecx
sar    %cl,%eax
mov    %eax,%edi
call   1040 <Push@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @CmdRShift() {
%1 = alloca i32
%2 = call i32 (...) @Pop()
store i32 %2, i32* %1
%3 = call i32 (...) @Pop()
%4 = load i32, i32* %1
%5 = ashr i32 %3, %4
%6 = call i32 @Push(i32 %5)
ret i32 0
}

LLVM IR (-O2):
define i32 @CmdRShift() {
%1 = tail call i32 (...) @Pop()
%2 = tail call i32 (...) @Pop()
%3 = ashr i32 %2, %1
%4 = tail call i32 @Push(i32 %3)
ret i32 0
}
void threshold_by_comparison_2_Bad() {
  int arr[50];
  int j = 0;
  while (1) {
    j++;
    if (j == 100) {
      j = 0;
    }
    arr[j] = 0;
  }
}


x86 assembly (clang, -O0):
<threshold_by_comparison_2_Bad>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0xd4(%rbp)
mov    -0xd4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xd4(%rbp)
cmpl   $0x64,-0xd4(%rbp)
jne    1138 <threshold_by_comparison_2_Bad+0x38>
movl   $0x0,-0xd4(%rbp)
movslq -0xd4(%rbp),%rax
movl   $0x0,-0xd0(%rbp,%rax,4)
jmp    1112 <threshold_by_comparison_2_Bad+0x12>

x86 assembly (clang, -O2):
<threshold_by_comparison_2_Bad>:
jmp    1100 <threshold_by_comparison_2_Bad>

LLVM IR (-O0):
define void @threshold_by_comparison_2_Bad() {
%1 = alloca [50 x i32]
%2 = alloca i32
store i32 0, i32* %2
br label %3
3: ; preds = %0, %9
%4 = load i32, i32* %2
%5 = add nsw i32 %4, 1
store i32 %5, i32* %2
%6 = load i32, i32* %2
%7 = icmp eq i32 %6, 100
br i1 %7, label %8, label %9
8: ; preds = %3
store i32 0, i32* %2
br label %9
9: ; preds = %8, %3
%10 = load i32, i32* %2
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [50 x i32], [50 x i32]* %1, i64 0, i64 %11
store i32 0, i32* %12
br label %3
}

LLVM IR (-O2):
define void @threshold_by_comparison_2_Bad() {
br label %1
1: ; preds = %1, %0
br label %1
}
/* Variables and functions */
int /*<<< orphan*/ delay_ms(int);
void espera() { delay_ms(100); }


x86 assembly (clang, -O0):
<espera>:
push   %rbp
mov    %rsp,%rbp
mov    $0x64,%edi
call   1030 <delay_ms@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<espera>:
mov    $0x64,%edi
jmp    1030 <delay_ms@plt>

LLVM IR (-O0):
define void @espera() {
%1 = call i32 @delay_ms(i32 100)
ret void
}

LLVM IR (-O2):
define void @espera() {
%1 = tail call i32 @delay_ms(i32 100)
ret void
}
/* Variables and functions */
scalar_t__ isalnum(char);
bool prs_idchar(char c) {
  return isalnum(c) || c == '_' || c == '.' || c == '$' || c == '@';
}


x86 assembly (clang, -O0):
<prs_idchar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edi
call   1030 <isalnum@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0x2(%rbp)
jne    117c <prs_idchar+0x6c>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x5f,%ecx
mov    %al,-0x2(%rbp)
je     117c <prs_idchar+0x6c>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x2e,%ecx
mov    %al,-0x2(%rbp)
je     117c <prs_idchar+0x6c>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x24,%ecx
mov    %al,-0x2(%rbp)
je     117c <prs_idchar+0x6c>
movsbl -0x1(%rbp),%eax
cmp    $0x40,%eax
sete   %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<prs_idchar>:
push   %rbx
mov    %edi,%ebx
call   1030 <isalnum@plt>
mov    %rax,%rcx
mov    $0x1,%eax
test   %rcx,%rcx
je     1127 <prs_idchar+0x17>
pop    %rbx
ret
lea    -0x24(%rbx),%ecx
cmp    $0x3b,%cl
ja     1142 <prs_idchar+0x32>
movzbl %cl,%ecx
movabs $0x800000000000401,%rdx
bt     %rcx,%rdx
jb     1125 <prs_idchar+0x15>
xor    %eax,%eax
cmp    $0x40,%bl
sete   %al
pop    %rbx
ret

LLVM IR (-O0):
define i32 @prs_idchar(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = call i64 @isalnum(i8 signext %3)
%5 = icmp ne i64 %4, 0
br i1 %5, label %22, label %6
6: ; preds = %1
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp eq i32 %8, 95
br i1 %9, label %22, label %10
10: ; preds = %6
%11 = load i8, i8* %2
%12 = sext i8 %11 to i32
%13 = icmp eq i32 %12, 46
br i1 %13, label %22, label %14
14: ; preds = %10
%15 = load i8, i8* %2
%16 = sext i8 %15 to i32
%17 = icmp eq i32 %16, 36
br i1 %17, label %22, label %18
18: ; preds = %14
%19 = load i8, i8* %2
%20 = sext i8 %19 to i32
%21 = icmp eq i32 %20, 64
br label %22
22: ; preds = %18, %14, %10, %6, %1
%23 = phi i1 [ true, %14 ], [ true, %10 ], [ true, %6 ], [ true, %1 ], [ %21, %18 ]
%24 = zext i1 %23 to i32
ret i32 %24
}

LLVM IR (-O2):
define i32 @prs_idchar(i8 signext %0) {
%2 = tail call i64 @isalnum(i8 signext %0)
%3 = freeze i64 %2
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %9
5: ; preds = %1
switch i8 %0, label %6 [
i8 95, label %9
i8 46, label %9
i8 36, label %9
]
6: ; preds = %5
%7 = icmp eq i8 %0, 64
%8 = zext i1 %7 to i32
br label %9
9: ; preds = %5, %5, %5, %1, %6
%10 = phi i32 [ 1, %5 ], [ %8, %6 ], [ 1, %1 ], [ 1, %5 ], [ 1, %5 ]
ret i32 %10
}
void RTPrintf(void) {}


x86 assembly (clang, -O0):
<RTPrintf>:
push   %rbp
mov    %rsp,%rbp
pop    %rbp
ret

x86 assembly (clang, -O2):
<RTPrintf>:
ret

LLVM IR (-O0):
define void @RTPrintf() {
ret void
}

LLVM IR (-O2):
define void @RTPrintf() {
ret void
}
int myfunc2(int input) {
  if (input == 3)
    return input + 3;
  else
    return 0;
}


x86 assembly (clang, -O0):
<myfunc2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x3,-0x8(%rbp)
jne    111f <myfunc2+0x1f>
mov    -0x8(%rbp),%eax
add    $0x3,%eax
mov    %eax,-0x4(%rbp)
jmp    1126 <myfunc2+0x26>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<myfunc2>:
xor    %ecx,%ecx
cmp    $0x3,%edi
mov    $0x6,%eax
cmovne %ecx,%eax
ret

LLVM IR (-O0):
define i32 @myfunc2(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp eq i32 %4, 3
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load i32, i32* %3
%8 = add nsw i32 %7, 3
store i32 %8, i32* %2
br label %10
9: ; preds = %1
store i32 0, i32* %2
br label %10
10: ; preds = %9, %6
%11 = load i32, i32* %2
ret i32 %11
}

LLVM IR (-O2):
define i32 @myfunc2(i32 %0) {
%2 = icmp eq i32 %0, 3
%3 = select i1 %2, i32 6, i32 0
ret i32 %3
}
IR0IR1(r0, r1, x0, x1, p0, p1) float r0, r1;
float *p0, *p1;
{ (*p0) = (*p1); }


x86 assembly (clang, -O0):
<IR0IR1>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm1,-0x30(%rbp)
movaps %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
cvtsd2ss %xmm1,%xmm1
cvtsd2ss %xmm0,%xmm0
movss  %xmm1,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
mov    %edi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    -0x28(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x20(%rbp),%rax
movss  %xmm0,(%rax)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<IR0IR1>:
movss  (%rcx),%xmm0
movss  %xmm0,(%rdx)
ret

LLVM IR (-O0):
define i32 @IR0IR1(double %0, double %1, i32 %2, i32 %3, float* %4, float* %5) {
%7 = alloca i32
%8 = alloca float
%9 = alloca float
%10 = alloca i32
%11 = alloca i32
%12 = alloca float*
%13 = alloca float*
%14 = fptrunc double %0 to float
%15 = fptrunc double %1 to float
store float %14, float* %8
store float %15, float* %9
store i32 %2, i32* %10
store i32 %3, i32* %11
store float* %4, float** %12
store float* %5, float** %13
%16 = load float*, float** %13
%17 = load float, float* %16
%18 = load float*, float** %12
store float %17, float* %18
%19 = load i32, i32* %7
ret i32 %19
}

LLVM IR (-O2):
define i32 @IR0IR1(double %0, double %1, i32 %2, i32 %3, float* nocapture writeonly %4, float* nocapture %5) {
%7 = load float, float* %5
store float %7, float* %4
ret i32 undef
}
int aa_opt_is_bound(int lb, int ub) { return lb && ub; }


x86 assembly (clang, -O0):
<aa_opt_is_bound>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x4(%rbp)
mov    %al,-0x9(%rbp)
je     1123 <aa_opt_is_bound+0x23>
cmpl   $0x0,-0x8(%rbp)
setne  %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<aa_opt_is_bound>:
test   %edi,%edi
setne  %al
test   %esi,%esi
setne  %cl
and    %al,%cl
movzbl %cl,%eax
ret

LLVM IR (-O0):
define i32 @aa_opt_is_bound(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %2
%8 = load i32, i32* %4
%9 = icmp ne i32 %8, 0
br label %10
10: ; preds = %7, %2
%11 = phi i1 [ false, %2 ], [ %9, %7 ]
%12 = zext i1 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
define i32 @aa_opt_is_bound(i32 %0, i32 %1) {
%3 = icmp ne i32 %0, 0
%4 = icmp ne i32 %1, 0
%5 = and i1 %3, %4
%6 = zext i1 %5 to i32
ret i32 %6
}
unsigned int wav_srate2blocksize(unsigned int srate) {
  if (srate < 12000)
    return 256;
  if (srate < 23000)
    return 512;
  return 1024;
}


x86 assembly (clang, -O0):
<wav_srate2blocksize>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x2ee0,-0x8(%rbp)
jae    1120 <wav_srate2blocksize+0x20>
movl   $0x100,-0x4(%rbp)
jmp    1140 <wav_srate2blocksize+0x40>
cmpl   $0x59d8,-0x8(%rbp)
jae    1139 <wav_srate2blocksize+0x39>
movl   $0x200,-0x4(%rbp)
jmp    1140 <wav_srate2blocksize+0x40>
movl   $0x400,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<wav_srate2blocksize>:
xor    %ecx,%ecx
cmp    $0x59d8,%edi
setae  %cl
shl    $0x9,%ecx
add    $0x200,%ecx
cmp    $0x2ee0,%edi
mov    $0x100,%eax
cmovae %ecx,%eax
ret

LLVM IR (-O0):
define i32 @wav_srate2blocksize(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp ult i32 %4, 12000
br i1 %5, label %6, label %7
6: ; preds = %1
store i32 256, i32* %2
br label %12
7: ; preds = %1
%8 = load i32, i32* %3
%9 = icmp ult i32 %8, 23000
br i1 %9, label %10, label %11
10: ; preds = %7
store i32 512, i32* %2
br label %12
11: ; preds = %7
store i32 1024, i32* %2
br label %12
12: ; preds = %11, %10, %6
%13 = load i32, i32* %2
ret i32 %13
}

LLVM IR (-O2):
define i32 @wav_srate2blocksize(i32 %0) {
%2 = icmp ult i32 %0, 12000
%3 = icmp ult i32 %0, 23000
%4 = select i1 %3, i32 512, i32 1024
%5 = select i1 %2, i32 256, i32 %4
ret i32 %5
}
/* Variables and functions */
int atoi_eol(char const *, char);
int htoi_eol(char const *, char);
int xtoi_eol(const char *str, char eol) {
  if (str[0] == '0' && str[1] == 'x')
    return htoi_eol(str + 2, eol);
  return atoi_eol(str, eol);
}


x86 assembly (clang, -O0):
<xtoi_eol>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %sil,%al
mov    %rdi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x30,%eax
jne    116c <xtoi_eol+0x4c>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x78,%eax
jne    116c <xtoi_eol+0x4c>
mov    -0x10(%rbp),%rdi
add    $0x2,%rdi
movsbl -0x11(%rbp),%esi
call   1040 <htoi_eol@plt>
mov    %eax,-0x4(%rbp)
jmp    117c <xtoi_eol+0x5c>
mov    -0x10(%rbp),%rdi
movsbl -0x11(%rbp),%esi
call   1030 <atoi_eol@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xtoi_eol>:
cmpb   $0x30,(%rdi)
jne    1138 <xtoi_eol+0x18>
cmpb   $0x78,0x1(%rdi)
jne    1138 <xtoi_eol+0x18>
add    $0x2,%rdi
movsbl %sil,%esi
jmp    1040 <htoi_eol@plt>
movsbl %sil,%esi
jmp    1030 <atoi_eol@plt>

LLVM IR (-O0):
define i32 @xtoi_eol(i8* %0, i8 signext %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8
store i8* %0, i8** %4
store i8 %1, i8* %5
%6 = load i8*, i8** %4
%7 = getelementptr inbounds i8, i8* %6, i64 0
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
%10 = icmp eq i32 %9, 48
br i1 %10, label %11, label %22
11: ; preds = %2
%12 = load i8*, i8** %4
%13 = getelementptr inbounds i8, i8* %12, i64 1
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = icmp eq i32 %15, 120
br i1 %16, label %17, label %22
17: ; preds = %11
%18 = load i8*, i8** %4
%19 = getelementptr inbounds i8, i8* %18, i64 2
%20 = load i8, i8* %5
%21 = call i32 @htoi_eol(i8* %19, i8 signext %20)
store i32 %21, i32* %3
br label %26
22: ; preds = %11, %2
%23 = load i8*, i8** %4
%24 = load i8, i8* %5
%25 = call i32 @atoi_eol(i8* %23, i8 signext %24)
store i32 %25, i32* %3
br label %26
26: ; preds = %22, %17
%27 = load i32, i32* %3
ret i32 %27
}

LLVM IR (-O2):
define i32 @xtoi_eol(i8* %0, i8 signext %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 48
br i1 %4, label %5, label %12
5: ; preds = %2
%6 = getelementptr inbounds i8, i8* %0, i64 1
%7 = load i8, i8* %6
%8 = icmp eq i8 %7, 120
br i1 %8, label %9, label %12
9: ; preds = %5
%10 = getelementptr inbounds i8, i8* %0, i64 2
%11 = tail call i32 @htoi_eol(i8* %10, i8 signext %1)
br label %14
12: ; preds = %5, %2
%13 = tail call i32 @atoi_eol(i8* %0, i8 signext %1)
br label %14
14: ; preds = %12, %9
%15 = phi i32 [ %11, %9 ], [ %13, %12 ]
ret i32 %15
}
/* Variables and functions */
int /*<<< orphan*/ test_dct();
int main(void) { test_dct(); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <test_dct@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <test_dct@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 (...) @test_dct()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @test_dct()
ret i32 0
}
int bar(int a) {
  int add0 = a + 1;
  int add1 = a + 1;
  int sub = add0 - add1;
  return sub;
}


x86 assembly (clang, -O0):
<bar>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
sub    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bar>:
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @bar(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %2
%6 = load i32, i32* %2
%7 = add nsw i32 %6, 1
store i32 %7, i32* %3
%8 = load i32, i32* %2
%9 = add nsw i32 %8, 1
store i32 %9, i32* %4
%10 = load i32, i32* %3
%11 = load i32, i32* %4
%12 = sub nsw i32 %10, %11
store i32 %12, i32* %5
%13 = load i32, i32* %5
ret i32 %13
}

LLVM IR (-O2):
define i32 @bar(i32 %0) {
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int /*<<< orphan*/ pixel_avg_weight_wxh(int /*<<< orphan*/ *, int,
                                        int /*<<< orphan*/ *, int, int, int,
                                        int);
void pixel_avg_weight_8x16(uint8_t *pix1, int i_stride_pix1, uint8_t *pix2,
                           int i_stride_pix2, int i_weight1) {
  pixel_avg_weight_wxh(pix1, i_stride_pix1, pix2, i_stride_pix2, 8, 16,
                       i_weight1);
}


x86 assembly (clang, -O0):
<pixel_avg_weight_8x16>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
mov    -0x20(%rbp),%eax
mov    $0x8,%r8d
mov    $0x10,%r9d
mov    %eax,(%rsp)
call   1030 <pixel_avg_weight_wxh@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pixel_avg_weight_8x16>:
push   %rax
mov    %r8d,(%rsp)
mov    $0x8,%r8d
mov    $0x10,%r9d
call   1030 <pixel_avg_weight_wxh@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @pixel_avg_weight_8x16(i32* %0, i32 %1, i32* %2, i32 %3, i32 %4) {
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32*
%9 = alloca i32
%10 = alloca i32
store i32* %0, i32** %6
store i32 %1, i32* %7
store i32* %2, i32** %8
store i32 %3, i32* %9
store i32 %4, i32* %10
%11 = load i32*, i32** %6
%12 = load i32, i32* %7
%13 = load i32*, i32** %8
%14 = load i32, i32* %9
%15 = load i32, i32* %10
%16 = call i32 @pixel_avg_weight_wxh(i32* %11, i32 %12, i32* %13, i32 %14, i32 8, i32 16, i32 %15)
ret void
}

LLVM IR (-O2):
define void @pixel_avg_weight_8x16(i32* %0, i32 %1, i32* %2, i32 %3, i32 %4) {
%6 = tail call i32 @pixel_avg_weight_wxh(i32* %0, i32 %1, i32* %2, i32 %3, i32 8, i32 16, i32 %4)
ret void
}