xunge/DecIR huggingface dataset:
/* Type definitions */
struct spec_scaler {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct spec_scaler *);
void spec_destroy(struct spec_scaler *p) { free(p); }


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

x86 assembly (clang, -O2):
<spec_destroy>:
jmp    1030 <free@plt>

LLVM IR (-O0):
%struct.spec_scaler = type { i32 }
define void @spec_destroy(%struct.spec_scaler* %0) {
%2 = alloca %struct.spec_scaler*
store %struct.spec_scaler* %0, %struct.spec_scaler** %2
%3 = load %struct.spec_scaler*, %struct.spec_scaler** %2
%4 = call i32 @free(%struct.spec_scaler* %3)
ret void
}

LLVM IR (-O2):
%struct.spec_scaler = type { i32 }
define void @spec_destroy(%struct.spec_scaler* nocapture %0) {
%2 = tail call i32 @free(%struct.spec_scaler* %0)
ret void
}
double f5(double x) { return __builtin_log(x); }


x86 assembly (clang, -O0):
<f5>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <log@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f5>:
jmp    1030 <log@plt>

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

LLVM IR (-O2):
define double @f5(double %0) {
%2 = tail call double @log(double %0)
ret double %2
}
int test_imm_DCint8_reg(signed char val) {
  return ((val) & (0xDC << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_DCint8_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edx
and    $0xdc,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @test_imm_DCint8_reg(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = and i32 %4, 220
%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_DCint8_reg(i8 signext %0) {
%2 = and i8 %0, -36
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
void arrswap(int arr[], int pos1, int pos2) {
  arr[pos1] ^= arr[pos2];
  arr[pos2] ^= arr[pos1];
  arr[pos1] ^= arr[pos2];
}


x86 assembly (clang, -O0):
<arrswap>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
xor    (%rax,%rcx,4),%edx
mov    %edx,(%rax,%rcx,4)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
xor    (%rax,%rcx,4),%edx
mov    %edx,(%rax,%rcx,4)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
xor    (%rax,%rcx,4),%edx
mov    %edx,(%rax,%rcx,4)
pop    %rbp
ret

x86 assembly (clang, -O2):
<arrswap>:
movslq %edx,%rax
movslq %esi,%rcx
mov    (%rdi,%rcx,4),%edx
xor    (%rdi,%rax,4),%edx
mov    %edx,(%rdi,%rcx,4)
xor    (%rdi,%rax,4),%edx
mov    %edx,(%rdi,%rax,4)
xor    %edx,(%rdi,%rcx,4)
ret

LLVM IR (-O0):
define void @arrswap(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32*, i32** %4
%8 = load i32, i32* %6
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds i32, i32* %7, i64 %9
%11 = load i32, i32* %10
%12 = load i32*, i32** %4
%13 = load i32, i32* %5
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i32, i32* %12, i64 %14
%16 = load i32, i32* %15
%17 = xor i32 %16, %11
store i32 %17, i32* %15
%18 = load i32*, i32** %4
%19 = load i32, i32* %5
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i32, i32* %18, i64 %20
%22 = load i32, i32* %21
%23 = load i32*, i32** %4
%24 = load i32, i32* %6
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i32, i32* %23, i64 %25
%27 = load i32, i32* %26
%28 = xor i32 %27, %22
store i32 %28, i32* %26
%29 = load i32*, i32** %4
%30 = load i32, i32* %6
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds i32, i32* %29, i64 %31
%33 = load i32, i32* %32
%34 = load i32*, i32** %4
%35 = load i32, i32* %5
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds i32, i32* %34, i64 %36
%38 = load i32, i32* %37
%39 = xor i32 %38, %33
store i32 %39, i32* %37
ret void
}

LLVM IR (-O2):
define void @arrswap(i32* nocapture %0, i32 %1, i32 %2) {
%4 = sext i32 %2 to i64
%5 = getelementptr inbounds i32, i32* %0, i64 %4
%6 = load i32, i32* %5
%7 = sext i32 %1 to i64
%8 = getelementptr inbounds i32, i32* %0, i64 %7
%9 = load i32, i32* %8
%10 = xor i32 %9, %6
store i32 %10, i32* %8
%11 = load i32, i32* %5
%12 = xor i32 %11, %10
store i32 %12, i32* %5
%13 = load i32, i32* %8
%14 = xor i32 %13, %12
store i32 %14, i32* %8
ret void
}
void sig_alarm(int signo) { return; }


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

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

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

LLVM IR (-O2):
define void @sig_alarm(i32 %0) {
ret void
}
int char_is_lower(char c) {
  int ascii = (int)c;
  if (ascii > 96 && ascii < 123) {
    return 1;
  } else {
    return 0;
  }
}


x86 assembly (clang, -O0):
<char_is_lower>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x60,-0xc(%rbp)
jle    1131 <char_is_lower+0x31>
cmpl   $0x7b,-0xc(%rbp)
jge    1131 <char_is_lower+0x31>
movl   $0x1,-0x4(%rbp)
jmp    1138 <char_is_lower+0x38>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<char_is_lower>:
add    $0x9f,%dil
xor    %eax,%eax
cmp    $0x1a,%dil
setb   %al
ret

LLVM IR (-O0):
define i32 @char_is_lower(i8 signext %0) {
%2 = alloca i32
%3 = alloca i8
%4 = alloca i32
store i8 %0, i8* %3
%5 = load i8, i8* %3
%6 = sext i8 %5 to i32
store i32 %6, i32* %4
%7 = load i32, i32* %4
%8 = icmp sgt i32 %7, 96
br i1 %8, label %9, label %13
9: ; preds = %1
%10 = load i32, i32* %4
%11 = icmp slt i32 %10, 123
br i1 %11, label %12, label %13
12: ; preds = %9
store i32 1, i32* %2
br label %14
13: ; preds = %9, %1
store i32 0, i32* %2
br label %14
14: ; preds = %13, %12
%15 = load i32, i32* %2
ret i32 %15
}

LLVM IR (-O2):
define i32 @char_is_lower(i8 signext %0) {
%2 = add i8 %0, -97
%3 = icmp ult i8 %2, 26
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Type definitions */
struct timeval {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ timerclear(struct timeval *);
void inter_immed(struct timeval **tv_io, struct timeval *tvbuf) {
  struct timeval *rbuf;
  if (!tv_io)
    return;
  rbuf = *tv_io;
  if (!rbuf) {
    *tv_io = rbuf = tvbuf;
  }
  timerclear(rbuf);
}


x86 assembly (clang, -O0):
<inter_immed>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1130 <inter_immed+0x20>
jmp    115e <inter_immed+0x4e>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1155 <inter_immed+0x45>
mov    -0x10(%rbp),%rcx
mov    %rcx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rdi
call   1030 <timerclear@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<inter_immed>:
test   %rdi,%rdi
je     1125 <inter_immed+0x15>
mov    (%rdi),%rax
test   %rax,%rax
je     1126 <inter_immed+0x16>
mov    %rax,%rdi
jmp    1030 <timerclear@plt>
ret
mov    %rsi,(%rdi)
mov    %rsi,%rax
mov    %rax,%rdi
jmp    1030 <timerclear@plt>

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

LLVM IR (-O2):
%struct.timeval = type { i32 }
define void @inter_immed(%struct.timeval** %0, %struct.timeval* %1) {
%3 = icmp eq %struct.timeval** %0, null
br i1 %3, label %11, label %4
4: ; preds = %2
%5 = load %struct.timeval*, %struct.timeval** %0
%6 = icmp eq %struct.timeval* %5, null
br i1 %6, label %7, label %8
7: ; preds = %4
store %struct.timeval* %1, %struct.timeval** %0
br label %8
8: ; preds = %7, %4
%9 = phi %struct.timeval* [ %5, %4 ], [ %1, %7 ]
%10 = tail call i32 @timerclear(%struct.timeval* %9)
br label %11
11: ; preds = %2, %8
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(unsigned int *);
void smootheningCleanEdges(unsigned int *edges, unsigned int *numedges) {
  free(edges);
  free(numedges);
}


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

x86 assembly (clang, -O2):
<smootheningCleanEdges>:
push   %rbx
mov    %rsi,%rbx
call   1030 <free@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @smootheningCleanEdges(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 @free(i32* %5)
%7 = load i32*, i32** %4
%8 = call i32 @free(i32* %7)
ret void
}

LLVM IR (-O2):
define void @smootheningCleanEdges(i32* nocapture %0, i32* nocapture %1) {
%3 = tail call i32 @free(i32* %0)
%4 = tail call i32 @free(i32* %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(unsigned char *, char *, int);
int ccnl_pkt_mkComponent(int suite, unsigned char *dst, char *src, int srclen) {
  int len = 0;
  switch (suite) {
  default:
    len = srclen;
    memcpy(dst, src, len);
    break;
  }
  return len;
}


x86 assembly (clang, -O0):
<ccnl_pkt_mkComponent>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%edx
call   1030 <memcpy@plt>
mov    -0x20(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ccnl_pkt_mkComponent>:
push   %rbx
mov    %ecx,%ebx
mov    %rsi,%rdi
mov    %rdx,%rsi
mov    %ecx,%edx
call   1030 <memcpy@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @ccnl_pkt_mkComponent(i32 %0, i8* %1, i8* %2, i32 %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
store i32 %0, i32* %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i32 %3, i32* %8
store i32 0, i32* %9
%10 = load i32, i32* %5
switch i32 %10, label %11 [
]
11: ; preds = %4
%12 = load i32, i32* %8
store i32 %12, i32* %9
%13 = load i8*, i8** %6
%14 = load i8*, i8** %7
%15 = load i32, i32* %9
%16 = call i32 @memcpy(i8* %13, i8* %14, i32 %15)
br label %17
17: ; preds = %11
%18 = load i32, i32* %9
ret i32 %18
}

LLVM IR (-O2):
define i32 @ccnl_pkt_mkComponent(i32 %0, i8* %1, i8* %2, i32 returned %3) {
%5 = tail call i32 @memcpy(i8* %1, i8* %2, i32 %3)
ret i32 %3
}
/* Variables and functions */
size_t max(const int a, const int b) { return a > b ? a : b; }


x86 assembly (clang, -O0):
<max>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    1121 <max+0x21>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1127 <max+0x27>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cltq
pop    %rbp
ret

x86 assembly (clang, -O2):
<max>:
cmp    %esi,%edi
cmovg  %edi,%esi
movslq %esi,%rax
ret

LLVM IR (-O0):
define i64 @max(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 = load i32, i32* %4
%7 = icmp sgt i32 %5, %6
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load i32, i32* %3
br label %12
10: ; preds = %2
%11 = load i32, i32* %4
br label %12
12: ; preds = %10, %8
%13 = phi i32 [ %9, %8 ], [ %11, %10 ]
%14 = sext i32 %13 to i64
ret i64 %14
}

LLVM IR (-O2):
define i64 @max(i32 %0, i32 %1) {
%3 = icmp sgt i32 %0, %1
%4 = select i1 %3, i32 %0, i32 %1
%5 = sext i32 %4 to i64
ret i64 %5
}
/* Variables and functions */
int /*<<< orphan*/ getLine(char *, int);
int /*<<< orphan*/ printWardialHeader();
void wardialExecute() {
  char command[80];
  printWardialHeader();
  getLine(command, 80);
}


x86 assembly (clang, -O0):
<wardialExecute>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    $0x0,%al
call   1040 <printWardialHeader@plt>
lea    -0x50(%rbp),%rdi
mov    $0x50,%esi
call   1030 <getLine@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wardialExecute>:
sub    $0x58,%rsp
xor    %eax,%eax
call   1040 <printWardialHeader@plt>
mov    %rsp,%rdi
mov    $0x50,%esi
call   1030 <getLine@plt>
add    $0x58,%rsp
ret

LLVM IR (-O0):
define void @wardialExecute() {
%1 = alloca [80 x i8]
%2 = call i32 (...) @printWardialHeader()
%3 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%4 = call i32 @getLine(i8* %3, i32 80)
ret void
}

LLVM IR (-O2):
define void @wardialExecute() {
%1 = alloca [80 x i8]
%2 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%3 = tail call i32 (...) @printWardialHeader()
%4 = call i32 @getLine(i8* %2, i32 80)
ret void
}
int unorderedLinearSearch(int A[], int n, int data) {
  for (int i = 0; i < n; i++) {
    if (A[i] == data)
      return i;
  }
  return -1;
}


x86 assembly (clang, -O0):
<unorderedLinearSearch>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1153 <unorderedLinearSearch+0x53>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
cmp    -0x18(%rbp),%eax
jne    1140 <unorderedLinearSearch+0x40>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    115a <unorderedLinearSearch+0x5a>
jmp    1145 <unorderedLinearSearch+0x45>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1115 <unorderedLinearSearch+0x15>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<unorderedLinearSearch>:
mov    $0xffffffff,%eax
test   %esi,%esi
jle    111e <unorderedLinearSearch+0x1e>
mov    %esi,%esi
xor    %ecx,%ecx
nopl   (%rax)
cmp    %edx,(%rdi,%rcx,4)
je     111f <unorderedLinearSearch+0x1f>
add    $0x1,%rcx
cmp    %rcx,%rsi
jne    1110 <unorderedLinearSearch+0x10>
ret
mov    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @unorderedLinearSearch(i32* nocapture %0, i32 %1, i32 %2) {
%4 = icmp sgt i32 %1, 0
br i1 %4, label %5, label %17
5: ; preds = %3
%6 = zext i32 %1 to i64
br label %7
7: ; preds = %5, %12
%8 = phi i64 [ 0, %5 ], [ %13, %12 ]
%9 = getelementptr inbounds i32, i32* %0, i64 %8
%10 = load i32, i32* %9
%11 = icmp eq i32 %10, %2
br i1 %11, label %15, label %12
12: ; preds = %7
%13 = add nuw nsw i64 %8, 1
%14 = icmp eq i64 %13, %6
br i1 %14, label %17, label %7
15: ; preds = %7
%16 = trunc i64 %8 to i32
br label %17
17: ; preds = %12, %15, %3
%18 = phi i32 [ -1, %3 ], [ %16, %15 ], [ -1, %12 ]
ret i32 %18
}
/* Variables and functions */
int /*<<< orphan*/ tio_init_terminal();
void menu_init(void) { tio_init_terminal(); }


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

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

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

LLVM IR (-O2):
define void @menu_init() {
%1 = tail call i32 (...) @tio_init_terminal()
ret void
}
AX0I1(r0, r1, x0, x1, p0, p1) char r0, r1;
char *p0, *p1;
{ (((char *)10000000)[x0]) = 33; }


x86 assembly (clang, -O0):
<AX0I1>:
push   %rbp
mov    %rsp,%rbp
mov    %esi,%eax
mov    %dil,%sil
mov    %sil,-0x5(%rbp)
mov    %al,-0x6(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8,-0x18(%rbp)
mov    %r9,-0x20(%rbp)
movslq -0xc(%rbp),%rcx
mov    $0x989680,%eax
movb   $0x21,(%rax,%rcx,1)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<AX0I1>:
movslq %edx,%rax
movb   $0x21,0x989680(%rax)
ret

LLVM IR (-O0):
define i32 @AX0I1(i32 %0, i32 %1, i32 %2, i32 %3, i8* %4, i8* %5) {
%7 = alloca i32
%8 = alloca i8
%9 = alloca i8
%10 = alloca i32
%11 = alloca i32
%12 = alloca i8*
%13 = alloca i8*
%14 = trunc i32 %0 to i8
%15 = trunc i32 %1 to i8
store i8 %14, i8* %8
store i8 %15, i8* %9
store i32 %2, i32* %10
store i32 %3, i32* %11
store i8* %4, i8** %12
store i8* %5, i8** %13
%16 = load i32, i32* %10
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8, i8* inttoptr (i64 10000000 to i8*), i64 %17
store i8 33, i8* %18
%19 = load i32, i32* %7
ret i32 %19
}

LLVM IR (-O2):
define i32 @AX0I1(i32 %0, i32 %1, i32 %2, i32 %3, i8* nocapture readnone %4, i8* nocapture readnone %5) {
%7 = sext i32 %2 to i64
%8 = getelementptr inbounds i8, i8* inttoptr (i64 10000000 to i8*), i64 %7
store i8 33, i8* %8
ret i32 undef
}
char *get_name(int turn) { return turn ? "Bob" : "Alice"; }


x86 assembly (clang, -O0):
<get_name>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
lea    0xef3(%rip),%rax
lea    0xee8(%rip),%rcx
cmp    $0x0,%edx
cmovne %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_name>:
test   %edi,%edi
lea    0xefb(%rip),%rcx
lea    0xef0(%rip),%rax
cmove  %rcx,%rax
ret

LLVM IR (-O0):
@.str = [4 x i8] c"Bob\00"
@.str.1 = [6 x i8] c"Alice\00"
define i8* @get_name(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp ne i32 %3, 0
%5 = zext i1 %4 to i64
%6 = select i1 %4, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0)
ret i8* %6
}

LLVM IR (-O2):
@.str = [4 x i8] c"Bob\00"
@.str.1 = [6 x i8] c"Alice\00"
define i8* @get_name(i32 %0) {
%2 = icmp eq i32 %0, 0
%3 = select i1 %2, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0)
ret i8* %3
}
/* Type definitions */
struct token_bucket_ratelimit_state {
  int dummy;
};

/* Variables and functions */
int tb_ratelimit_allow_n(int, struct token_bucket_ratelimit_state *);
bool tb_ratelimit_allow(struct token_bucket_ratelimit_state *tbrs) {
  return tb_ratelimit_allow_n(1, tbrs);
}


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

x86 assembly (clang, -O2):
<tb_ratelimit_allow>:
mov    %rdi,%rsi
mov    $0x1,%edi
jmp    1030 <tb_ratelimit_allow_n@plt>

LLVM IR (-O0):
%struct.token_bucket_ratelimit_state = type { i32 }
define i32 @tb_ratelimit_allow(%struct.token_bucket_ratelimit_state* %0) {
%2 = alloca %struct.token_bucket_ratelimit_state*
store %struct.token_bucket_ratelimit_state* %0, %struct.token_bucket_ratelimit_state** %2
%3 = load %struct.token_bucket_ratelimit_state*, %struct.token_bucket_ratelimit_state** %2
%4 = call i32 @tb_ratelimit_allow_n(i32 1, %struct.token_bucket_ratelimit_state* %3)
ret i32 %4
}

LLVM IR (-O2):
%struct.token_bucket_ratelimit_state = type { i32 }
define i32 @tb_ratelimit_allow(%struct.token_bucket_ratelimit_state* %0) {
%2 = tail call i32 @tb_ratelimit_allow_n(i32 1, %struct.token_bucket_ratelimit_state* %0)
ret i32 %2
}
int p(int m, int n, int r) {
  if (r > 0) {
    return p(m, r - 1, n);
  } else {
    if (n > 0) {
      return p(r, n - 1, m);
    } else {
      return m;
    }
  }
}


x86 assembly (clang, -O0):
<p>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jle    1144 <p+0x34>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%esi
sub    $0x1,%esi
mov    -0xc(%rbp),%edx
call   1030 <p@plt>
mov    %eax,-0x4(%rbp)
jmp    116d <p+0x5d>
cmpl   $0x0,-0xc(%rbp)
jle    1167 <p+0x57>
mov    -0x10(%rbp),%edi
mov    -0xc(%rbp),%esi
sub    $0x1,%esi
mov    -0x8(%rbp),%edx
call   1030 <p@plt>
mov    %eax,-0x4(%rbp)
jmp    116d <p+0x5d>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<p>:
mov    %edx,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %eax,%ecx
mov    %edi,%eax
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %ecx,%edi
mov    %esi,%ecx
lea    -0x1(%rdi),%esi
test   %edi,%edi
jg     1120 <p+0x20>
lea    -0x1(%rcx),%esi
test   %ecx,%ecx
jg     1110 <p+0x10>
ret

LLVM IR (-O0):
define i32 @p(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
%8 = load i32, i32* %7
%9 = icmp sgt i32 %8, 0
br i1 %9, label %10, label %16
10: ; preds = %3
%11 = load i32, i32* %5
%12 = load i32, i32* %7
%13 = sub nsw i32 %12, 1
%14 = load i32, i32* %6
%15 = call i32 @p(i32 %11, i32 %13, i32 %14)
store i32 %15, i32* %4
br label %27
16: ; preds = %3
%17 = load i32, i32* %6
%18 = icmp sgt i32 %17, 0
br i1 %18, label %19, label %25
19: ; preds = %16
%20 = load i32, i32* %7
%21 = load i32, i32* %6
%22 = sub nsw i32 %21, 1
%23 = load i32, i32* %5
%24 = call i32 @p(i32 %20, i32 %22, i32 %23)
store i32 %24, i32* %4
br label %27
25: ; preds = %16
%26 = load i32, i32* %5
store i32 %26, i32* %4
br label %27
27: ; preds = %25, %19, %10
%28 = load i32, i32* %4
ret i32 %28
}

LLVM IR (-O2):
define i32 @p(i32 %0, i32 %1, i32 %2) {
br label %4
4: ; preds = %13, %3
%5 = phi i32 [ %10, %13 ], [ %0, %3 ]
%6 = phi i32 [ %15, %13 ], [ %1, %3 ]
%7 = phi i32 [ %5, %13 ], [ %2, %3 ]
br label %8
8: ; preds = %8, %4
%9 = phi i32 [ %12, %8 ], [ %6, %4 ]
%10 = phi i32 [ %9, %8 ], [ %7, %4 ]
%11 = icmp sgt i32 %10, 0
%12 = add nsw i32 %10, -1
br i1 %11, label %8, label %13
13: ; preds = %8
%14 = icmp sgt i32 %9, 0
%15 = add nsw i32 %9, -1
br i1 %14, label %4, label %16
16: ; preds = %13
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ ruspma_setup_default_symbols();
int /*<<< orphan*/ ruspma_setup_symbol_constants();
void ruspma_setup_symbols() {
  ruspma_setup_symbol_constants();
  ruspma_setup_default_symbols();
}


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

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

LLVM IR (-O0):
define void @ruspma_setup_symbols() {
%1 = call i32 (...) @ruspma_setup_symbol_constants()
%2 = call i32 (...) @ruspma_setup_default_symbols()
ret void
}

LLVM IR (-O2):
define void @ruspma_setup_symbols() {
%1 = tail call i32 (...) @ruspma_setup_symbol_constants()
%2 = tail call i32 (...) @ruspma_setup_default_symbols()
ret void
}
unsigned int palindrome(unsigned long number) {
  unsigned long temp = number, total = 0;
  while (temp != 0) {
    unsigned long temp_1 = temp % 10;
    temp /= 10;
    total = 10 * total + temp_1;
  }
  if (total == number)
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<palindrome>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1159 <palindrome+0x59>
mov    -0x18(%rbp),%rax
mov    $0xa,%ecx
xor    %edx,%edx
div    %rcx
mov    %rdx,-0x28(%rbp)
mov    -0x18(%rbp),%rax
mov    $0xa,%ecx
xor    %edx,%edx
div    %rcx
mov    %rax,-0x18(%rbp)
imul   $0xa,-0x20(%rbp),%rax
add    -0x28(%rbp),%rax
mov    %rax,-0x20(%rbp)
jmp    1118 <palindrome+0x18>
mov    -0x20(%rbp),%rax
cmp    -0x10(%rbp),%rax
jne    1173 <palindrome+0x73>
movl   $0x1,-0x4(%rbp)
jmp    117a <palindrome+0x7a>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<palindrome>:
xor    %r9d,%r9d
test   %rdi,%rdi
je     1149 <palindrome+0x49>
movabs $0xcccccccccccccccd,%r8
cc cc cc
mov    %rdi,%rsi
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rsi,%rax
mul    %r8
shr    $0x3,%rdx
lea    (%rdx,%rdx,1),%rax
lea    (%rax,%rax,4),%rax
mov    %rsi,%rcx
sub    %rax,%rcx
lea    (%r9,%r9,4),%rax
lea    (%rcx,%rax,2),%r9
cmp    $0x9,%rsi
mov    %rdx,%rsi
ja     1120 <palindrome+0x20>
xor    %eax,%eax
cmp    %rdi,%r9
sete   %al
ret

LLVM IR (-O0):
define i32 @palindrome(i64 %0) {
%2 = alloca i32
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
store i64 %0, i64* %3
%7 = load i64, i64* %3
store i64 %7, i64* %4
store i64 0, i64* %5
br label %8
8: ; preds = %11, %1
%9 = load i64, i64* %4
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %20
11: ; preds = %8
%12 = load i64, i64* %4
%13 = urem i64 %12, 10
store i64 %13, i64* %6
%14 = load i64, i64* %4
%15 = udiv i64 %14, 10
store i64 %15, i64* %4
%16 = load i64, i64* %5
%17 = mul i64 10, %16
%18 = load i64, i64* %6
%19 = add i64 %17, %18
store i64 %19, i64* %5
br label %8
20: ; preds = %8
%21 = load i64, i64* %5
%22 = load i64, i64* %3
%23 = icmp eq i64 %21, %22
br i1 %23, label %24, label %25
24: ; preds = %20
store i32 1, i32* %2
br label %26
25: ; preds = %20
store i32 0, i32* %2
br label %26
26: ; preds = %25, %24
%27 = load i32, i32* %2
ret i32 %27
}

LLVM IR (-O2):
define i32 @palindrome(i64 %0) {
%2 = icmp eq i64 %0, 0
br i1 %2, label %11, label %3
3: ; preds = %1, %3
%4 = phi i64 [ %9, %3 ], [ 0, %1 ]
%5 = phi i64 [ %7, %3 ], [ %0, %1 ]
%6 = urem i64 %5, 10
%7 = udiv i64 %5, 10
%8 = mul i64 %4, 10
%9 = add i64 %8, %6
%10 = icmp ult i64 %5, 10
br i1 %10, label %11, label %3
11: ; preds = %3, %1
%12 = phi i64 [ 0, %1 ], [ %9, %3 ]
%13 = icmp eq i64 %12, %0
%14 = zext i1 %13 to i32
ret i32 %14
}
int test_imm_22uint8_reg(unsigned char val) {
  return ((val) & (-0x22 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_22uint8_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%edx
and    $0xffffffde,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @test_imm_22uint8_reg(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = zext i8 %3 to i32
%5 = and i32 %4, -34
%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_22uint8_reg(i8 zeroext %0) {
%2 = and i8 %0, -34
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(int argc, char *argv[]) {
  if (argc > 2) {
    printf("This is a triangle");
  } else {
    printf("This is a diamond");
  }
  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)
cmpl   $0x2,-0x8(%rbp)
jle    1141 <main+0x31>
lea    0xec9(%rip),%rdi
call   1030 <printf@plt>
jmp    114d <main+0x3d>
lea    0xecb(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
cmp    $0x3,%edi
lea    0xee5(%rip),%rax
lea    0xef1(%rip),%rdi
cmovge %rax,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [19 x i8] c"This is a triangle\00"
@.str.1 = [18 x i8] c"This is a diamond\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 = load i32, i32* %4
%7 = icmp sgt i32 %6, 2
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
br label %12
10: ; preds = %2
%11 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
br label %12
12: ; preds = %10, %8
ret i32 0
}

LLVM IR (-O2):
@.str = [19 x i8] c"This is a triangle\00"
@.str.1 = [18 x i8] c"This is a diamond\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = icmp sgt i32 %0, 2
%4 = select i1 %3, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0)
%5 = tail call i32 @printf(i8* dereferenceable(1) %4)
ret i32 0
}
int c043(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @c043() {
ret i32 0
}
/* Type definitions */
struct in_addr {
  int /*<<< orphan*/ s_addr;
};
typedef int /*<<< orphan*/ in_addr_t;

/* Variables and functions */
int /*<<< orphan*/ htonl(int /*<<< orphan*/);
char *inet_ntoa(struct in_addr);
int /*<<< orphan*/ printf(char *, char *);
void printaddr(in_addr_t addr) {
  struct in_addr in;
  in.s_addr = htonl(addr);
  printf("%s", inet_ntoa(in));
}


x86 assembly (clang, -O0):
<printaddr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1050 <htonl@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <inet_ntoa@plt>
mov    %rax,%rsi
lea    0xea8(%rip),%rdi
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printaddr>:
push   %rax
call   1050 <htonl@plt>
mov    %eax,%edi
call   1030 <inet_ntoa@plt>
lea    0xebc(%rip),%rdi
mov    %rax,%rsi
pop    %rax
jmp    1040 <printf@plt>

LLVM IR (-O0):
%struct.in_addr = type { i32 }
@.str = [3 x i8] c"%s\00"
define void @printaddr(i32 %0) {
%2 = alloca i32
%3 = alloca %struct.in_addr
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i32 @htonl(i32 %4)
%6 = getelementptr inbounds %struct.in_addr, %struct.in_addr* %3, i32 0, i32 0
store i32 %5, i32* %6
%7 = getelementptr inbounds %struct.in_addr, %struct.in_addr* %3, i32 0, i32 0
%8 = load i32, i32* %7
%9 = call i8* @inet_ntoa(i32 %8)
%10 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %9)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define void @printaddr(i32 %0) {
%2 = tail call i32 @htonl(i32 %0)
%3 = tail call i8* @inet_ntoa(i32 %2)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
main() {
  char a = 'A';
  if ((a == 'Z') || ((a = 'L') && (a == 'A')))
    a = 'M';
  printf("%c", a);
  printf(" Nothing ");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movb   $0x41,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x5a,%eax
je     1150 <main+0x40>
movb   $0x4c,-0x5(%rbp)
mov    $0x1,%al
test   $0x1,%al
jne    1143 <main+0x33>
jmp    1154 <main+0x44>
movsbl -0x5(%rbp),%eax
cmp    $0x41,%eax
jne    1154 <main+0x44>
movb   $0x4d,-0x5(%rbp)
movsbl -0x5(%rbp),%esi
lea    0xea1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe96(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x4c,%edi
call   1030 <putchar@plt>
lea    0xece(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%c\00"
@.str.1 = [10 x i8] c" Nothing \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
store i32 0, i32* %1
store i8 65, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp eq i32 %4, 90
br i1 %5, label %11, label %6
6: ; preds = %0
store i8 76, i8* %2
br i1 true, label %7, label %12
7: ; preds = %6
%8 = load i8, i8* %2
%9 = sext i8 %8 to i32
%10 = icmp eq i32 %9, 65
br i1 %10, label %11, label %12
11: ; preds = %7, %0
store i8 77, i8* %2
br label %12
12: ; preds = %11, %7, %6
%13 = load i8, i8* %2
%14 = sext i8 %13 to i32
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %14)
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%17 = load i32, i32* %1
ret i32 %17
}

LLVM IR (-O2):
@.str.1 = [10 x i8] c" Nothing \00"
define i32 @main() {
%1 = tail call i32 @putchar(i32 76)
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}
unsigned long TimerPrescaleGet(unsigned long ulBase, unsigned long ulTimer) {
  ;

  ;
  return ((ulTimer == 0x000000ff)
              ? (*((volatile unsigned long *)(ulBase + 0x00000038)))
              : (*((volatile unsigned long *)(ulBase + 0x0000003C))));
}


x86 assembly (clang, -O0):
<TimerPrescaleGet>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0xff,-0x10(%rbp)
jne    112b <TimerPrescaleGet+0x2b>
mov    -0x8(%rbp),%rax
mov    0x38(%rax),%rax
mov    %rax,-0x18(%rbp)
jmp    1137 <TimerPrescaleGet+0x37>
mov    -0x8(%rbp),%rax
mov    0x3c(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<TimerPrescaleGet>:
xor    %eax,%eax
cmp    $0xff,%rsi
setne  %al
mov    0x38(%rdi,%rax,4),%rax
ret

LLVM IR (-O0):
define i64 @TimerPrescaleGet(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %4
%6 = icmp eq i64 %5, 255
br i1 %6, label %7, label %12
7: ; preds = %2
%8 = load i64, i64* %3
%9 = add i64 %8, 56
%10 = inttoptr i64 %9 to i64*
%11 = load volatile i64, i64* %10
br label %17
12: ; preds = %2
%13 = load i64, i64* %3
%14 = add i64 %13, 60
%15 = inttoptr i64 %14 to i64*
%16 = load volatile i64, i64* %15
br label %17
17: ; preds = %12, %7
%18 = phi i64 [ %11, %7 ], [ %16, %12 ]
ret i64 %18
}

LLVM IR (-O2):
define i64 @TimerPrescaleGet(i64 %0, i64 %1) {
%3 = icmp eq i64 %1, 255
%4 = select i1 %3, i64 56, i64 60
%5 = add i64 %4, %0
%6 = inttoptr i64 %5 to i64*
%7 = load volatile i64, i64* %6
ret i64 %7
}
long double simY(long double v[]) {
  const long double r = 28;
  return r * v[0] - v[1] - v[0] * v[2];
}


x86 assembly (clang, -O0):
<simY>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
flds   0xef2(%rip)
fld    %st(0)
fstpt  -0x20(%rbp)
mov    -0x8(%rbp),%rax
fldt   (%rax)
fldt   0x10(%rax)
fxch   %st(2)
fmul   %st(1),%st
fsubp  %st,%st(2)
fldt   0x20(%rax)
fmulp  %st,%st(1)
fsubrp %st,%st(1)
pop    %rbp
ret

x86 assembly (clang, -O2):
<simY>:
fldt   (%rdi)
fldt   0x10(%rdi)
fld    %st(1)
fmuls  0xef3(%rip)
fsubp  %st,%st(1)
fldt   0x20(%rdi)
fmulp  %st,%st(2)
fsubp  %st,%st(1)
ret

LLVM IR (-O0):
define x86_fp80 @simY(x86_fp80* %0) {
%2 = alloca x86_fp80*
%3 = alloca x86_fp80
store x86_fp80* %0, x86_fp80** %2
store x86_fp80 0xK4003E000000000000000, x86_fp80* %3
%4 = load x86_fp80*, x86_fp80** %2
%5 = getelementptr inbounds x86_fp80, x86_fp80* %4, i64 0
%6 = load x86_fp80, x86_fp80* %5
%7 = load x86_fp80*, x86_fp80** %2
%8 = getelementptr inbounds x86_fp80, x86_fp80* %7, i64 1
%9 = load x86_fp80, x86_fp80* %8
%10 = fneg x86_fp80 %9
%11 = call x86_fp80 @llvm.fmuladd.f80(x86_fp80 0xK4003E000000000000000, x86_fp80 %6, x86_fp80 %10)
%12 = load x86_fp80*, x86_fp80** %2
%13 = getelementptr inbounds x86_fp80, x86_fp80* %12, i64 0
%14 = load x86_fp80, x86_fp80* %13
%15 = load x86_fp80*, x86_fp80** %2
%16 = getelementptr inbounds x86_fp80, x86_fp80* %15, i64 2
%17 = load x86_fp80, x86_fp80* %16
%18 = fneg x86_fp80 %14
%19 = call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %18, x86_fp80 %17, x86_fp80 %11)
ret x86_fp80 %19
}

LLVM IR (-O2):
define x86_fp80 @simY(x86_fp80* nocapture %0) {
%2 = load x86_fp80, x86_fp80* %0
%3 = getelementptr inbounds x86_fp80, x86_fp80* %0, i64 1
%4 = load x86_fp80, x86_fp80* %3
%5 = fneg x86_fp80 %4
%6 = tail call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %2, x86_fp80 0xK4003E000000000000000, x86_fp80 %5)
%7 = getelementptr inbounds x86_fp80, x86_fp80* %0, i64 2
%8 = load x86_fp80, x86_fp80* %7
%9 = fneg x86_fp80 %2
%10 = tail call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %9, x86_fp80 %8, x86_fp80 %6)
ret x86_fp80 %10
}
void barebox_malloc_stats(void) {}


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

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

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

LLVM IR (-O2):
define void @barebox_malloc_stats() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
int main(int argc, char *argv[]) {
  char output[strlen(argv[1])];
  strcpy(output, argv[1]);
  printf("%s\n", output);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <strlen@plt>
mov    %eax,%eax
mov    %rsp,%rcx
mov    %rcx,-0x18(%rbp)
mov    %rax,%rcx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdi
sub    %rcx,%rdi
mov    %rdi,-0x28(%rbp)
mov    %rdi,%rsp
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
call   1030 <strcpy@plt>
mov    -0x28(%rbp),%rsi
lea    0xe77(%rip),%rdi
call   1050 <printf@plt>
mov    -0x18(%rbp),%rax
mov    %rax,%rsp
xor    %eax,%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    0x8(%rsi),%rdi
call   1040 <strlen@plt>
mov    %eax,%eax
mov    %rsp,%rbx
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
mov    0x8(%r14),%rsi
mov    %rbx,%rdi
call   1030 <strcpy@plt>
lea    0xe97(%rip),%rdi
mov    %rbx,%rsi
call   1050 <printf@plt>
xor    %eax,%eax
lea    -0x10(%rbp),%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i8*
%6 = alloca i64
store i32 %0, i32* %3
store i8** %1, i8*** %4
%7 = load i8**, i8*** %4
%8 = getelementptr inbounds i8*, i8** %7, i64 1
%9 = load i8*, i8** %8
%10 = call i32 @strlen(i8* %9)
%11 = zext i32 %10 to i64
%12 = call i8* @llvm.stacksave()
store i8* %12, i8** %5
%13 = alloca i8, i64 %11
store i64 %11, i64* %6
%14 = load i8**, i8*** %4
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = call i32 @strcpy(i8* %13, i8* %16)
%18 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %13)
%19 = load i8*, i8** %5
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = tail call i32 @strlen(i8* %4)
%6 = zext i32 %5 to i64
%7 = alloca i8, i64 %6
%8 = load i8*, i8** %3
%9 = call i32 @strcpy(i8* %7, i8* %8)
%10 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %7)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ output_string(char *);
gen_align_word() { output_string("\t.align\t2\n"); }


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

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

LLVM IR (-O0):
@.str = [11 x i8] c"\09.align\092\0A\00"
define i32 @gen_align_word() {
%1 = alloca i32
%2 = call i32 @output_string(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
@.str = [11 x i8] c"\09.align\092\0A\00"
define i32 @gen_align_word() {
%1 = tail call i32 @output_string(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
ret i32 undef
}
/* Type definitions */
struct timeval {
  int tv_sec;
  scalar_t__ tv_usec;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
double cb_get_time_in_ms() {
  struct timeval tv;
  gettimeofday(&tv, NULL);
  return ((double)(tv.tv_usec + 1000000 * tv.tv_sec)) / ((double)1000.0);
}


x86 assembly (clang, -O0):
<cb_get_time_in_ms>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <gettimeofday@plt>
mov    -0x8(%rbp),%rax
imul   $0xf4240,-0x10(%rbp),%ecx
movslq %ecx,%rcx
add    %rcx,%rax
cvtsi2sd %rax,%xmm0
movsd  0xebd(%rip),%xmm1
divsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cb_get_time_in_ms>:
sub    $0x18,%rsp
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
movslq 0x8(%rsp),%rax
imul   $0xf4240,%rax,%rax
add    0x10(%rsp),%rax
cvtsi2sd %rax,%xmm0
divsd  0xec2(%rip),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timeval = type { i32, i64 }
define double @cb_get_time_in_ms() {
%1 = alloca %struct.timeval
%2 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%3 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 1
%4 = load i64, i64* %3
%5 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 0
%6 = load i32, i32* %5
%7 = mul nsw i32 1000000, %6
%8 = sext i32 %7 to i64
%9 = add nsw i64 %4, %8
%10 = sitofp i64 %9 to double
%11 = fdiv double %10, 1.000000e+03
ret double %11
}

LLVM IR (-O2):
%struct.timeval = type { i32, i64 }
define double @cb_get_time_in_ms() {
%1 = alloca %struct.timeval
%2 = bitcast %struct.timeval* %1 to i8*
%3 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%5 = load i64, i64* %4
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%7 = load i32, i32* %6
%8 = mul nsw i32 %7, 1000000
%9 = sext i32 %8 to i64
%10 = add nsw i64 %5, %9
%11 = sitofp i64 %10 to double
%12 = fdiv double %11, 1.000000e+03
ret double %12
}
long labs(long j) { return (j < 0) ? -j : j; }


x86 assembly (clang, -O0):
<labs>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jge    1122 <labs+0x22>
xor    %eax,%eax
sub    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
jmp    112a <labs+0x2a>
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<labs>:
mov    %rdi,%rax
neg    %rax
cmovs  %rdi,%rax
ret

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

LLVM IR (-O2):
define i64 @labs(i64 %0) {
%2 = tail call i64 @llvm.abs.i64(i64 %0, i1 true)
ret i64 %2
}
/* Variables and functions */
int /*<<< orphan*/ bar(int, int);
int /*<<< orphan*/ foo(int, int);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int main(void) {
  fputs("UBSAN TEST START\n", stderr);
  foo(3, 2);
  bar(12, 42);
  fputs("UBSAN TEST END\n", stderr);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e9a(%rip),%rax
mov    (%rax),%esi
lea    0xeb1(%rip),%rdi
call   1040 <fputs@plt>
mov    $0x3,%edi
mov    $0x2,%esi
call   1050 <foo@plt>
mov    $0xc,%edi
mov    $0x2a,%esi
call   1030 <bar@plt>
mov    0x2e67(%rip),%rax
mov    (%rax),%esi
lea    0xe90(%rip),%rdi
call   1040 <fputs@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    0x2ea8(%rip),%rbx
mov    (%rbx),%esi
lea    0xebf(%rip),%rdi
call   1040 <fputs@plt>
mov    $0x3,%edi
mov    $0x2,%esi
call   1050 <foo@plt>
mov    $0xc,%edi
mov    $0x2a,%esi
call   1030 <bar@plt>
mov    (%rbx),%esi
lea    0xea5(%rip),%rdi
call   1040 <fputs@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [18 x i8] c"UBSAN TEST START\0A\00"
@stderr = global i32 0
@.str.1 = [16 x i8] c"UBSAN TEST END\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = load i32, i32* @stderr
%3 = call i32 @fputs(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = call i32 @foo(i32 3, i32 2)
%5 = call i32 @bar(i32 12, i32 42)
%6 = load i32, i32* @stderr
%7 = call i32 @fputs(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 %6)
ret i32 0
}

LLVM IR (-O2):
@.str = [18 x i8] c"UBSAN TEST START\0A\00"
@stderr = global i32 0
@.str.1 = [16 x i8] c"UBSAN TEST END\0A\00"
define i32 @main() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fputs(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = tail call i32 @foo(i32 3, i32 2)
%4 = tail call i32 @bar(i32 12, i32 42)
%5 = load i32, i32* @stderr
%6 = tail call i32 @fputs(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 %5)
ret i32 0
}