xunge/DecIR huggingface dataset:
/* Variables and functions */
int compter_uns(int);
int /*<<< orphan*/ putchar(int);
void thuemorse(int n) {
  int i;
  for (i = 0; i < n; i++)
    putchar('0' + compter_uns(i));
  putchar(10);
}


x86 assembly (clang, -O0):
<thuemorse>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    115e <thuemorse+0x3e>
mov    -0x8(%rbp),%edi
call   1040 <compter_uns@plt>
mov    %eax,%edi
add    $0x30,%edi
call   1030 <putchar@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1132 <thuemorse+0x12>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<thuemorse>:
push   %rbp
push   %rbx
push   %rax
test   %edi,%edi
jle    1146 <thuemorse+0x26>
mov    %edi,%ebx
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
mov    %ebp,%edi
call   1040 <compter_uns@plt>
lea    0x30(%rax),%edi
call   1030 <putchar@plt>
add    $0x1,%ebp
cmp    %ebp,%ebx
jne    1130 <thuemorse+0x10>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
define void @thuemorse(i32 %0) {
%2 = icmp sgt i32 %0, 0
br i1 %2, label %3, label %10
3: ; preds = %1, %3
%4 = phi i32 [ %8, %3 ], [ 0, %1 ]
%5 = tail call i32 @compter_uns(i32 %4)
%6 = add nsw i32 %5, 48
%7 = tail call i32 @putchar(i32 %6)
%8 = add nuw nsw i32 %4, 1
%9 = icmp eq i32 %8, %0
br i1 %9, label %10, label %3
10: ; preds = %3, %1
%11 = tail call i32 @putchar(i32 10)
ret void
}
int ishex(char c) {
  return (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') ||
         (c >= 'A' && c <= 'F');
}


x86 assembly (clang, -O0):
<ishex>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
cmp    $0x30,%eax
jl     1129 <ishex+0x29>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x39,%ecx
mov    %al,-0x2(%rbp)
jle    116d <ishex+0x6d>
movsbl -0x1(%rbp),%eax
cmp    $0x61,%eax
jl     1148 <ishex+0x48>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x66,%ecx
mov    %al,-0x2(%rbp)
jle    116d <ishex+0x6d>
movsbl -0x1(%rbp),%ecx
xor    %eax,%eax
cmp    $0x41,%ecx
mov    %al,-0x3(%rbp)
jl     1167 <ishex+0x67>
movsbl -0x1(%rbp),%eax
cmp    $0x46,%eax
setle  %al
mov    %al,-0x3(%rbp)
mov    -0x3(%rbp),%al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ishex>:
lea    -0x30(%rdi),%eax
cmp    $0xa,%al
setb   %al
and    $0xdf,%dil
add    $0xbf,%dil
cmp    $0x6,%dil
setb   %cl
or     %al,%cl
movzbl %cl,%eax
ret

LLVM IR (-O0):
define i32 @ishex(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp sge i32 %4, 48
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp sle i32 %8, 57
br i1 %9, label %28, label %10
10: ; preds = %6, %1
%11 = load i8, i8* %2
%12 = sext i8 %11 to i32
%13 = icmp sge i32 %12, 97
br i1 %13, label %14, label %18
14: ; preds = %10
%15 = load i8, i8* %2
%16 = sext i8 %15 to i32
%17 = icmp sle i32 %16, 102
br i1 %17, label %28, label %18
18: ; preds = %14, %10
%19 = load i8, i8* %2
%20 = sext i8 %19 to i32
%21 = icmp sge i32 %20, 65
br i1 %21, label %22, label %26
22: ; preds = %18
%23 = load i8, i8* %2
%24 = sext i8 %23 to i32
%25 = icmp sle i32 %24, 70
br label %26
26: ; preds = %22, %18
%27 = phi i1 [ false, %18 ], [ %25, %22 ]
br label %28
28: ; preds = %26, %14, %6
%29 = phi i1 [ true, %14 ], [ true, %6 ], [ %27, %26 ]
%30 = zext i1 %29 to i32
ret i32 %30
}

LLVM IR (-O2):
define i32 @ishex(i8 signext %0) {
%2 = add i8 %0, -48
%3 = icmp ult i8 %2, 10
%4 = and i8 %0, -33
%5 = add i8 %4, -65
%6 = icmp ult i8 %5, 6
%7 = or i1 %3, %6
%8 = zext i1 %7 to i32
ret i32 %8
}
/* Variables and functions */
int galois_single_divide(int, int, int);
int galois_inverse(int y, int w) {
  if (y == 0)
    return -1;
  return galois_single_divide(1, y, w);
}


x86 assembly (clang, -O0):
<galois_inverse>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1134 <galois_inverse+0x24>
movl   $0xffffffff,-0x4(%rbp)
jmp    1147 <galois_inverse+0x37>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    $0x1,%edi
call   1030 <galois_single_divide@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<galois_inverse>:
test   %edi,%edi
je     1122 <galois_inverse+0x12>
mov    %esi,%edx
mov    %edi,%esi
mov    $0x1,%edi
jmp    1030 <galois_single_divide@plt>
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
define i32 @galois_inverse(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* %4
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %2
store i32 -1, i32* %3
br label %13
9: ; preds = %2
%10 = load i32, i32* %4
%11 = load i32, i32* %5
%12 = call i32 @galois_single_divide(i32 1, i32 %10, i32 %11)
store i32 %12, i32* %3
br label %13
13: ; preds = %9, %8
%14 = load i32, i32* %3
ret i32 %14
}

LLVM IR (-O2):
define i32 @galois_inverse(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, 0
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 @galois_single_divide(i32 1, i32 %0, i32 %1)
br label %6
6: ; preds = %2, %4
%7 = phi i32 [ %5, %4 ], [ -1, %2 ]
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ write_fb_wob(char const *);
int kputs(const char *s) {
  write_fb_wob(s);
  return 1;
}


x86 assembly (clang, -O0):
<kputs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <write_fb_wob@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<kputs>:
push   %rax
call   1030 <write_fb_wob@plt>
mov    $0x1,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @kputs(i8* %0) {
%2 = tail call i32 @write_fb_wob(i8* %0)
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ outaccum();
int /*<<< orphan*/ outload();
void outldaccum() {
  outload();
  outaccum();
}


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

x86 assembly (clang, -O2):
<outldaccum>:
push   %rax
xor    %eax,%eax
call   1030 <outload@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <outaccum@plt>

LLVM IR (-O0):
define void @outldaccum() {
%1 = call i32 (...) @outload()
%2 = call i32 (...) @outaccum()
ret void
}

LLVM IR (-O2):
define void @outldaccum() {
%1 = tail call i32 (...) @outload()
%2 = tail call i32 (...) @outaccum()
ret void
}
char *dcngettext__(domainname, msgid1, msgid2, n, category) const
    char *domainname;
const char *msgid1;
const char *msgid2;
unsigned long int n;
int category;
{ return dcigettext__(domainname, msgid1, msgid2, 1, n, category); }


x86 assembly (clang, -O0):
<dcngettext__>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%r8
mov    -0x24(%rbp),%r9d
mov    $0x1,%ecx
mov    $0x0,%al
call   1030 <dcigettext__@plt>
cltq
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dcngettext__>:
push   %rax
mov    %r8d,%r9d
mov    %rcx,%r8
mov    $0x1,%ecx
xor    %eax,%eax
call   1030 <dcigettext__@plt>
cltq
pop    %rcx
ret

LLVM IR (-O0):
define i8* @dcngettext__(i8* %0, i8* %1, i8* %2, i64 %3, i32 %4) {
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i64
%10 = alloca i32
store i8* %0, i8** %6
store i8* %1, i8** %7
store i8* %2, i8** %8
store i64 %3, i64* %9
store i32 %4, i32* %10
%11 = load i8*, i8** %6
%12 = load i8*, i8** %7
%13 = load i8*, i8** %8
%14 = load i64, i64* %9
%15 = load i32, i32* %10
%16 = call i32 (i8*, i8*, i8*, i32, i64, i32, ...) bitcast (i32 (...)* @dcigettext__ to i32 (i8*, i8*, i8*, i32, i64, i32, ...)*)(i8* %11, i8* %12, i8* %13, i32 1, i64 %14, i32 %15)
%17 = sext i32 %16 to i64
%18 = inttoptr i64 %17 to i8*
ret i8* %18
}

LLVM IR (-O2):
define i8* @dcngettext__(i8* %0, i8* %1, i8* %2, i64 %3, i32 %4) {
%6 = tail call i32 (i8*, i8*, i8*, i32, i64, i32, ...) bitcast (i32 (...)* @dcigettext__ to i32 (i8*, i8*, i8*, i32, i64, i32, ...)*)(i8* %0, i8* %1, i8* %2, i32 1, i64 %3, i32 %4)
%7 = sext i32 %6 to i64
%8 = inttoptr i64 %7 to i8*
ret i8* %8
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int foo(void) { printf("in foo\n"); }


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

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

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

LLVM IR (-O2):
@str = [7 x i8] c"in foo\00"
define i32 @foo() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
ret i32 undef
}
/* Type definitions */
typedef int uint64_t;
struct timespec {
  scalar_t__ tv_nsec;
  scalar_t__ tv_sec;
};

/* Variables and functions */
uint64_t structTimespec2nsecs(struct timespec t) {
  return (uint64_t)t.tv_sec * (uint64_t)1000000000 + (uint64_t)t.tv_nsec;
}


x86 assembly (clang, -O0):
<structTimespec2nsecs>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
imul   $0x3b9aca00,%eax,%eax
mov    -0x10(%rbp),%rcx
add    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<structTimespec2nsecs>:
imul   $0x3b9aca00,%esi,%eax
add    %edi,%eax
ret

LLVM IR (-O0):
%struct.timespec = type { i64, i64 }
define i32 @structTimespec2nsecs(i64 %0, i64 %1) {
%3 = alloca %struct.timespec
%4 = bitcast %struct.timespec* %3 to { i64, i64 }*
%5 = getelementptr inbounds { i64, i64 }, { i64, i64 }* %4, i32 0, i32 0
store i64 %0, i64* %5
%6 = getelementptr inbounds { i64, i64 }, { i64, i64 }* %4, i32 0, i32 1
store i64 %1, i64* %6
%7 = getelementptr inbounds %struct.timespec, %struct.timespec* %3, i32 0, i32 1
%8 = load i64, i64* %7
%9 = trunc i64 %8 to i32
%10 = mul nsw i32 %9, 1000000000
%11 = getelementptr inbounds %struct.timespec, %struct.timespec* %3, i32 0, i32 0
%12 = load i64, i64* %11
%13 = trunc i64 %12 to i32
%14 = add nsw i32 %10, %13
ret i32 %14
}

LLVM IR (-O2):
define i32 @structTimespec2nsecs(i64 %0, i64 %1) {
%3 = trunc i64 %1 to i32
%4 = mul nsw i32 %3, 1000000000
%5 = trunc i64 %0 to i32
%6 = add nsw i32 %4, %5
ret i32 %6
}
/* Type definitions */
struct usb_device {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct usb_device *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ usb_destroy_configuration(struct usb_device *);
void usb_free_dev(struct usb_device *dev) {
  printf("usb_free_dev\n");
  usb_destroy_configuration(dev);
  free(dev);
}


x86 assembly (clang, -O0):
<usb_free_dev>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xebd(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%rdi
call   1050 <usb_destroy_configuration@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<usb_free_dev>:
push   %rbx
mov    %rdi,%rbx
lea    0xec5(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1050 <usb_destroy_configuration@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>

LLVM IR (-O0):
%struct.usb_device = type { i32 }
@.str = [14 x i8] c"usb_free_dev\0A\00"
define void @usb_free_dev(%struct.usb_device* %0) {
%2 = alloca %struct.usb_device*
store %struct.usb_device* %0, %struct.usb_device** %2
%3 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%4 = load %struct.usb_device*, %struct.usb_device** %2
%5 = call i32 @usb_destroy_configuration(%struct.usb_device* %4)
%6 = load %struct.usb_device*, %struct.usb_device** %2
%7 = call i32 @free(%struct.usb_device* %6)
ret void
}

LLVM IR (-O2):
%struct.usb_device = type { i32 }
@str = [13 x i8] c"usb_free_dev\00"
define void @usb_free_dev(%struct.usb_device* %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @usb_destroy_configuration(%struct.usb_device* %0)
%4 = tail call i32 @free(%struct.usb_device* %0)
ret void
}
/* Variables and functions */
int omp_get_num_threads();
int omp_get_thread_num();
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char *argv[]) {
  printf("Hello from master thread.\n");
#pragma omp parallel
  {
    printf("Team member %d reporting from team of %d\n", omp_get_thread_num(),
           omp_get_num_threads());
  }
  printf("Master thread finished, goodbye.\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1030 <omp_get_thread_num@plt>
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   1050 <omp_get_num_threads@plt>
mov    -0x14(%rbp),%esi
mov    %eax,%edx
lea    0xeb1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xecd(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xee2(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1040 <omp_get_thread_num@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1060 <omp_get_num_threads@plt>
lea    0xe9c(%rip),%rdi
mov    %ebx,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xece(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [27 x i8] c"Hello from master thread.\0A\00"
@.str.1 = [42 x i8] c"Team member %d reporting from team of %d\0A\00"
@.str.2 = [34 x i8] c"Master thread finished, goodbye.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%6 = call i32 (...) @omp_get_thread_num()
%7 = call i32 (...) @omp_get_num_threads()
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.1, i64 0, i64 0), i32 %6, i32 %7)
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [42 x i8] c"Team member %d reporting from team of %d\0A\00"
@str = [26 x i8] c"Hello from master thread.\00"
@str.3 = [33 x i8] c"Master thread finished, goodbye.\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 (...) @omp_get_thread_num()
%5 = tail call i32 (...) @omp_get_num_threads()
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.1, i64 0, i64 0), i32 %4, i32 %5)
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.3, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
scalar_t__ malloc(unsigned int);
float *ufmatrix(int a, int b) {
  float *m;
  m = (float *)malloc((unsigned)a * b * sizeof(float));
  if (!m)
    return ((float *)NULL);
  return (m);
}


x86 assembly (clang, -O0):
<ufmatrix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0xc(%rbp)
mov    %esi,-0x10(%rbp)
mov    -0xc(%rbp),%eax
imul   -0x10(%rbp),%eax
mov    %eax,%eax
shl    $0x2,%rax
mov    %eax,%edi
call   1030 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    114e <ufmatrix+0x3e>
movq   $0x0,-0x8(%rbp)
jmp    1156 <ufmatrix+0x46>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ufmatrix>:
imul   %esi,%edi
shl    $0x2,%edi
jmp    1030 <malloc@plt>

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

LLVM IR (-O2):
define float* @ufmatrix(i32 %0, i32 %1) {
%3 = shl i32 %0, 2
%4 = mul i32 %3, %1
%5 = tail call i64 @malloc(i32 %4)
%6 = inttoptr i64 %5 to float*
ret float* %6
}
/* Variables and functions */
unsigned long long ULLONG_MAX;
int expect_unsigned_long_long_sum(unsigned long long (*f)(unsigned long long,
                                                          unsigned long long)) {
  return f(ULLONG_MAX - 1, 1) == ULLONG_MAX;
}


x86 assembly (clang, -O0):
<expect_unsigned_long_long_sum>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0x2ed1(%rip),%rcx
mov    (%rcx),%rdi
sub    $0x1,%rdi
mov    $0x1,%esi
call   *%rax
mov    0x2ebc(%rip),%rcx
cmp    (%rcx),%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<expect_unsigned_long_long_sum>:
push   %rbx
mov    %rdi,%rax
mov    0x2edd(%rip),%rbx
mov    (%rbx),%rdi
add    $0xffffffffffffffff,%rdi
mov    $0x1,%esi
call   *%rax
xor    %ecx,%ecx
cmp    (%rbx),%rax
sete   %cl
mov    %ecx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@ULLONG_MAX = global i64 0
define i32 @expect_unsigned_long_long_sum(i64 (i64, i64)* %0) {
%2 = alloca i64 (i64, i64)*
store i64 (i64, i64)* %0, i64 (i64, i64)** %2
%3 = load i64 (i64, i64)*, i64 (i64, i64)** %2
%4 = load i64, i64* @ULLONG_MAX
%5 = sub i64 %4, 1
%6 = call i64 %3(i64 %5, i64 1)
%7 = load i64, i64* @ULLONG_MAX
%8 = icmp eq i64 %6, %7
%9 = zext i1 %8 to i32
ret i32 %9
}

LLVM IR (-O2):
@ULLONG_MAX = global i64 0
define i32 @expect_unsigned_long_long_sum(i64 (i64, i64)* nocapture %0) {
%2 = load i64, i64* @ULLONG_MAX
%3 = add i64 %2, -1
%4 = tail call i64 %0(i64 %3, i64 1)
%5 = load i64, i64* @ULLONG_MAX
%6 = icmp eq i64 %4, %5
%7 = zext i1 %6 to i32
ret i32 %7
}
void RTStrATruncateTag(void) {}


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

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

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

LLVM IR (-O2):
define void @RTStrATruncateTag() {
ret void
}
void printstr(void *string) {
  printf("%s:%d: %s ("
         "%p->\"%s\""
         ")\n",
         "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
         "2022-01-22/02-19-57/repos/joshuapena/cmps012b-wm-w15/refs/heads/"
         "master/mackey/labs/lab9c-voidstar-generic/examples/stringproc.c",
         30, __func__, string, *(char **)string);
  ;
}


x86 assembly (clang, -O0):
<printstr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%r8
mov    -0x8(%rbp),%rax
mov    (%rax),%r9
lea    0xed2(%rip),%rdi
lea    0xee1(%rip),%rsi
mov    $0x1e,%edx
lea    0xf95(%rip),%rcx
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printstr>:
mov    %rdi,%r8
mov    (%rdi),%r9
lea    0xee3(%rip),%rdi
lea    0xef2(%rip),%rsi
lea    0xfab(%rip),%rcx
mov    $0x1e,%edx
xor    %eax,%eax
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [22 x i8] c"%s:%d: %s (%p->\22%s\22)\0A\00"
@.str.1 = [192 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/joshuapena/cmps012b-wm-w15/refs/heads/master/mackey/labs/lab9c-voidstar-generic/examples/stringproc.c\00"
@__func__.printstr = [9 x i8] c"printstr\00"
define void @printstr(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8*, i8** %2
%5 = bitcast i8* %4 to i8**
%6 = load i8*, i8** %5
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([192 x i8], [192 x i8]* @.str.1, i64 0, i64 0), i32 30, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @__func__.printstr, i64 0, i64 0), i8* %3, i8* %6)
ret void
}

LLVM IR (-O2):
@.str = [22 x i8] c"%s:%d: %s (%p->\22%s\22)\0A\00"
@.str.1 = [192 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/joshuapena/cmps012b-wm-w15/refs/heads/master/mackey/labs/lab9c-voidstar-generic/examples/stringproc.c\00"
@__func__.printstr = [9 x i8] c"printstr\00"
define void @printstr(i8* %0) {
%2 = bitcast i8* %0 to i8**
%3 = load i8*, i8** %2
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([192 x i8], [192 x i8]* @.str.1, i64 0, i64 0), i32 30, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @__func__.printstr, i64 0, i64 0), i8* %0, i8* %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printhelp(int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
void usage(void) {
  printhelp(stderr);
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
call   1040 <printhelp@plt>
mov    $0x1,%edi
call   1030 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
call   1040 <printhelp@plt>
mov    $0x1,%edi
call   1030 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @printhelp(i32 %1)
%3 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @printhelp(i32 %1)
%3 = tail call i32 @exit(i32 1)
unreachable
}
abs(x) { return (x < 0 ? -x : x); }


x86 assembly (clang, -O0):
<abs>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    111e <abs+0x1e>
xor    %eax,%eax
sub    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    1124 <abs+0x24>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @abs(i32 %0) {
%2 = tail call i32 @llvm.abs.i32(i32 %0, i1 true)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
void consoleCmdQuit() { exit(0); }


x86 assembly (clang, -O0):
<consoleCmdQuit>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1030 <exit@plt>

x86 assembly (clang, -O2):
<consoleCmdQuit>:
push   %rax
xor    %edi,%edi
call   1030 <exit@plt>

LLVM IR (-O0):
define void @consoleCmdQuit() {
%1 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define void @consoleCmdQuit() {
%1 = tail call i32 @exit(i32 0)
unreachable
}
rename(from, to) register char *from, *to;
{
  (void)unlink(to);
  if (link(from, to) < 0)
    return -1;
  (void)unlink(from);
  return 0;
}


x86 assembly (clang, -O0):
<rename>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    $0x0,%al
call   1030 <unlink@plt>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1040 <link@plt>
cmp    $0x0,%eax
jge    115f <rename+0x3f>
movl   $0xffffffff,-0x4(%rbp)
jmp    1171 <rename+0x51>
mov    -0x10(%rbp),%rdi
mov    $0x0,%al
call   1030 <unlink@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rename>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%rbp
mov    %rdi,%rbx
xor    %r14d,%r14d
mov    %rsi,%rdi
xor    %eax,%eax
call   1030 <unlink@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1040 <link@plt>
test   %eax,%eax
js     1154 <rename+0x34>
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <unlink@plt>
jmp    115a <rename+0x3a>
mov    $0xffffffff,%r14d
mov    %r14d,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @rename(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
%6 = load i8*, i8** %5
%7 = call i32 (i8*, ...) bitcast (i32 (...)* @unlink to i32 (i8*, ...)*)(i8* %6)
%8 = load i8*, i8** %4
%9 = load i8*, i8** %5
%10 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @link to i32 (i8*, i8*, ...)*)(i8* %8, i8* %9)
%11 = icmp slt i32 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %2
store i32 -1, i32* %3
br label %16
13: ; preds = %2
%14 = load i8*, i8** %4
%15 = call i32 (i8*, ...) bitcast (i32 (...)* @unlink to i32 (i8*, ...)*)(i8* %14)
store i32 0, i32* %3
br label %16
16: ; preds = %13, %12
%17 = load i32, i32* %3
ret i32 %17
}

LLVM IR (-O2):
define i32 @rename(i8* %0, i8* %1) {
%3 = tail call i32 (i8*, ...) bitcast (i32 (...)* @unlink to i32 (i8*, ...)*)(i8* %1)
%4 = tail call i32 (i8*, i8*, ...) bitcast (i32 (...)* @link to i32 (i8*, i8*, ...)*)(i8* %0, i8* %1)
%5 = icmp slt i32 %4, 0
br i1 %5, label %8, label %6
6: ; preds = %2
%7 = tail call i32 (i8*, ...) bitcast (i32 (...)* @unlink to i32 (i8*, ...)*)(i8* %0)
br label %8
8: ; preds = %2, %6
%9 = phi i32 [ 0, %6 ], [ -1, %2 ]
ret i32 %9
}
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct TYPE_3__ {
  int /*<<< orphan*/ *x_private;
  scalar_t__ x_base;
  scalar_t__ x_handy;
};
typedef TYPE_1__ XDR;

/* Variables and functions */
int /*<<< orphan*/ free(int /*<<< orphan*/ *);
void x_destroy(XDR *xdrs) {
  xdrs->x_handy = 0;
  xdrs->x_base = 0;
  if (xdrs->x_private) {
    free(xdrs->x_private);
    xdrs->x_private = NULL;
  }
  return;
}


x86 assembly (clang, -O0):
<x_destroy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movq   $0x0,0x10(%rax)
mov    -0x8(%rbp),%rax
movq   $0x0,0x8(%rax)
mov    -0x8(%rbp),%rax
cmpq   $0x0,(%rax)
je     1159 <x_destroy+0x49>
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
call   1030 <free@plt>
mov    -0x8(%rbp),%rax
movq   $0x0,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<x_destroy>:
push   %rbx
mov    %rdi,%rbx
xorps  %xmm0,%xmm0
movups %xmm0,0x8(%rdi)
mov    (%rdi),%rdi
test   %rdi,%rdi
je     112f <x_destroy+0x1f>
call   1030 <free@plt>
movq   $0x0,(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
%struct.TYPE_3__ = type { i32*, i64, i64 }
define void @x_destroy(%struct.TYPE_3__* %0) {
%2 = alloca %struct.TYPE_3__*
store %struct.TYPE_3__* %0, %struct.TYPE_3__** %2
%3 = load %struct.TYPE_3__*, %struct.TYPE_3__** %2
%4 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %3, i32 0, i32 2
store i64 0, i64* %4
%5 = load %struct.TYPE_3__*, %struct.TYPE_3__** %2
%6 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %5, i32 0, i32 1
store i64 0, i64* %6
%7 = load %struct.TYPE_3__*, %struct.TYPE_3__** %2
%8 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %7, i32 0, i32 0
%9 = load i32*, i32** %8
%10 = icmp ne i32* %9, null
br i1 %10, label %11, label %18
11: ; preds = %1
%12 = load %struct.TYPE_3__*, %struct.TYPE_3__** %2
%13 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %12, i32 0, i32 0
%14 = load i32*, i32** %13
%15 = call i32 @free(i32* %14)
%16 = load %struct.TYPE_3__*, %struct.TYPE_3__** %2
%17 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %16, i32 0, i32 0
store i32* null, i32** %17
br label %18
18: ; preds = %11, %1
ret void
}

LLVM IR (-O2):
%struct.TYPE_3__ = type { i32*, i64, i64 }
define void @x_destroy(%struct.TYPE_3__* nocapture %0) {
%2 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %0, i64 0, i32 1
%3 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %0, i64 0, i32 0
%4 = bitcast i64* %2 to i8*
%5 = load i32*, i32** %3
%6 = icmp eq i32* %5, null
br i1 %6, label %9, label %7
7: ; preds = %1
%8 = tail call i32 @free(i32* %5)
store i32* null, i32** %3
br label %9
9: ; preds = %7, %1
ret void
}
/* Variables and functions */
char spi_read(int);
char pfio_read_input(void) { return spi_read(0x13); }


x86 assembly (clang, -O0):
<pfio_read_input>:
push   %rbp
mov    %rsp,%rbp
mov    $0x13,%edi
call   1030 <spi_read@plt>
movsbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<pfio_read_input>:
mov    $0x13,%edi
jmp    1030 <spi_read@plt>

LLVM IR (-O0):
define signext i8 @pfio_read_input() {
%1 = call signext i8 @spi_read(i32 19)
ret i8 %1
}

LLVM IR (-O2):
define signext i8 @pfio_read_input() {
%1 = tail call signext i8 @spi_read(i32 19)
ret i8 %1
}
/* Variables and functions */
int /*<<< orphan*/ NDFC_WRITE_REG_INT(int /*<<< orphan*/);
void NFC_DmaIntDisable(void) { NDFC_WRITE_REG_INT(0); }


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

x86 assembly (clang, -O2):
<NFC_DmaIntDisable>:
xor    %edi,%edi
jmp    1030 <NDFC_WRITE_REG_INT@plt>

LLVM IR (-O0):
define void @NFC_DmaIntDisable() {
%1 = call i32 @NDFC_WRITE_REG_INT(i32 0)
ret void
}

LLVM IR (-O2):
define void @NFC_DmaIntDisable() {
%1 = tail call i32 @NDFC_WRITE_REG_INT(i32 0)
ret void
}
int foo(int y __attribute__((annotate("LocalValAnnotation")))) {
  int x __attribute__((annotate("LocalValAnnotation")));
  x = 34;
  return y + x;
}


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

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

LLVM IR (-O0):
@.str = [19 x i8] c"LocalValAnnotation\00", section "llvm.metadata"
@.str.1 = [62 x i8] c"/home/jiang/dataset/exebench/tmp/tmpw7qew4bg/formatted_code.c\00", section "llvm.metadata"
define i32 @foo(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = bitcast i32* %2 to i8*
%5 = bitcast i32* %3 to i8*
store i32 34, i32* %3
%6 = load i32, i32* %2
%7 = load i32, i32* %3
%8 = add nsw i32 %6, %7
ret i32 %8
}

LLVM IR (-O2):
@.str = [19 x i8] c"LocalValAnnotation\00", section "llvm.metadata"
@.str.1 = [62 x i8] c"/home/jiang/dataset/exebench/tmp/tmpw7qew4bg/formatted_code.c\00", section "llvm.metadata"
define i32 @foo(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %2 to i8*
%5 = bitcast i32* %3 to i8*
%6 = add nsw i32 %0, 34
ret i32 %6
}
/* Type definitions */
typedef int int16_t;

/* Variables and functions */
int get_bit_val(unsigned int *src, int16_t seq) {
  int x;
  x = src[seq / 32];
  x &= 1 << (seq % 32);
  return (x == 0) ? 0 : 1;
}


x86 assembly (clang, -O0):
<get_bit_val>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x20,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x20,%ecx
cltd
idiv   %ecx
mov    %edx,%ecx
mov    $0x1,%eax
shl    %cl,%eax
and    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%edx
mov    $0x1,%eax
xor    %ecx,%ecx
cmp    $0x0,%edx
cmove  %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_bit_val>:
mov    %esi,%ecx
lea    0x1f(%rcx),%eax
test   %esi,%esi
cmovns %esi,%eax
sar    $0x5,%eax
cltq
mov    (%rdi,%rax,4),%eax
shr    %cl,%eax
and    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @get_bit_val(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%6 = load i32*, i32** %3
%7 = load i32, i32* %4
%8 = sdiv i32 %7, 32
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds i32, i32* %6, i64 %9
%11 = load i32, i32* %10
store i32 %11, i32* %5
%12 = load i32, i32* %4
%13 = srem i32 %12, 32
%14 = shl i32 1, %13
%15 = load i32, i32* %5
%16 = and i32 %15, %14
store i32 %16, i32* %5
%17 = load i32, i32* %5
%18 = icmp eq i32 %17, 0
%19 = zext i1 %18 to i64
%20 = select i1 %18, i32 0, i32 1
ret i32 %20
}

LLVM IR (-O2):
define i32 @get_bit_val(i32* nocapture %0, i32 %1) {
%3 = sdiv i32 %1, 32
%4 = sext i32 %3 to i64
%5 = getelementptr inbounds i32, i32* %0, i64 %4
%6 = load i32, i32* %5
%7 = and i32 %1, 31
%8 = lshr i32 %6, %7
%9 = and i32 %8, 1
ret i32 %9
}
const char *class_str(int class) {
  switch (class) {
  case 1:
    return "Warrior";
  case 2:
    return "Wizard";
  case 3:
    return "Rogue";
  default:
    return "Unknown Class";
  }
}


x86 assembly (clang, -O0):
<class_str>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
sub    $0x1,%eax
je     113d <class_str+0x3d>
jmp    111b <class_str+0x1b>
mov    -0x10(%rbp),%eax
sub    $0x2,%eax
je     114d <class_str+0x4d>
jmp    112c <class_str+0x2c>
mov    -0x10(%rbp),%eax
sub    $0x3,%eax
je     115d <class_str+0x5d>
jmp    116d <class_str+0x6d>
lea    0xebc(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1178 <class_str+0x78>
lea    0xeb4(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1178 <class_str+0x78>
lea    0xeab(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1178 <class_str+0x78>
lea    0xea1(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<class_str>:
add    $0xffffffff,%edi
cmp    $0x2,%edi
ja     111a <class_str+0x1a>
movslq %edi,%rax
lea    0xf12(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
ret
lea    0xef4(%rip),%rax
ret

LLVM IR (-O0):
@.str = [8 x i8] c"Warrior\00"
@.str.1 = [7 x i8] c"Wizard\00"
@.str.2 = [6 x i8] c"Rogue\00"
@.str.3 = [14 x i8] c"Unknown Class\00"
define i8* @class_str(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %8 [
i32 1, label %5
i32 2, label %6
i32 3, label %7
]
5: ; preds = %1
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8** %2
br label %9
6: ; preds = %1
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %9
7: ; preds = %1
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %9
8: ; preds = %1
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %9
9: ; preds = %8, %7, %6, %5
%10 = load i8*, i8** %2
ret i8* %10
}

LLVM IR (-O2):
@.str = [8 x i8] c"Warrior\00"
@.str.1 = [7 x i8] c"Wizard\00"
@.str.2 = [6 x i8] c"Rogue\00"
@.str.3 = [14 x i8] c"Unknown Class\00"
@reltable.class_str = [3 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str to i64), i64 ptrtoint ([3 x i32]* @reltable.class_str to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.1 to i64), i64 ptrtoint ([3 x i32]* @reltable.class_str to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.2 to i64), i64 ptrtoint ([3 x i32]* @reltable.class_str to i64)) to i32)]
define i8* @class_str(i32 %0) {
%2 = add i32 %0, -1
%3 = icmp ult i32 %2, 3
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = sext i32 %2 to i64
%6 = shl i64 %5, 2
%7 = call i8* @llvm.load.relative.i64(i8* bitcast ([3 x i32]* @reltable.class_str to i8*), i64 %6)
br label %8
8: ; preds = %1, %4
%9 = phi i8* [ %7, %4 ], [ getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), %1 ]
ret i8* %9
}
void inputs(int pas, int ncell, int trial) {}


x86 assembly (clang, -O0):
<inputs>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @inputs(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
ret void
}

LLVM IR (-O2):
define void @inputs(i32 %0, i32 %1, i32 %2) {
ret void
}
void __attribute__((no)) HEX00_mathInit(void) {}


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

x86 assembly (clang, -O2):
ret

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

LLVM IR (-O2):
define void @HEX00_mathInit() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ semihost(int, void volatile *);
void emit(const char *buf) { semihost(0x04, (volatile void *)buf); }


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

x86 assembly (clang, -O2):
<emit>:
mov    %rdi,%rsi
mov    $0x4,%edi
jmp    1030 <semihost@plt>

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

LLVM IR (-O2):
define void @emit(i8* %0) {
%2 = tail call i32 @semihost(i32 4, i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, char, char);
void moveDisk(char fromPeg, char toPeg, int disk) {
  printf("Move the disk %d from \'%c\' to \'%c\'\n", disk, fromPeg, toPeg);
}


x86 assembly (clang, -O0):
<moveDisk>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
mov    %edx,-0x8(%rbp)
mov    -0x8(%rbp),%esi
mov    -0x1(%rbp),%al
lea    0xecc(%rip),%rdi
movsbl %al,%edx
movsbl -0x2(%rbp),%ecx
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<moveDisk>:
mov    %esi,%ecx
mov    %edi,%eax
lea    0xee5(%rip),%rdi
mov    %edx,%esi
mov    %eax,%edx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [36 x i8] c"Move the disk %d from '%c' to '%c'\0A\00"
define void @moveDisk(i8 signext %0, i8 signext %1, i32 %2) {
%4 = alloca i8
%5 = alloca i8
%6 = alloca i32
store i8 %0, i8* %4
store i8 %1, i8* %5
store i32 %2, i32* %6
%7 = load i32, i32* %6
%8 = load i8, i8* %4
%9 = load i8, i8* %5
%10 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %7, i8 signext %8, i8 signext %9)
ret void
}

LLVM IR (-O2):
@.str = [36 x i8] c"Move the disk %d from '%c' to '%c'\0A\00"
define void @moveDisk(i8 signext %0, i8 signext %1, i32 %2) {
%4 = tail call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %2, i8 signext %0, i8 signext %1)
ret void
}
void INT_Excep_MTU3_TGIA3(void) {}


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

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

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

LLVM IR (-O2):
define void @INT_Excep_MTU3_TGIA3() {
ret void
}
void rop3_68_1_0(unsigned char *D, unsigned char S, unsigned char T) {
  unsigned char stk1;
  unsigned char stk2;
  stk2 = ~*D;
  stk1 = S & stk2;
  *D = (stk1 & (~S)) | (*D & S);
}


x86 assembly (clang, -O0):
<rop3_68_1_0>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %sil,%cl
mov    %rdi,-0x8(%rbp)
mov    %cl,-0x9(%rbp)
mov    %al,-0xa(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
xor    $0xffffffff,%eax
mov    %al,-0xc(%rbp)
movzbl -0x9(%rbp),%eax
movzbl -0xc(%rbp),%ecx
and    %ecx,%eax
mov    %al,-0xb(%rbp)
movzbl -0xb(%rbp),%eax
movzbl -0x9(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl (%rcx),%ecx
movzbl -0x9(%rbp),%edx
and    %edx,%ecx
or     %ecx,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<rop3_68_1_0>:
and    %sil,(%rdi)
ret

LLVM IR (-O0):
define void @rop3_68_1_0(i8* %0, i8 zeroext %1, i8 zeroext %2) {
%4 = alloca i8*
%5 = alloca i8
%6 = alloca i8
%7 = alloca i8
%8 = alloca i8
store i8* %0, i8** %4
store i8 %1, i8* %5
store i8 %2, i8* %6
%9 = load i8*, i8** %4
%10 = load i8, i8* %9
%11 = zext i8 %10 to i32
%12 = xor i32 %11, -1
%13 = trunc i32 %12 to i8
store i8 %13, i8* %8
%14 = load i8, i8* %5
%15 = zext i8 %14 to i32
%16 = load i8, i8* %8
%17 = zext i8 %16 to i32
%18 = and i32 %15, %17
%19 = trunc i32 %18 to i8
store i8 %19, i8* %7
%20 = load i8, i8* %7
%21 = zext i8 %20 to i32
%22 = load i8, i8* %5
%23 = zext i8 %22 to i32
%24 = xor i32 %23, -1
%25 = and i32 %21, %24
%26 = load i8*, i8** %4
%27 = load i8, i8* %26
%28 = zext i8 %27 to i32
%29 = load i8, i8* %5
%30 = zext i8 %29 to i32
%31 = and i32 %28, %30
%32 = or i32 %25, %31
%33 = trunc i32 %32 to i8
%34 = load i8*, i8** %4
store i8 %33, i8* %34
ret void
}

LLVM IR (-O2):
define void @rop3_68_1_0(i8* nocapture %0, i8 zeroext %1, i8 zeroext %2) {
%4 = load i8, i8* %0
%5 = and i8 %4, %1
store i8 %5, i8* %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int foo() {
  if (1 == 1) {
  } else {
    int w;
    w = w;
    assert(w == w);
    w = w == w;
    assert(w == 1);
  }
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @foo() {
ret i32 0
}
/* Variables and functions */
int *get_random_arr(int);
int /*<<< orphan*/ half_sort(int *, int);
int /*<<< orphan*/ show(int *, int);
int main() {
  int len = 25;
  int *arr = get_random_arr(len);
  show(arr, len);
  half_sort(arr, len);
  show(arr, len);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x19,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <get_random_arr@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%esi
call   1040 <show@plt>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%esi
call   1050 <half_sort@plt>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%esi
call   1040 <show@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x19,%edi
call   1030 <get_random_arr@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    $0x19,%esi
call   1040 <show@plt>
mov    %rbx,%rdi
mov    $0x19,%esi
call   1050 <half_sort@plt>
mov    %rbx,%rdi
mov    $0x19,%esi
call   1040 <show@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32*
store i32 0, i32* %1
store i32 25, i32* %2
%4 = load i32, i32* %2
%5 = call i32* @get_random_arr(i32 %4)
store i32* %5, i32** %3
%6 = load i32*, i32** %3
%7 = load i32, i32* %2
%8 = call i32 @show(i32* %6, i32 %7)
%9 = load i32*, i32** %3
%10 = load i32, i32* %2
%11 = call i32 @half_sort(i32* %9, i32 %10)
%12 = load i32*, i32** %3
%13 = load i32, i32* %2
%14 = call i32 @show(i32* %12, i32 %13)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32* @get_random_arr(i32 25)
%2 = tail call i32 @show(i32* %1, i32 25)
%3 = tail call i32 @half_sort(i32* %1, i32 25)
%4 = tail call i32 @show(i32* %1, i32 25)
ret i32 0
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
void EPINonBlockingReadStart(uint32_t ui32Base, uint32_t ui32Channel,
                             uint32_t ui32Count) {
  uint32_t ui32Offset;
  ;
  ;
  ;
  ui32Offset = ui32Channel * (0x00000038 - 0x00000028);
  (*((volatile unsigned long *)(ui32Base + 0x00000028 + ui32Offset))) =
      ui32Count;
}


x86 assembly (clang, -O0):
<EPINonBlockingReadStart>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x8(%rbp),%eax
shl    $0x4,%eax
mov    %eax,-0x10(%rbp)
movslq -0xc(%rbp),%rcx
mov    -0x4(%rbp),%eax
add    $0x28,%eax
add    -0x10(%rbp),%eax
cltq
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<EPINonBlockingReadStart>:
movslq %esi,%rax
shl    $0x4,%rax
movslq %edx,%rcx
movslq %edi,%rdx
mov    %rcx,0x28(%rdx,%rax,1)
ret

LLVM IR (-O0):
define void @EPINonBlockingReadStart(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* %5
%9 = mul nsw i32 %8, 16
store i32 %9, i32* %7
%10 = load i32, i32* %6
%11 = sext i32 %10 to i64
%12 = load i32, i32* %4
%13 = add nsw i32 %12, 40
%14 = load i32, i32* %7
%15 = add nsw i32 %13, %14
%16 = sext i32 %15 to i64
%17 = inttoptr i64 %16 to i64*
store volatile i64 %11, i64* %17
ret void
}

LLVM IR (-O2):
define void @EPINonBlockingReadStart(i32 %0, i32 %1, i32 %2) {
%4 = shl nsw i32 %1, 4
%5 = sext i32 %2 to i64
%6 = add nsw i32 %0, 40
%7 = add nsw i32 %6, %4
%8 = sext i32 %7 to i64
%9 = inttoptr i64 %8 to i64*
store volatile i64 %5, i64* %9
ret void
}
void lgtd_lifx_bulb_set_product_info(
    struct lgtd_lifx_bulb *bulb, const struct lgtd_lifx_product_info *info) {
  (void)bulb;
  (void)info;
}


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

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

LLVM IR (-O0):
%struct.lgtd_lifx_bulb = type opaque
%struct.lgtd_lifx_product_info = type opaque
define void @lgtd_lifx_bulb_set_product_info(%struct.lgtd_lifx_bulb* %0, %struct.lgtd_lifx_product_info* %1) {
%3 = alloca %struct.lgtd_lifx_bulb*
%4 = alloca %struct.lgtd_lifx_product_info*
store %struct.lgtd_lifx_bulb* %0, %struct.lgtd_lifx_bulb** %3
store %struct.lgtd_lifx_product_info* %1, %struct.lgtd_lifx_product_info** %4
%5 = load %struct.lgtd_lifx_bulb*, %struct.lgtd_lifx_bulb** %3
%6 = load %struct.lgtd_lifx_product_info*, %struct.lgtd_lifx_product_info** %4
ret void
}

LLVM IR (-O2):
%struct.lgtd_lifx_bulb = type opaque
%struct.lgtd_lifx_product_info = type opaque
define void @lgtd_lifx_bulb_set_product_info(%struct.lgtd_lifx_bulb* nocapture %0, %struct.lgtd_lifx_product_info* nocapture %1) {
ret void
}
/* Variables and functions */
int getpid();
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char **argv) {
  printf("Hello world from process id %d\n", getpid());
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %eax,%esi
lea    0xeba(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <getpid@plt>
lea    0xed1(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [32 x i8] c"Hello world from process id %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 (...) @getpid()
%7 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 %6)
ret i32 0
}

LLVM IR (-O2):
@.str = [32 x i8] c"Hello world from process id %d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @getpid()
%4 = tail call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 %3)
ret i32 0
}