xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ RTLD_LAZY;
void *dlopen(int /*<<< orphan*/ *, int /*<<< orphan*/);
void *dlsym(void *, char const *);
void *getsym(const char *sym) {
  void *dlh = dlopen(NULL, RTLD_LAZY);
  if (!dlh) {
    return NULL;
  }
  return dlsym(dlh, sym);
}


x86 assembly (clang, -O0):
<getsym>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%esi
xor    %eax,%eax
mov    %eax,%edi
call   1030 <dlopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    115a <getsym+0x3a>
movq   $0x0,-0x8(%rbp)
jmp    116b <getsym+0x4b>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <dlsym@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getsym>:
push   %rbx
mov    %rdi,%rbx
mov    0x2eb5(%rip),%rax
mov    (%rax),%esi
xor    %edi,%edi
call   1030 <dlopen@plt>
test   %rax,%rax
je     1145 <getsym+0x25>
mov    %rax,%rdi
mov    %rbx,%rsi
pop    %rbx
jmp    1040 <dlsym@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@RTLD_LAZY = global i32 0
define i8* @getsym(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
%5 = load i32, i32* @RTLD_LAZY
%6 = call i8* @dlopen(i32* null, i32 %5)
store i8* %6, i8** %4
%7 = load i8*, i8** %4
%8 = icmp ne i8* %7, null
br i1 %8, label %10, label %9
9: ; preds = %1
store i8* null, i8** %2
br label %14
10: ; preds = %1
%11 = load i8*, i8** %4
%12 = load i8*, i8** %3
%13 = call i8* @dlsym(i8* %11, i8* %12)
store i8* %13, i8** %2
br label %14
14: ; preds = %10, %9
%15 = load i8*, i8** %2
ret i8* %15
}

LLVM IR (-O2):
@RTLD_LAZY = global i32 0
define i8* @getsym(i8* %0) {
%2 = load i32, i32* @RTLD_LAZY
%3 = tail call i8* @dlopen(i32* null, i32 %2)
%4 = icmp eq i8* %3, null
br i1 %4, label %7, label %5
5: ; preds = %1
%6 = tail call i8* @dlsym(i8* %3, i8* %0)
br label %7
7: ; preds = %1, %5
%8 = phi i8* [ %6, %5 ], [ null, %1 ]
ret i8* %8
}
/* Variables and functions */
int check_arg_count(int, int);
int /*<<< orphan*/ report_count(int);
int /*<<< orphan*/ report_error(char *);
void cmd_vline_set(int nargs, char **args) {
  if (check_arg_count(nargs, 1) == 1)
    return;
  report_count(1);
  report_error("UNSUPPORTED");
}


x86 assembly (clang, -O0):
<cmd_vline_set>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x1,%esi
call   1030 <check_arg_count@plt>
cmp    $0x1,%eax
jne    115a <cmd_vline_set+0x2a>
jmp    1170 <cmd_vline_set+0x40>
mov    $0x1,%edi
call   1040 <report_count@plt>
lea    0xe95(%rip),%rdi
call   1050 <report_error@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmd_vline_set>:
push   %rax
mov    $0x1,%esi
call   1030 <check_arg_count@plt>
cmp    $0x1,%eax
jne    1142 <cmd_vline_set+0x12>
pop    %rax
ret
mov    $0x1,%edi
call   1040 <report_count@plt>
lea    0xead(%rip),%rdi
pop    %rax
jmp    1050 <report_error@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"UNSUPPORTED\00"
define void @cmd_vline_set(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 = call i32 @check_arg_count(i32 %5, i32 1)
%7 = icmp eq i32 %6, 1
br i1 %7, label %8, label %9
8: ; preds = %2
br label %12
9: ; preds = %2
%10 = call i32 @report_count(i32 1)
%11 = call i32 @report_error(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
br label %12
12: ; preds = %9, %8
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"UNSUPPORTED\00"
define void @cmd_vline_set(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @check_arg_count(i32 %0, i32 1)
%4 = icmp eq i32 %3, 1
br i1 %4, label %8, label %5
5: ; preds = %2
%6 = tail call i32 @report_count(i32 1)
%7 = tail call i32 @report_error(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %2, %5
ret void
}
/* Variables and functions */
int /*<<< orphan*/ close(int);
int dup2(int, int);
int spx_stdio_restore(int fd, int copy) {
  if (dup2(copy, fd) == -1) {
    return -1;
  }
  close(copy);
  return fd;
}


x86 assembly (clang, -O0):
<spx_stdio_restore>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <dup2@plt>
cmp    $0xffffffff,%eax
jne    114e <spx_stdio_restore+0x2e>
movl   $0xffffffff,-0x4(%rbp)
jmp    115c <spx_stdio_restore+0x3c>
mov    -0xc(%rbp),%edi
call   1040 <close@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<spx_stdio_restore>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %edi,%ebx
mov    %esi,%edi
mov    %ebx,%esi
call   1030 <dup2@plt>
cmp    $0xffffffff,%eax
je     113e <spx_stdio_restore+0x1e>
mov    %ebp,%edi
call   1040 <close@plt>
jmp    1143 <spx_stdio_restore+0x23>
mov    $0xffffffff,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @spx_stdio_restore(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%6 = load i32, i32* %5
%7 = load i32, i32* %4
%8 = call i32 @dup2(i32 %6, i32 %7)
%9 = icmp eq i32 %8, -1
br i1 %9, label %10, label %11
10: ; preds = %2
store i32 -1, i32* %3
br label %15
11: ; preds = %2
%12 = load i32, i32* %5
%13 = call i32 @close(i32 %12)
%14 = load i32, i32* %4
store i32 %14, i32* %3
br label %15
15: ; preds = %11, %10
%16 = load i32, i32* %3
ret i32 %16
}

LLVM IR (-O2):
define i32 @spx_stdio_restore(i32 %0, i32 %1) {
%3 = tail call i32 @dup2(i32 %1, i32 %0)
%4 = icmp eq i32 %3, -1
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 @close(i32 %1)
br label %7
7: ; preds = %2, %5
%8 = phi i32 [ %0, %5 ], [ -1, %2 ]
ret i32 %8
}
/* Type definitions */
typedef int int16_t;

/* Variables and functions */
void test_vorrimm_s16x4(int16_t *__restrict__ dest, int16_t *a) {
  int i;
  for (i = 0; i < 4; i++) {
    dest[i] = a[i] | 1;
  }
}


x86 assembly (clang, -O0):
<test_vorrimm_s16x4>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x4,-0x14(%rbp)
jge    1144 <test_vorrimm_s16x4+0x44>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
or     $0x1,%edx
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1113 <test_vorrimm_s16x4+0x13>
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_vorrimm_s16x4>:
movups (%rsi),%xmm0
orps   0xef6(%rip),%xmm0
movups %xmm0,(%rdi)
ret

LLVM IR (-O0):
define void @test_vorrimm_s16x4(i32* noalias %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i32
store i32* %0, i32** %3
store i32* %1, i32** %4
store i32 0, i32* %5
br label %6
6: ; preds = %20, %2
%7 = load i32, i32* %5
%8 = icmp slt i32 %7, 4
br i1 %8, label %9, label %23
9: ; preds = %6
%10 = load i32*, i32** %4
%11 = load i32, i32* %5
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds i32, i32* %10, i64 %12
%14 = load i32, i32* %13
%15 = or i32 %14, 1
%16 = load i32*, i32** %3
%17 = load i32, i32* %5
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i32, i32* %16, i64 %18
store i32 %15, i32* %19
br label %20
20: ; preds = %9
%21 = load i32, i32* %5
%22 = add nsw i32 %21, 1
store i32 %22, i32* %5
br label %6
23: ; preds = %6
ret void
}

LLVM IR (-O2):
define void @test_vorrimm_s16x4(i32* noalias nocapture writeonly %0, i32* nocapture %1) {
%3 = bitcast i32* %1 to <4 x i32>*
%4 = load <4 x i32>, <4 x i32>* %3
%5 = or <4 x i32> %4, <i32 1, i32 1, i32 1, i32 1>
%6 = bitcast i32* %0 to <4 x i32>*
store <4 x i32> %5, <4 x i32>* %6
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *);
void handler(int signo __attribute__((unused))) {
  printf("Received signal - exit success\n");
  exit(1);
}


x86 assembly (clang, -O0):
<handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xece(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<handler>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [32 x i8] c"Received signal - exit success\0A\00"
define void @handler(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@str = [31 x i8] c"Received signal - exit success\00"
define void @handler(i32 %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int japi_keylistener(int);
int j_keylistener(int arg0) { return (japi_keylistener(arg0)); }


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

x86 assembly (clang, -O2):
<j_keylistener>:
jmp    1030 <japi_keylistener@plt>

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

LLVM IR (-O2):
define i32 @j_keylistener(i32 %0) {
%2 = tail call i32 @japi_keylistener(i32 %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ stdout;
void term_clear() { fputs("\033[2J\033[1;1H", stdout); }


x86 assembly (clang, -O0):
<term_clear>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%esi
lea    0xedc(%rip),%rdi
call   1030 <fputs@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<term_clear>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%esi
lea    0xee0(%rip),%rdi
jmp    1030 <fputs@plt>

LLVM IR (-O0):
@.str = [11 x i8] c"\1B[2J\1B[1;1H\00"
@stdout = global i32 0
define void @term_clear() {
%1 = load i32, i32* @stdout
%2 = call i32 @fputs(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %1)
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"\1B[2J\1B[1;1H\00"
@stdout = global i32 0
define void @term_clear() {
%1 = load i32, i32* @stdout
%2 = tail call i32 @fputs(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %1)
ret void
}
int vdIntBound(const int max, const int min, const int val) {
  int ret = 0;
  if ((max <= val) && (min >= val)) {
    ret = 1;
  } else {
  }
  return ret;
}


x86 assembly (clang, -O0):
<vdIntBound>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     1138 <vdIntBound+0x38>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jl     1138 <vdIntBound+0x38>
movl   $0x1,-0x10(%rbp)
jmp    113d <vdIntBound+0x3d>
jmp    113d <vdIntBound+0x3d>
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<vdIntBound>:
cmp    %edx,%edi
setle  %al
cmp    %edx,%esi
setge  %cl
and    %al,%cl
movzbl %cl,%eax
ret

LLVM IR (-O0):
define i32 @vdIntBound(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
store i32 0, i32* %7
%8 = load i32, i32* %4
%9 = load i32, i32* %6
%10 = icmp sle i32 %8, %9
br i1 %10, label %11, label %16
11: ; preds = %3
%12 = load i32, i32* %5
%13 = load i32, i32* %6
%14 = icmp sge i32 %12, %13
br i1 %14, label %15, label %16
15: ; preds = %11
store i32 1, i32* %7
br label %17
16: ; preds = %11, %3
br label %17
17: ; preds = %16, %15
%18 = load i32, i32* %7
ret i32 %18
}

LLVM IR (-O2):
define i32 @vdIntBound(i32 %0, i32 %1, i32 %2) {
%4 = icmp sle i32 %0, %2
%5 = icmp sge i32 %1, %2
%6 = and i1 %4, %5
%7 = zext i1 %6 to i32
ret i32 %7
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ SEEK_END;
int /*<<< orphan*/ SEEK_SET;
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, long, int /*<<< orphan*/);
long ftell(int /*<<< orphan*/ *);
long get_fsize(FILE *f) {
  long pos;
  long rc;
  pos = ftell(f);
  fseek(f, 0, SEEK_END);
  rc = ftell(f);
  fseek(f, pos, SEEK_SET);
  return rc;
}


x86 assembly (clang, -O0):
<get_fsize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <ftell@plt>
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2ea4(%rip),%rax
mov    (%rax),%edx
xor    %eax,%eax
mov    %eax,%esi
call   1040 <fseek@plt>
mov    -0x8(%rbp),%rdi
call   1030 <ftell@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    0x2e6d(%rip),%rax
mov    (%rax),%edx
call   1040 <fseek@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_fsize>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%rbx
call   1030 <ftell@plt>
mov    %rax,%r14
mov    0x2eb1(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1040 <fseek@plt>
mov    %rbx,%rdi
call   1030 <ftell@plt>
mov    %rax,%r15
mov    0x2e83(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <fseek@plt>
mov    %r15,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
define i64 @get_fsize(i32* %0) {
%2 = alloca i32*
%3 = alloca i64
%4 = alloca i64
store i32* %0, i32** %2
%5 = load i32*, i32** %2
%6 = call i64 @ftell(i32* %5)
store i64 %6, i64* %3
%7 = load i32*, i32** %2
%8 = load i32, i32* @SEEK_END
%9 = call i32 @fseek(i32* %7, i64 0, i32 %8)
%10 = load i32*, i32** %2
%11 = call i64 @ftell(i32* %10)
store i64 %11, i64* %4
%12 = load i32*, i32** %2
%13 = load i64, i64* %3
%14 = load i32, i32* @SEEK_SET
%15 = call i32 @fseek(i32* %12, i64 %13, i32 %14)
%16 = load i64, i64* %4
ret i64 %16
}

LLVM IR (-O2):
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
define i64 @get_fsize(i32* nocapture %0) {
%2 = tail call i64 @ftell(i32* %0)
%3 = load i32, i32* @SEEK_END
%4 = tail call i32 @fseek(i32* %0, i64 0, i32 %3)
%5 = tail call i64 @ftell(i32* %0)
%6 = load i32, i32* @SEEK_SET
%7 = tail call i32 @fseek(i32* %0, i64 %2, i32 %6)
ret i64 %5
}
/* Type definitions */
typedef int /*<<< orphan*/ buf;

/* Variables and functions */
int /*<<< orphan*/ snprintf(char *, int, char *, char const *);
char *match_msg_ambiguous(const char *s) {
  static char buf[((2048) * 4)];
  snprintf(buf, sizeof(buf), "I don't know which '%s' you mean!", s);
  return buf;
}


x86 assembly (clang, -O0):
<match_msg_ambiguous>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rcx
lea    0x2f19(%rip),%rdi
mov    $0x2000,%esi
lea    0xecd(%rip),%rdx
call   1030 <snprintf@plt>
lea    0x2f01(%rip),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<match_msg_ambiguous>:
push   %rbx
mov    %rdi,%rcx
lea    0x2f25(%rip),%rbx
lea    0xede(%rip),%rdx
mov    %rbx,%rdi
mov    $0x2000,%esi
call   1030 <snprintf@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@match_msg_ambiguous.buf = internal global [8192 x i8] zeroinitializer
@.str = [34 x i8] c"I don't know which '%s' you mean!\00"
define i8* @match_msg_ambiguous(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @snprintf(i8* getelementptr inbounds ([8192 x i8], [8192 x i8]* @match_msg_ambiguous.buf, i64 0, i64 0), i32 8192, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8* %3)
ret i8* getelementptr inbounds ([8192 x i8], [8192 x i8]* @match_msg_ambiguous.buf, i64 0, i64 0)
}

LLVM IR (-O2):
@match_msg_ambiguous.buf = internal global [8192 x i8] zeroinitializer
@.str = [34 x i8] c"I don't know which '%s' you mean!\00"
define i8* @match_msg_ambiguous(i8* %0) {
%2 = tail call i32 @snprintf(i8* getelementptr inbounds ([8192 x i8], [8192 x i8]* @match_msg_ambiguous.buf, i64 0, i64 0), i32 8192, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8* %0)
ret i8* getelementptr inbounds ([8192 x i8], [8192 x i8]* @match_msg_ambiguous.buf, i64 0, i64 0)
}
int test_imm_1Duint16_reg(unsigned short val) {
  return ((val) & (0x1D << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_1Duint16_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%edx
and    $0x1d,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_1Duint16_reg>:
test   $0x1d,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_1Duint16_reg(i16 zeroext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = zext i16 %3 to i32
%5 = and i32 %4, 29
%6 = icmp ne i32 %5, 0
%7 = zext i1 %6 to i64
%8 = select i1 %6, i32 -20, i32 -40
ret i32 %8
}

LLVM IR (-O2):
define i32 @test_imm_1Duint16_reg(i16 zeroext %0) {
%2 = and i16 %0, 29
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
scalar_t__ mb_malloc(unsigned int);
int /*<<< orphan*/ memcpy(char *, char const *, unsigned int);
char *mb_memdup(const char *val, unsigned size) {
  char *result = 0;
  if (val != 0) {
    result = (char *)mb_malloc(size);
    if (result)
      memcpy(result, val, size);
  }
  return result;
}


x86 assembly (clang, -O0):
<mb_memdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movq   $0x0,-0x18(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     116e <mb_memdup+0x4e>
mov    -0xc(%rbp),%edi
call   1030 <mb_malloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1169 <mb_memdup+0x49>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   1040 <memcpy@plt>
jmp    116e <mb_memdup+0x4e>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mb_memdup>:
push   %rbp
push   %r14
push   %rbx
test   %rdi,%rdi
je     114e <mb_memdup+0x2e>
mov    %esi,%r14d
mov    %rdi,%rbp
mov    %esi,%edi
call   1030 <mb_malloc@plt>
test   %rax,%rax
je     114e <mb_memdup+0x2e>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %rbp,%rsi
mov    %r14d,%edx
call   1040 <memcpy@plt>
jmp    1150 <mb_memdup+0x30>
xor    %ebx,%ebx
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i8* @mb_memdup(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8*
store i8* %0, i8** %3
store i32 %1, i32* %4
store i8* null, i8** %5
%6 = load i8*, i8** %3
%7 = icmp ne i8* %6, null
br i1 %7, label %8, label %20
8: ; preds = %2
%9 = load i32, i32* %4
%10 = call i64 @mb_malloc(i32 %9)
%11 = inttoptr i64 %10 to i8*
store i8* %11, i8** %5
%12 = load i8*, i8** %5
%13 = icmp ne i8* %12, null
br i1 %13, label %14, label %19
14: ; preds = %8
%15 = load i8*, i8** %5
%16 = load i8*, i8** %3
%17 = load i32, i32* %4
%18 = call i32 @memcpy(i8* %15, i8* %16, i32 %17)
br label %19
19: ; preds = %14, %8
br label %20
20: ; preds = %19, %2
%21 = load i8*, i8** %5
ret i8* %21
}

LLVM IR (-O2):
define i8* @mb_memdup(i8* %0, i32 %1) {
%3 = icmp eq i8* %0, null
br i1 %3, label %10, label %4
4: ; preds = %2
%5 = tail call i64 @mb_malloc(i32 %1)
%6 = inttoptr i64 %5 to i8*
%7 = icmp eq i64 %5, 0
br i1 %7, label %10, label %8
8: ; preds = %4
%9 = tail call i32 @memcpy(i8* %6, i8* %0, i32 %1)
br label %10
10: ; preds = %4, %8, %2
%11 = phi i8* [ %6, %8 ], [ null, %4 ], [ null, %2 ]
ret i8* %11
}
int check_invalid(char *card_name, int val) {
  if (card_name[0] == 'X') {
    return -1;
  } else if ((val < 1) || (11 < val)) {
    return 0;
  } else {
    return 1;
  }
}


x86 assembly (clang, -O0):
<check_invalid>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x58,%eax
jne    1127 <check_invalid+0x27>
movl   $0xffffffff,-0x4(%rbp)
jmp    1152 <check_invalid+0x52>
cmpl   $0x1,-0x14(%rbp)
jl     113f <check_invalid+0x3f>
mov    $0xb,%eax
cmp    -0x14(%rbp),%eax
jge    114b <check_invalid+0x4b>
movl   $0x0,-0x4(%rbp)
jmp    1152 <check_invalid+0x52>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_invalid>:
add    $0xffffffff,%esi
xor    %ecx,%ecx
cmp    $0xb,%esi
setb   %cl
cmpb   $0x58,(%rdi)
mov    $0xffffffff,%eax
cmovne %ecx,%eax
ret

LLVM IR (-O0):
define i32 @check_invalid(i8* %0, i32 %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %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, 88
br i1 %10, label %11, label %12
11: ; preds = %2
store i32 -1, i32* %3
br label %20
12: ; preds = %2
%13 = load i32, i32* %5
%14 = icmp slt i32 %13, 1
br i1 %14, label %18, label %15
15: ; preds = %12
%16 = load i32, i32* %5
%17 = icmp slt i32 11, %16
br i1 %17, label %18, label %19
18: ; preds = %15, %12
store i32 0, i32* %3
br label %20
19: ; preds = %15
store i32 1, i32* %3
br label %20
20: ; preds = %19, %18, %11
%21 = load i32, i32* %3
ret i32 %21
}

LLVM IR (-O2):
define i32 @check_invalid(i8* nocapture %0, i32 %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 88
%5 = add i32 %1, -1
%6 = icmp ult i32 %5, 11
%7 = zext i1 %6 to i32
%8 = select i1 %4, i32 -1, i32 %7
ret i32 %8
}
/* Variables and functions */
scalar_t__ can_alloc();
void *realloc(void *, size_t);
void *memory_resize(void *ptr, size_t size) {
  void *res_ptr = NULL;
  if (can_alloc()) {
    res_ptr = realloc(ptr, size);
  }
  return res_ptr;
}


x86 assembly (clang, -O0):
<memory_resize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    $0x0,%al
call   1030 <can_alloc@plt>
cmp    $0x0,%rax
je     115a <memory_resize+0x3a>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <realloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<memory_resize>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
xor    %eax,%eax
call   1030 <can_alloc@plt>
test   %rax,%rax
je     1148 <memory_resize+0x28>
mov    %rbx,%rdi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <realloc@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @memory_resize(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i8*
store i8* %0, i8** %3
store i64 %1, i64* %4
store i8* null, i8** %5
%6 = call i64 (...) @can_alloc()
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %12
8: ; preds = %2
%9 = load i8*, i8** %3
%10 = load i64, i64* %4
%11 = call i8* @realloc(i8* %9, i64 %10)
store i8* %11, i8** %5
br label %12
12: ; preds = %8, %2
%13 = load i8*, i8** %5
ret i8* %13
}

LLVM IR (-O2):
define noalias i8* @memory_resize(i8* nocapture %0, i64 %1) {
%3 = tail call i64 (...) @can_alloc()
%4 = icmp eq i64 %3, 0
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i8* @realloc(i8* %0, i64 %1)
br label %7
7: ; preds = %5, %2
%8 = phi i8* [ %6, %5 ], [ null, %2 ]
ret i8* %8
}
/* Variables and functions */
scalar_t__ PHYSFS_deinit();
char *PHYSFS_getLastError();
int /*<<< orphan*/ printf(char *, ...);
int cmd_deinit(char *args) {
  if (PHYSFS_deinit())
    printf("Successful.\n");
  else
    printf("Failure. reason: %s.\n", PHYSFS_getLastError());
  return (1);
}


x86 assembly (clang, -O0):
<cmd_deinit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1040 <PHYSFS_deinit@plt>
cmp    $0x0,%rax
je     1160 <cmd_deinit+0x30>
lea    0xeac(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1178 <cmd_deinit+0x48>
mov    $0x0,%al
call   1050 <PHYSFS_getLastError@plt>
mov    %rax,%rsi
lea    0xe9c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmd_deinit>:
push   %rax
xor    %eax,%eax
call   1050 <PHYSFS_deinit@plt>
test   %rax,%rax
je     115b <cmd_deinit+0x1b>
lea    0xec2(%rip),%rdi
call   1030 <puts@plt>
jmp    1173 <cmd_deinit+0x33>
xor    %eax,%eax
call   1060 <PHYSFS_getLastError@plt>
lea    0xe97(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [13 x i8] c"Successful.\0A\00"
@.str.1 = [22 x i8] c"Failure. reason: %s.\0A\00"
define i32 @cmd_deinit(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i64 (...) @PHYSFS_deinit()
%4 = icmp ne i64 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
br label %10
7: ; preds = %1
%8 = call i8* (...) @PHYSFS_getLastError()
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8* %8)
br label %10
10: ; preds = %7, %5
ret i32 1
}

LLVM IR (-O2):
@.str.1 = [22 x i8] c"Failure. reason: %s.\0A\00"
@str = [12 x i8] c"Successful.\00"
define i32 @cmd_deinit(i8* nocapture readnone %0) {
%2 = tail call i64 (...) @PHYSFS_deinit()
%3 = icmp eq i64 %2, 0
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
br label %9
6: ; preds = %1
%7 = tail call i8* (...) @PHYSFS_getLastError()
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8* %7)
br label %9
9: ; preds = %6, %4
ret i32 1
}
/* Type definitions */
typedef int pid_t;
typedef int /*<<< orphan*/ path;

/* Variables and functions */
int procfs_enum_id(char *, int **, int *);
int /*<<< orphan*/ snprintf(char *, int, char *, int);
int os_procfs_lwp_enum(pid_t pid, int **lwps, int *num) {
  char path[2048];
  (void)snprintf(path, sizeof(path), "/proc/%d/task", pid);
  return (procfs_enum_id(path, lwps, num));
}


x86 assembly (clang, -O0):
<os_procfs_lwp_enum>:
push   %rbp
mov    %rsp,%rbp
sub    $0x820,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
lea    -0x820(%rbp),%rdi
mov    -0x4(%rbp),%ecx
mov    $0x800,%esi
lea    0xeb4(%rip),%rdx
call   1030 <snprintf@plt>
lea    -0x820(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1040 <procfs_enum_id@plt>
add    $0x820,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<os_procfs_lwp_enum>:
push   %r15
push   %r14
push   %rbx
sub    $0x800,%rsp
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %edi,%ecx
lea    0xec5(%rip),%rdx
mov    %rsp,%r15
mov    %r15,%rdi
mov    $0x800,%esi
call   1030 <snprintf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1040 <procfs_enum_id@plt>
add    $0x800,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [14 x i8] c"/proc/%d/task\00"
define i32 @os_procfs_lwp_enum(i32 %0, i32** %1, i32* %2) {
%4 = alloca i32
%5 = alloca i32**
%6 = alloca i32*
%7 = alloca [2048 x i8]
store i32 %0, i32* %4
store i32** %1, i32*** %5
store i32* %2, i32** %6
%8 = getelementptr inbounds [2048 x i8], [2048 x i8]* %7, i64 0, i64 0
%9 = load i32, i32* %4
%10 = call i32 @snprintf(i8* %8, i32 2048, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = getelementptr inbounds [2048 x i8], [2048 x i8]* %7, i64 0, i64 0
%12 = load i32**, i32*** %5
%13 = load i32*, i32** %6
%14 = call i32 @procfs_enum_id(i8* %11, i32** %12, i32* %13)
ret i32 %14
}

LLVM IR (-O2):
@.str = [14 x i8] c"/proc/%d/task\00"
define i32 @os_procfs_lwp_enum(i32 %0, i32** %1, i32* %2) {
%4 = alloca [2048 x i8]
%5 = getelementptr inbounds [2048 x i8], [2048 x i8]* %4, i64 0, i64 0
%6 = call i32 @snprintf(i8* %5, i32 2048, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %0)
%7 = call i32 @procfs_enum_id(i8* %5, i32** %1, i32* %2)
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, int, int, int);
extern const char *onig_version(void) {
  static char s[12];
  sprintf(s, "%d.%d.%d", 5, 9, 6);
  return s;
}


x86 assembly (clang, -O0):
<onig_version>:
push   %rbp
mov    %rsp,%rbp
lea    0x2f0e(%rip),%rdi
lea    0xede(%rip),%rsi
mov    $0x5,%edx
mov    $0x9,%ecx
mov    $0x6,%r8d
call   1030 <sprintf@plt>
lea    0x2eeb(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<onig_version>:
push   %rbx
lea    0x2f11(%rip),%rbx
lea    0xee1(%rip),%rsi
mov    %rbx,%rdi
mov    $0x5,%edx
mov    $0x9,%ecx
mov    $0x6,%r8d
call   1030 <sprintf@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@onig_version.s = internal global [12 x i8] zeroinitializer
@.str = [9 x i8] c"%d.%d.%d\00"
define i8* @onig_version() {
%1 = call i32 @sprintf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @onig_version.s, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 5, i32 9, i32 6)
ret i8* getelementptr inbounds ([12 x i8], [12 x i8]* @onig_version.s, i64 0, i64 0)
}

LLVM IR (-O2):
@onig_version.s = internal global [12 x i8] zeroinitializer
@.str = [9 x i8] c"%d.%d.%d\00"
define i8* @onig_version() {
%1 = tail call i32 @sprintf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @onig_version.s, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 5, i32 9, i32 6)
ret i8* getelementptr inbounds ([12 x i8], [12 x i8]* @onig_version.s, i64 0, i64 0)
}
unsigned int Strings_CanExtractAll(unsigned int sourceLength,
                                   unsigned int startIndex,
                                   unsigned int numberToExtract,
                                   char *destination,
                                   unsigned int _destination_high) {
  return ((numberToExtract + startIndex) <= sourceLength) &&
         (_destination_high >= numberToExtract);
  __builtin_unreachable();
}


x86 assembly (clang, -O0):
<Strings_CanExtractAll>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    -0xc(%rbp),%ecx
add    -0x8(%rbp),%ecx
xor    %eax,%eax
cmp    -0x4(%rbp),%ecx
mov    %al,-0x1d(%rbp)
ja     1135 <Strings_CanExtractAll+0x35>
mov    -0x1c(%rbp),%eax
cmp    -0xc(%rbp),%eax
setae  %al
mov    %al,-0x1d(%rbp)
mov    -0x1d(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Strings_CanExtractAll>:
add    %edx,%esi
cmp    %edi,%esi
setbe  %al
cmp    %edx,%r8d
setae  %cl
and    %al,%cl
movzbl %cl,%eax
ret

LLVM IR (-O0):
define i32 @Strings_CanExtractAll(i32 %0, i32 %1, i32 %2, i8* %3, i32 %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i32
store i32 %0, i32* %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i8* %3, i8** %9
store i32 %4, i32* %10
%11 = load i32, i32* %8
%12 = load i32, i32* %7
%13 = add i32 %11, %12
%14 = load i32, i32* %6
%15 = icmp ule i32 %13, %14
br i1 %15, label %16, label %20
16: ; preds = %5
%17 = load i32, i32* %10
%18 = load i32, i32* %8
%19 = icmp uge i32 %17, %18
br label %20
20: ; preds = %16, %5
%21 = phi i1 [ false, %5 ], [ %19, %16 ]
%22 = zext i1 %21 to i32
ret i32 %22
}

LLVM IR (-O2):
define i32 @Strings_CanExtractAll(i32 %0, i32 %1, i32 %2, i8* nocapture readnone %3, i32 %4) {
%6 = add i32 %2, %1
%7 = icmp ule i32 %6, %0
%8 = icmp uge i32 %4, %2
%9 = and i1 %7, %8
%10 = zext i1 %9 to i32
ret i32 %10
}
void NOR_SPI_DisableRxInt(void) {}


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

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

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

LLVM IR (-O2):
define void @NOR_SPI_DisableRxInt() {
ret void
}
void ReplaySignal1() {}


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

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

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

LLVM IR (-O2):
define void @ReplaySignal1() {
ret void
}
/* Type definitions */
struct buffer {
  int dummy;
};

/* Variables and functions */
int buffer_find_char(struct buffer *, int, int, char const *, int *);
int buffer_find_char_next(struct buffer *buf, int from, const char *accept,
                          int *newlines) {
  return buffer_find_char(buf, from, 1, accept, newlines);
}


x86 assembly (clang, -O0):
<buffer_find_char_next>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rcx
mov    -0x20(%rbp),%r8
mov    $0x1,%edx
call   1030 <buffer_find_char@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<buffer_find_char_next>:
mov    %rcx,%r8
mov    %rdx,%rcx
mov    $0x1,%edx
jmp    1030 <buffer_find_char@plt>

LLVM IR (-O0):
%struct.buffer = type { i32 }
define i32 @buffer_find_char_next(%struct.buffer* %0, i32 %1, i8* %2, i32* %3) {
%5 = alloca %struct.buffer*
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32*
store %struct.buffer* %0, %struct.buffer** %5
store i32 %1, i32* %6
store i8* %2, i8** %7
store i32* %3, i32** %8
%9 = load %struct.buffer*, %struct.buffer** %5
%10 = load i32, i32* %6
%11 = load i8*, i8** %7
%12 = load i32*, i32** %8
%13 = call i32 @buffer_find_char(%struct.buffer* %9, i32 %10, i32 1, i8* %11, i32* %12)
ret i32 %13
}

LLVM IR (-O2):
%struct.buffer = type { i32 }
define i32 @buffer_find_char_next(%struct.buffer* %0, i32 %1, i8* %2, i32* %3) {
%5 = tail call i32 @buffer_find_char(%struct.buffer* %0, i32 %1, i32 1, i8* %2, i32* %3)
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ dec2bin(char *, int);
int /*<<< orphan*/ printf(char *);
void bit_shift_left(int flag, int offset) {
  dec2bin("   flag ", flag);
  dec2bin(" offset ", offset);
  dec2bin(">> (>>) ", flag >> offset);
  printf("\n");
}


x86 assembly (clang, -O0):
<bit_shift_left>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%esi
lea    0xec8(%rip),%rdi
call   1040 <dec2bin@plt>
mov    -0x8(%rbp),%esi
lea    0xec2(%rip),%rdi
call   1040 <dec2bin@plt>
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%ecx
sar    %cl,%esi
lea    0xeb7(%rip),%rdi
call   1040 <dec2bin@plt>
lea    0xeb4(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bit_shift_left>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
lea    0xed2(%rip),%rdi
mov    %ebp,%esi
call   1040 <dec2bin@plt>
lea    0xecd(%rip),%rdi
mov    %ebx,%esi
call   1040 <dec2bin@plt>
mov    %ebx,%ecx
sar    %cl,%ebp
lea    0xec4(%rip),%rdi
mov    %ebp,%esi
call   1040 <dec2bin@plt>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [9 x i8] c" flag \00"
@.str.1 = [9 x i8] c" offset \00"
@.str.2 = [9 x i8] c">> (>>) \00"
@.str.3 = [2 x i8] c"\0A\00"
define void @bit_shift_left(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 = call i32 @dec2bin(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = load i32, i32* %4
%8 = call i32 @dec2bin(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %7)
%9 = load i32, i32* %3
%10 = load i32, i32* %4
%11 = ashr i32 %9, %10
%12 = call i32 @dec2bin(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 %11)
%13 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c" flag \00"
@.str.1 = [9 x i8] c" offset \00"
@.str.2 = [9 x i8] c">> (>>) \00"
define void @bit_shift_left(i32 %0, i32 %1) {
%3 = tail call i32 @dec2bin(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %0)
%4 = tail call i32 @dec2bin(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %1)
%5 = ashr i32 %0, %1
%6 = tail call i32 @dec2bin(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 %5)
%7 = tail call i32 @putchar(i32 10)
ret void
}
unsigned short int unsignedshortint_ignoring_signedchar(unsigned short int x,
                                                        signed char y) {
  return x;
}


x86 assembly (clang, -O0):
<unsignedshortint_ignoring_signedchar>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %di,%cx
mov    %cx,-0x2(%rbp)
mov    %al,-0x3(%rbp)
movzwl -0x2(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<unsignedshortint_ignoring_signedchar>:
mov    %edi,%eax
ret

LLVM IR (-O0):
define zeroext i16 @unsignedshortint_ignoring_signedchar(i16 zeroext %0, i8 signext %1) {
%3 = alloca i16
%4 = alloca i8
store i16 %0, i16* %3
store i8 %1, i8* %4
%5 = load i16, i16* %3
ret i16 %5
}

LLVM IR (-O2):
define zeroext i16 @unsignedshortint_ignoring_signedchar(i16 returned zeroext %0, i8 signext %1) {
ret i16 %0
}
unsigned xma_be32(unsigned n) {
  static const int endianess = 1;
  if (!*(char *)&endianess)
    return (n);
  n = (((n & 0xff000000) >> 24) | ((n & 0x00ff0000) >> 8) |
       ((n & 0x0000ff00) << 8) | ((n & 0x000000ff) << 24));
  return (n);
}


x86 assembly (clang, -O0):
<xma_be32>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpb   $0x0,0xef2(%rip)
jne    111f <xma_be32+0x1f>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    115d <xma_be32+0x5d>
mov    -0x8(%rbp),%eax
and    $0xff000000,%eax
shr    $0x18,%eax
mov    -0x8(%rbp),%ecx
and    $0xff0000,%ecx
shr    $0x8,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%ecx
and    $0xff00,%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%ecx
and    $0xff,%ecx
shl    $0x18,%ecx
or     %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<xma_be32>:
mov    %edi,%eax
bswap  %eax
ret

LLVM IR (-O0):
@xma_be32.endianess = internal constant i32 1
define i32 @xma_be32(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i8, i8* bitcast (i32* @xma_be32.endianess to i8*)
%5 = icmp ne i8 %4, 0
br i1 %5, label %8, label %6
6: ; preds = %1
%7 = load i32, i32* %3
store i32 %7, i32* %2
br label %25
8: ; preds = %1
%9 = load i32, i32* %3
%10 = and i32 %9, -16777216
%11 = lshr i32 %10, 24
%12 = load i32, i32* %3
%13 = and i32 %12, 16711680
%14 = lshr i32 %13, 8
%15 = or i32 %11, %14
%16 = load i32, i32* %3
%17 = and i32 %16, 65280
%18 = shl i32 %17, 8
%19 = or i32 %15, %18
%20 = load i32, i32* %3
%21 = and i32 %20, 255
%22 = shl i32 %21, 24
%23 = or i32 %19, %22
store i32 %23, i32* %3
%24 = load i32, i32* %3
store i32 %24, i32* %2
br label %25
25: ; preds = %8, %6
%26 = load i32, i32* %2
ret i32 %26
}

LLVM IR (-O2):
define i32 @xma_be32(i32 %0) {
%2 = tail call i32 @llvm.bswap.i32(i32 %0)
ret i32 %2
}
int XWithdrawWindow() {}


x86 assembly (clang, -O0):
<XWithdrawWindow>:
push   %rbp
mov    %rsp,%rbp
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @XWithdrawWindow() {
%1 = alloca i32
%2 = load i32, i32* %1
ret i32 %2
}

LLVM IR (-O2):
define i32 @XWithdrawWindow() {
ret i32 undef
}
int sendRaw() { return 0; }


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

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

LLVM IR (-O0):
define i32 @sendRaw() {
ret i32 0
}

LLVM IR (-O2):
define i32 @sendRaw() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ bgnqstrip();
void bgnqstrip_() { bgnqstrip(); }


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

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

LLVM IR (-O0):
define void @bgnqstrip_() {
%1 = call i32 (...) @bgnqstrip()
ret void
}

LLVM IR (-O2):
define void @bgnqstrip_() {
%1 = tail call i32 (...) @bgnqstrip()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ scanf(char *, int *);
int gInt() {
  int i;
  scanf("%d", &i);
  return i;
}


x86 assembly (clang, -O0):
<gInt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1030 <scanf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gInt>:
push   %rax
lea    0xee8(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1030 <scanf@plt>
mov    0x4(%rsp),%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
define i32 @gInt() {
%1 = alloca i32
%2 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @gInt() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ errno;
int /*<<< orphan*/ printf(char *, char *);
int remove(char *);
char *strerror(int /*<<< orphan*/);
int SASSegStoreRemoveByName(char *name) {
  int rc;
  rc = remove(name);
  if (rc == -1) {
    printf("SASSegStoreRemoveByName remove failed %s\n", strerror(errno));
    printf(" Store Name %s\n", name);
  }
  return rc;
}


x86 assembly (clang, -O0):
<SASSegStoreRemoveByName>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <remove@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0xffffffff,-0xc(%rbp)
jne    117f <SASSegStoreRemoveByName+0x4f>
mov    0x2e87(%rip),%rax
mov    (%rax),%edi
call   1050 <strerror@plt>
mov    %rax,%rsi
lea    0xe96(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%rsi
lea    0xeb0(%rip),%rdi
call   1040 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SASSegStoreRemoveByName>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1030 <remove@plt>
mov    %eax,%ebp
cmp    $0xffffffff,%eax
jne    116e <SASSegStoreRemoveByName+0x3e>
mov    0x2e97(%rip),%rax
mov    (%rax),%edi
call   1050 <strerror@plt>
lea    0xea9(%rip),%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
lea    0xec4(%rip),%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [42 x i8] c"SASSegStoreRemoveByName remove failed %s\0A\00"
@errno = global i32 0
@.str.1 = [16 x i8] c" Store Name %s\0A\00"
define i32 @SASSegStoreRemoveByName(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @remove(i8* %4)
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = icmp eq i32 %6, -1
br i1 %7, label %8, label %14
8: ; preds = %1
%9 = load i32, i32* @errno
%10 = call i8* @strerror(i32 %9)
%11 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i8* %10)
%12 = load i8*, i8** %2
%13 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8* %12)
br label %14
14: ; preds = %8, %1
%15 = load i32, i32* %3
ret i32 %15
}

LLVM IR (-O2):
@.str = [42 x i8] c"SASSegStoreRemoveByName remove failed %s\0A\00"
@errno = global i32 0
@.str.1 = [16 x i8] c" Store Name %s\0A\00"
define i32 @SASSegStoreRemoveByName(i8* %0) {
%2 = tail call i32 @remove(i8* %0)
%3 = icmp eq i32 %2, -1
br i1 %3, label %4, label %9
4: ; preds = %1
%5 = load i32, i32* @errno
%6 = tail call i8* @strerror(i32 %5)
%7 = tail call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8* %0)
br label %9
9: ; preds = %4, %1
ret i32 %2
}
unsigned char op_xor(unsigned char n1, unsigned char n2) { return n1 ^ n2; }


x86 assembly (clang, -O0):
<op_xor>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movzbl -0x1(%rbp),%eax
movzbl -0x2(%rbp),%ecx
xor    %ecx,%eax
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<op_xor>:
mov    %edi,%eax
xor    %esi,%eax
ret

LLVM IR (-O0):
define zeroext i8 @op_xor(i8 zeroext %0, i8 zeroext %1) {
%3 = alloca i8
%4 = alloca i8
store i8 %0, i8* %3
store i8 %1, i8* %4
%5 = load i8, i8* %3
%6 = zext i8 %5 to i32
%7 = load i8, i8* %4
%8 = zext i8 %7 to i32
%9 = xor i32 %6, %8
%10 = trunc i32 %9 to i8
ret i8 %10
}

LLVM IR (-O2):
define zeroext i8 @op_xor(i8 zeroext %0, i8 zeroext %1) {
%3 = xor i8 %1, %0
ret i8 %3
}
int process_simple_reply(struct reply_struct *this_reply) { return (1); }


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

x86 assembly (clang, -O2):
<process_simple_reply>:
mov    $0x1,%eax
ret

LLVM IR (-O0):
%struct.reply_struct = type opaque
define i32 @process_simple_reply(%struct.reply_struct* %0) {
%2 = alloca %struct.reply_struct*
store %struct.reply_struct* %0, %struct.reply_struct** %2
ret i32 1
}

LLVM IR (-O2):
%struct.reply_struct = type opaque
define i32 @process_simple_reply(%struct.reply_struct* nocapture readnone %0) {
ret i32 1
}
/* Type definitions */
struct linnea_context {
  int dummy;
};

/* Variables and functions */
int linnea_network_create_listener(int const, char const *, char const *,
                                   int /*<<< orphan*/ *);
int linnea_context_add_listener(struct linnea_context *context,
                                const int ai_family, const char *hostname,
                                const char *servname) {
  int fd;
  if ((fd = linnea_network_create_listener(ai_family, hostname, servname,
                                           NULL)) == -1)
    return -1;
  return fd;
}


x86 assembly (clang, -O0):
<linnea_context_add_listener>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdx
xor    %eax,%eax
mov    %eax,%ecx
call   1030 <linnea_network_create_listener@plt>
mov    %eax,-0x2c(%rbp)
cmp    $0xffffffff,%eax
jne    1153 <linnea_context_add_listener+0x43>
movl   $0xffffffff,-0x4(%rbp)
jmp    1159 <linnea_context_add_listener+0x49>
mov    -0x2c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<linnea_context_add_listener>:
mov    %esi,%edi
mov    %rdx,%rsi
mov    %rcx,%rdx
xor    %ecx,%ecx
jmp    1030 <linnea_network_create_listener@plt>

LLVM IR (-O0):
%struct.linnea_context = type { i32 }
define i32 @linnea_context_add_listener(%struct.linnea_context* %0, i32 %1, i8* %2, i8* %3) {
%5 = alloca i32
%6 = alloca %struct.linnea_context*
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i32
store %struct.linnea_context* %0, %struct.linnea_context** %6
store i32 %1, i32* %7
store i8* %2, i8** %8
store i8* %3, i8** %9
%11 = load i32, i32* %7
%12 = load i8*, i8** %8
%13 = load i8*, i8** %9
%14 = call i32 @linnea_network_create_listener(i32 %11, i8* %12, i8* %13, i32* null)
store i32 %14, i32* %10
%15 = icmp eq i32 %14, -1
br i1 %15, label %16, label %17
16: ; preds = %4
store i32 -1, i32* %5
br label %19
17: ; preds = %4
%18 = load i32, i32* %10
store i32 %18, i32* %5
br label %19
19: ; preds = %17, %16
%20 = load i32, i32* %5
ret i32 %20
}

LLVM IR (-O2):
%struct.linnea_context = type { i32 }
define i32 @linnea_context_add_listener(%struct.linnea_context* nocapture readnone %0, i32 %1, i8* %2, i8* %3) {
%5 = tail call i32 @linnea_network_create_listener(i32 %1, i8* %2, i8* %3, i32* null)
ret i32 %5
}