xunge/DecIR huggingface dataset:
short LINT_TO_INT(long var) {
  short newvar;
  if (var >= 32766)
    newvar = 32766;
  else if (var < -32767)
    newvar = -32767;
  else
    newvar = (short)var;
  return newvar;
}


x86 assembly (clang, -O0):
<LINT_TO_INT>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
cmpq   $0x7ffe,-0x8(%rbp)
jl     1121 <LINT_TO_INT+0x21>
movw   $0x7ffe,-0xa(%rbp)
jmp    1147 <LINT_TO_INT+0x47>
cmpq   $0xffffffffffff8001,-0x8(%rbp)
ff
jge    113a <LINT_TO_INT+0x3a>
movw   $0x8001,-0xa(%rbp)
jmp    1142 <LINT_TO_INT+0x42>
mov    -0x8(%rbp),%rax
mov    %ax,-0xa(%rbp)
jmp    1147 <LINT_TO_INT+0x47>
movswl -0xa(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<LINT_TO_INT>:
cmp    $0xffffffffffff8002,%rdi
mov    $0x8001,%ecx
cmovge %edi,%ecx
cmp    $0x7ffe,%rdi
mov    $0x7ffe,%eax
cmovl  %ecx,%eax
ret

LLVM IR (-O0):
define signext i16 @LINT_TO_INT(i64 %0) {
%2 = alloca i64
%3 = alloca i16
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = icmp sge i64 %4, 32766
br i1 %5, label %6, label %7
6: ; preds = %1
store i16 32766, i16* %3
br label %15
7: ; preds = %1
%8 = load i64, i64* %2
%9 = icmp slt i64 %8, -32767
br i1 %9, label %10, label %11
10: ; preds = %7
store i16 -32767, i16* %3
br label %14
11: ; preds = %7
%12 = load i64, i64* %2
%13 = trunc i64 %12 to i16
store i16 %13, i16* %3
br label %14
14: ; preds = %11, %10
br label %15
15: ; preds = %14, %6
%16 = load i16, i16* %3
ret i16 %16
}

LLVM IR (-O2):
define signext i16 @LINT_TO_INT(i64 %0) {
%2 = icmp sgt i64 %0, 32765
%3 = icmp sgt i64 %0, -32767
%4 = select i1 %3, i64 %0, i64 -32767
%5 = trunc i64 %4 to i16
%6 = select i1 %2, i16 32766, i16 %5
ret i16 %6
}
/* Variables and functions */
int /*<<< orphan*/ O_WRONLY;
int /*<<< orphan*/ WDIOC_SETTIMEOUT;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ ioctl(int, int /*<<< orphan*/, int *);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int);
int main() {
  int fd = open("/dev/watchdog", O_WRONLY);
  int timeout = 15;
  ioctl(fd, WDIOC_SETTIMEOUT, &timeout);
  printf("Setting timeout to %d seconds\n", timeout);
  close(fd);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e7a(%rip),%rax
mov    (%rax),%esi
lea    0xea1(%rip),%rdi
call   1060 <open@plt>
mov    %eax,-0x8(%rbp)
movl   $0xf,-0xc(%rbp)
mov    -0x8(%rbp),%edi
mov    0x2e68(%rip),%rax
mov    (%rax),%esi
lea    -0xc(%rbp),%rdx
call   1040 <ioctl@plt>
mov    -0xc(%rbp),%esi
lea    0xe81(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%edi
call   1050 <close@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
mov    0x2e84(%rip),%rax
mov    (%rax),%esi
lea    0xeab(%rip),%rdi
call   1060 <open@plt>
mov    %eax,%ebx
movl   $0xf,0xc(%rsp)
mov    0x2e75(%rip),%rax
mov    (%rax),%esi
lea    0xc(%rsp),%rdx
mov    %ebx,%edi
call   1040 <ioctl@plt>
mov    0xc(%rsp),%esi
lea    0xe8a(%rip),%rdi
call   1030 <printf@plt>
mov    %ebx,%edi
call   1050 <close@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [14 x i8] c"/dev/watchdog\00"
@O_WRONLY = global i32 0
@WDIOC_SETTIMEOUT = global i32 0
@.str.1 = [31 x i8] c"Setting timeout to %d seconds\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = load i32, i32* @O_WRONLY
%5 = call i32 @open(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %4)
store i32 %5, i32* %2
store i32 15, i32* %3
%6 = load i32, i32* %2
%7 = load i32, i32* @WDIOC_SETTIMEOUT
%8 = call i32 @ioctl(i32 %6, i32 %7, i32* %3)
%9 = load i32, i32* %3
%10 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i32 %9)
%11 = load i32, i32* %2
%12 = call i32 @close(i32 %11)
ret i32 0
}

LLVM IR (-O2):
@.str = [14 x i8] c"/dev/watchdog\00"
@O_WRONLY = global i32 0
@WDIOC_SETTIMEOUT = global i32 0
@.str.1 = [31 x i8] c"Setting timeout to %d seconds\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = load i32, i32* @O_WRONLY
%3 = tail call i32 @open(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = bitcast i32* %1 to i8*
store i32 15, i32* %1
%5 = load i32, i32* @WDIOC_SETTIMEOUT
%6 = call i32 @ioctl(i32 %3, i32 %5, i32* %1)
%7 = load i32, i32* %1
%8 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i32 %7)
%9 = call i32 @close(i32 %3)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int /*<<< orphan*/);
void bar(void) {
  int a;
  printf("%d\n", a++);
}


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

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

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
define void @bar() {
%1 = alloca i32
%2 = load i32, i32* %1
%3 = add nsw i32 %2, 1
store i32 %3, i32* %1
%4 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %2)
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define void @bar() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 undef)
ret void
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
void SysTickIntDisable(void) {
  (*((volatile uint32_t *)(0xE000E010))) &= ~(0x00000002);
}


x86 assembly (clang, -O0):
<SysTickIntDisable>:
push   %rbp
mov    %rsp,%rbp
mov    $0xe000e010,%eax
mov    (%rax),%ecx
and    $0xfffffffd,%ecx
mov    $0xe000e010,%eax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<SysTickIntDisable>:
mov    $0xe000e010,%eax
andl   $0xfffffffd,(%rax)
ret

LLVM IR (-O0):
define void @SysTickIntDisable() {
%1 = load volatile i32, i32* inttoptr (i64 3758153744 to i32*)
%2 = and i32 %1, -3
store volatile i32 %2, i32* inttoptr (i64 3758153744 to i32*)
ret void
}

LLVM IR (-O2):
define void @SysTickIntDisable() {
%1 = load volatile i32, i32* inttoptr (i64 3758153744 to i32*)
%2 = and i32 %1, -3
store volatile i32 %2, i32* inttoptr (i64 3758153744 to i32*)
ret void
}
void cgismet(void) {}


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

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

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

LLVM IR (-O2):
define void @cgismet() {
ret void
}
int print_null(const char *s, ...) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @print_null(i8* nocapture readnone %0, ...) {
ret i32 0
}
__attribute__((no, noclone)) int f13(void *a, int b, long long c, long *d,
                                     long *e, int *f) {
  asm volatile("" : : "r"(a), "r"(b), "r"(c), "r"(d) : "memory");
  asm volatile("" : : "r"(e), "r"(f) : "memory");
  return 0;
}


x86 assembly (clang, -O0):
<f13>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rax
mov    -0x30(%rbp),%rcx
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @f13(i8* %0, i32 %1, i64 %2, i64* %3, i64* %4, i32* %5) {
tail call void asm sideeffect "", "r,r,r,r,~{memory},~{dirflag},~{fpsr},~{flags}"(i8* %0, i32 %1, i64 %2, i64* %3)
tail call void asm sideeffect "", "r,r,~{memory},~{dirflag},~{fpsr},~{flags}"(i64* %4, i32* %5)
ret i32 0
}
int adis16204_configure_ring(struct iio_dev *indio_dev) { return 0; }


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

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

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

LLVM IR (-O2):
%struct.iio_dev = type opaque
define i32 @adis16204_configure_ring(%struct.iio_dev* nocapture readnone %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void warn(char *msg) { fprintf(stderr, "%s", msg); }


x86 assembly (clang, -O0):
<warn>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xed0(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<warn>:
mov    %rdi,%rdx
mov    0x2ec6(%rip),%rax
mov    (%rax),%edi
lea    0xedd(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [3 x i8] c"%s\00"
define void @warn(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %4)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [3 x i8] c"%s\00"
define void @warn(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Type definitions */
typedef int ssize_t;

/* Variables and functions */
int /*<<< orphan*/ __bin2hex(char *, unsigned char const *, size_t);
scalar_t__ calloc(int, int);
char *bin2hex(const unsigned char *p, size_t len) {
  ssize_t slen;
  char *s;
  slen = len * 2 + 1;
  if (slen % 4)
    slen += 4 - (slen % 4);
  s = (char *)calloc(slen, 1);
  __bin2hex(s, p, len);
  return s;
}


x86 assembly (clang, -O0):
<bin2hex>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
shl    $0x1,%rax
add    $0x1,%rax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     116b <bin2hex+0x4b>
mov    -0x14(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    $0x4,%eax
sub    %edx,%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
mov    $0x1,%esi
call   1030 <calloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
call   1040 <__bin2hex@plt>
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bin2hex>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%rbx
lea    (%rsi,%rsi,1),%eax
add    $0x1,%eax
lea    (%rsi,%rsi,1),%ecx
add    $0x4,%ecx
test   %eax,%eax
cmovns %eax,%ecx
mov    %rdi,%r14
and    $0xfffffffc,%ecx
sub    %eax,%ecx
lea    (%rcx,%rsi,2),%edi
add    $0x5,%edi
mov    $0x1,%esi
call   1030 <calloc@plt>
mov    %rax,%r15
mov    %rax,%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1040 <__bin2hex@plt>
mov    %r15,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i8* @bin2hex(i8* %0, i64 %1) {
%3 = trunc i64 %1 to i32
%4 = shl i32 %3, 1
%5 = or i32 %4, 1
%6 = srem i32 %5, 4
%7 = add i32 %4, 5
%8 = sub i32 %7, %6
%9 = tail call i64 @calloc(i32 %8, i32 1)
%10 = inttoptr i64 %9 to i8*
%11 = tail call i32 @__bin2hex(i8* %10, i8* %0, i64 %1)
ret i8* %10
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int, int);
void testGreaterEqual() { printf("%d >= %d = %d\n", 10, 4, 10 >= 4); }


x86 assembly (clang, -O0):
<testGreaterEqual>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
mov    $0xa,%esi
mov    $0x4,%edx
mov    $0x1,%ecx
call   1030 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<testGreaterEqual>:
lea    0xee9(%rip),%rdi
mov    $0xa,%esi
mov    $0x4,%edx
mov    $0x1,%ecx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"%d >= %d = %d\0A\00"
define void @testGreaterEqual() {
%1 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 10, i32 4, i32 1)
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"%d >= %d = %d\0A\00"
define void @testGreaterEqual() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 10, i32 4, i32 1)
ret void
}
void cx_Ptr_print(void *const *const value) { printf("%p", *value); }


x86 assembly (clang, -O0):
<cx_Ptr_print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rsi
lea    0xed6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cx_Ptr_print>:
mov    (%rdi),%rsi
lea    0xee6(%rip),%rdi
xor    %eax,%eax
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%p\00"
define void @cx_Ptr_print(i8** %0) {
%2 = alloca i8**
store i8** %0, i8*** %2
%3 = load i8**, i8*** %2
%4 = load i8*, i8** %3
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %4)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%p\00"
define void @cx_Ptr_print(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
ret void
}
/* Variables and functions */
bool nrf53_errata_90(void) { return false; }


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

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

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

LLVM IR (-O2):
define i32 @nrf53_errata_90() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ consoleSetHistoryMaxCount(int);
int /*<<< orphan*/ scriptThrowException(char *);
void consoleCmdSetHistory(int value) {
  if (!(value >= 0)) {
    scriptThrowException("Wrong value");
    return;
  };
  consoleSetHistoryMaxCount(value);
}


x86 assembly (clang, -O0):
<consoleCmdSetHistory>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    1146 <consoleCmdSetHistory+0x26>
lea    0xec4(%rip),%rdi
call   1040 <scriptThrowException@plt>
jmp    114e <consoleCmdSetHistory+0x2e>
mov    -0x4(%rbp),%edi
call   1030 <consoleSetHistoryMaxCount@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<consoleCmdSetHistory>:
test   %edi,%edi
js     1129 <consoleCmdSetHistory+0x9>
jmp    1030 <consoleSetHistoryMaxCount@plt>
lea    0xed0(%rip),%rdi
jmp    1040 <scriptThrowException@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"Wrong value\00"
define void @consoleCmdSetHistory(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sge i32 %3, 0
br i1 %4, label %7, label %5
5: ; preds = %1
%6 = call i32 @scriptThrowException(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
br label %10
7: ; preds = %1
%8 = load i32, i32* %2
%9 = call i32 @consoleSetHistoryMaxCount(i32 %8)
br label %10
10: ; preds = %7, %5
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"Wrong value\00"
define void @consoleCmdSetHistory(i32 %0) {
%2 = icmp sgt i32 %0, -1
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @scriptThrowException(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
br label %7
5: ; preds = %1
%6 = tail call i32 @consoleSetHistoryMaxCount(i32 %0)
br label %7
7: ; preds = %5, %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ __syscall(int, int /*<<< orphan*/, int /*<<< orphan*/,
                             int /*<<< orphan*/, int);
void _exit(int status) { __syscall(status, 0, 0, 0, 0x410); }


x86 assembly (clang, -O0):
<_exit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
xor    %ecx,%ecx
mov    $0x410,%r8d
mov    %ecx,%esi
mov    %ecx,%edx
call   1030 <__syscall@plt>

x86 assembly (clang, -O2):
<_exit>:
push   %rax
xor    %esi,%esi
xor    %edx,%edx
xor    %ecx,%ecx
mov    $0x410,%r8d
call   1030 <__syscall@plt>

LLVM IR (-O0):
define void @_exit(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @__syscall(i32 %3, i32 0, i32 0, i32 0, i32 1040)
unreachable
}

LLVM IR (-O2):
define void @_exit(i32 %0) {
%2 = tail call i32 @__syscall(i32 %0, i32 0, i32 0, i32 0, i32 1040)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void svg_footer() { printf("</svg>\n"); }


x86 assembly (clang, -O0):
<svg_footer>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <printf@plt>
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [8 x i8] c"</svg>\0A\00"
define void @svg_footer() {
%1 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [7 x i8] c"</svg>\00"
define void @svg_footer() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
void *build_int_cst(void *, long long);
void *get_addr_base_and_unit_offset(void *, long long *);
void *__attribute__((no, noclone))
build_ref_for_offset(void *base, long long offset) {
  long long base_offset;
  base = get_addr_base_and_unit_offset(base, &base_offset);
  return build_int_cst(base, base_offset + offset / 8);
}


x86 assembly (clang, -O0):
<build_ref_for_offset>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1030 <get_addr_base_and_unit_offset@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x10(%rbp),%rax
mov    $0x8,%ecx
cqto
idiv   %rcx
add    %rax,%rsi
call   1040 <build_int_cst@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<build_ref_for_offset>:
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
lea    0x8(%rsp),%rsi
call   1030 <get_addr_base_and_unit_offset@plt>
lea    0x7(%rbx),%rsi
test   %rbx,%rbx
cmovns %rbx,%rsi
sar    $0x3,%rsi
add    0x8(%rsp),%rsi
mov    %rax,%rdi
call   1040 <build_int_cst@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i8* @build_ref_for_offset(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%6 = load i8*, i8** %3
%7 = call i8* @get_addr_base_and_unit_offset(i8* %6, i64* %5)
store i8* %7, i8** %3
%8 = load i8*, i8** %3
%9 = load i64, i64* %5
%10 = load i64, i64* %4
%11 = sdiv i64 %10, 8
%12 = add nsw i64 %9, %11
%13 = call i8* @build_int_cst(i8* %8, i64 %12)
ret i8* %13
}

LLVM IR (-O2):
define i8* @build_ref_for_offset(i8* %0, i64 %1) {
%3 = alloca i64
%4 = bitcast i64* %3 to i8*
%5 = call i8* @get_addr_base_and_unit_offset(i8* %0, i64* %3)
%6 = load i64, i64* %3
%7 = sdiv i64 %1, 8
%8 = add nsw i64 %6, %7
%9 = call i8* @build_int_cst(i8* %5, i64 %8)
ret i8* %9
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(int argc, char **argv) {
  printf("No FIPS ALGVS support\n");
  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)
lea    0xed3(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [23 x i8] c"No FIPS ALGVS support\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 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [22 x i8] c"No FIPS ALGVS support\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ clearLastError();
int pintoGPIO(int);
int writeIntValueToFile(char *, int);
int exportGPIOPin(int pin) {
  clearLastError();
  int gpio = pintoGPIO(pin);
  int ret = writeIntValueToFile("/sys/class/gpio/export", gpio);
  if (ret > 0)
    return 0;
  else
    return -1;
}


x86 assembly (clang, -O0):
<exportGPIOPin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    $0x0,%al
call   1040 <clearLastError@plt>
mov    -0x8(%rbp),%edi
call   1030 <pintoGPIO@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xea9(%rip),%rdi
call   1050 <writeIntValueToFile@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jle    1175 <exportGPIOPin+0x45>
movl   $0x0,-0x4(%rbp)
jmp    117c <exportGPIOPin+0x4c>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<exportGPIOPin>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1040 <clearLastError@plt>
mov    %ebx,%edi
call   1030 <pintoGPIO@plt>
lea    0xeb8(%rip),%rdi
mov    %eax,%esi
call   1050 <writeIntValueToFile@plt>
xor    %ecx,%ecx
test   %eax,%eax
setle  %cl
neg    %ecx
mov    %ecx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [23 x i8] c"/sys/class/gpio/export\00"
define i32 @exportGPIOPin(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
%6 = call i32 (...) @clearLastError()
%7 = load i32, i32* %3
%8 = call i32 @pintoGPIO(i32 %7)
store i32 %8, i32* %4
%9 = load i32, i32* %4
%10 = call i32 @writeIntValueToFile(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 %9)
store i32 %10, i32* %5
%11 = load i32, i32* %5
%12 = icmp sgt i32 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %1
store i32 0, i32* %2
br label %15
14: ; preds = %1
store i32 -1, i32* %2
br label %15
15: ; preds = %14, %13
%16 = load i32, i32* %2
ret i32 %16
}

LLVM IR (-O2):
@.str = [23 x i8] c"/sys/class/gpio/export\00"
define i32 @exportGPIOPin(i32 %0) {
%2 = tail call i32 (...) @clearLastError()
%3 = tail call i32 @pintoGPIO(i32 %0)
%4 = tail call i32 @writeIntValueToFile(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = icmp slt i32 %4, 1
%6 = sext i1 %5 to i32
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ isinff(float);
int /*<<< orphan*/ isnanf(float);
int isnumberf(float x) { return !isinff(x) && !isnanf(x); }


x86 assembly (clang, -O0):
<isnumberf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
call   1040 <isinff@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x5(%rbp)
jne    115c <isnumberf+0x3c>
movss  -0x4(%rbp),%xmm0
call   1030 <isnanf@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isnumberf>:
push   %rax
movss  %xmm0,0x4(%rsp)
call   1040 <isinff@plt>
mov    %eax,%ecx
xor    %eax,%eax
test   %ecx,%ecx
je     1136 <isnumberf+0x16>
pop    %rcx
ret
movss  0x4(%rsp),%xmm0
call   1030 <isnanf@plt>
mov    %eax,%ecx
xor    %eax,%eax
test   %ecx,%ecx
sete   %al
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @isnumberf(float %0) {
%2 = tail call i32 @isinff(float %0)
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = tail call i32 @isnanf(float %0)
%6 = icmp eq i32 %5, 0
%7 = zext i1 %6 to i32
br label %8
8: ; preds = %4, %1
%9 = phi i32 [ 0, %1 ], [ %7, %4 ]
ret i32 %9
}
void emit_bool_true(struct processor_explicatory_state *process_state,
                    struct modern_stream *stream, void *stream_state,
                    struct modern_vfile *vfile, void *vfile_state) {}


x86 assembly (clang, -O0):
<emit_bool_true>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.processor_explicatory_state = type opaque
%struct.modern_stream = type opaque
%struct.modern_vfile = type opaque
define void @emit_bool_true(%struct.processor_explicatory_state* %0, %struct.modern_stream* %1, i8* %2, %struct.modern_vfile* %3, i8* %4) {
%6 = alloca %struct.processor_explicatory_state*
%7 = alloca %struct.modern_stream*
%8 = alloca i8*
%9 = alloca %struct.modern_vfile*
%10 = alloca i8*
store %struct.processor_explicatory_state* %0, %struct.processor_explicatory_state** %6
store %struct.modern_stream* %1, %struct.modern_stream** %7
store i8* %2, i8** %8
store %struct.modern_vfile* %3, %struct.modern_vfile** %9
store i8* %4, i8** %10
ret void
}

LLVM IR (-O2):
%struct.processor_explicatory_state = type opaque
%struct.modern_stream = type opaque
%struct.modern_vfile = type opaque
define void @emit_bool_true(%struct.processor_explicatory_state* nocapture %0, %struct.modern_stream* nocapture %1, i8* nocapture %2, %struct.modern_vfile* nocapture %3, i8* nocapture %4) {
ret void
}
/* Variables and functions */
int f37(int *);
int f38(int *p) { return f37(p); }


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

x86 assembly (clang, -O2):
<f38>:
jmp    1030 <f37@plt>

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

LLVM IR (-O2):
define i32 @f38(i32* %0) {
%2 = tail call i32 @f37(i32* %0)
ret i32 %2
}
/* Type definitions */
typedef int /*<<< orphan*/ int16_t;

/* Variables and functions */
void scrn_center(int16_t r, const char *fmt, ...) {}


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

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

LLVM IR (-O0):
define void @scrn_center(i32 %0, i8* %1, ...) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
ret void
}

LLVM IR (-O2):
define void @scrn_center(i32 %0, i8* nocapture %1, ...) {
ret void
}
int fcmpeq(float a, float b) { return a == b; }


x86 assembly (clang, -O0):
<fcmpeq>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
ucomiss -0x8(%rbp),%xmm0
sete   %al
setnp  %cl
and    %cl,%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fcmpeq>:
cmpeqss %xmm1,%xmm0
movd   %xmm0,%eax
and    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @fcmpeq(float %0, float %1) {
%3 = alloca float
%4 = alloca float
store float %0, float* %3
store float %1, float* %4
%5 = load float, float* %3
%6 = load float, float* %4
%7 = fcmp oeq float %5, %6
%8 = zext i1 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @fcmpeq(float %0, float %1) {
%3 = fcmp oeq float %0, %1
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ write(char *);
int three() {
  write("3\n");
  return 3;
}


x86 assembly (clang, -O0):
<three>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <write@plt>
mov    $0x3,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<three>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <write@plt>
mov    $0x3,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"3\0A\00"
define i32 @three() {
%1 = call i32 @write(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
ret i32 3
}

LLVM IR (-O2):
@.str = [3 x i8] c"3\0A\00"
define i32 @three() {
%1 = tail call i32 @write(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
ret i32 3
}
int unusedCode() { return (0xFF); }


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

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

LLVM IR (-O0):
define i32 @unusedCode() {
ret i32 255
}

LLVM IR (-O2):
define i32 @unusedCode() {
ret i32 255
}
/* Variables and functions */
int /*<<< orphan*/ clrtoeol();
void conio_clreol(void) { clrtoeol(); }


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

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

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

LLVM IR (-O2):
define void @conio_clreol() {
%1 = tail call i32 (...) @clrtoeol()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ outb(int, int);
void set_read_plane(int plane) {
  outb(4, 0x3ce);
  outb(plane, 0x3cf);
}


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

x86 assembly (clang, -O2):
<set_read_plane>:
push   %rbx
mov    %edi,%ebx
mov    $0x4,%edi
mov    $0x3ce,%esi
call   1030 <outb@plt>
mov    %ebx,%edi
mov    $0x3cf,%esi
pop    %rbx
jmp    1030 <outb@plt>

LLVM IR (-O0):
define void @set_read_plane(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @outb(i32 4, i32 974)
%4 = load i32, i32* %2
%5 = call i32 @outb(i32 %4, i32 975)
ret void
}

LLVM IR (-O2):
define void @set_read_plane(i32 %0) {
%2 = tail call i32 @outb(i32 4, i32 974)
%3 = tail call i32 @outb(i32 %0, i32 975)
ret void
}
/* Variables and functions */
char *copy(char *);
int /*<<< orphan*/ fill(char *);
int /*<<< orphan*/ free(char *);
scalar_t__ malloc(int);
int /*<<< orphan*/ strcpy(char *, char *);
void f() {
  char buffer[100];
  char *p;
  char *q;
  p = (char *)malloc(100);
  p++;
  fill(buffer);
  fill(p);
  q = copy(p);
  strcpy(q, buffer);
  free(buffer);
  free(p);
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    $0x64,%edi
call   1070 <malloc@plt>
mov    %rax,-0x78(%rbp)
mov    -0x78(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x78(%rbp)
lea    -0x70(%rbp),%rdi
call   1060 <fill@plt>
mov    -0x78(%rbp),%rdi
call   1060 <fill@plt>
mov    -0x78(%rbp),%rdi
call   1050 <copy@plt>
mov    %rax,-0x80(%rbp)
mov    -0x80(%rbp),%rdi
lea    -0x70(%rbp),%rsi
call   1040 <strcpy@plt>
lea    -0x70(%rbp),%rdi
call   1030 <free@plt>
mov    -0x78(%rbp),%rdi
call   1030 <free@plt>
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
push   %r14
push   %rbx
sub    $0x68,%rsp
mov    $0x64,%edi
call   1070 <malloc@plt>
lea    0x1(%rax),%rbx
mov    %rsp,%r14
mov    %r14,%rdi
call   1060 <fill@plt>
mov    %rbx,%rdi
call   1060 <fill@plt>
mov    %rbx,%rdi
call   1050 <copy@plt>
mov    %rax,%rdi
mov    %r14,%rsi
call   1040 <strcpy@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
add    $0x68,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @f() {
%1 = alloca [100 x i8]
%2 = alloca i8*
%3 = alloca i8*
%4 = call i64 @malloc(i32 100)
%5 = inttoptr i64 %4 to i8*
store i8* %5, i8** %2
%6 = load i8*, i8** %2
%7 = getelementptr inbounds i8, i8* %6, i32 1
store i8* %7, i8** %2
%8 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%9 = call i32 @fill(i8* %8)
%10 = load i8*, i8** %2
%11 = call i32 @fill(i8* %10)
%12 = load i8*, i8** %2
%13 = call i8* @copy(i8* %12)
store i8* %13, i8** %3
%14 = load i8*, i8** %3
%15 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%16 = call i32 @strcpy(i8* %14, i8* %15)
%17 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%18 = call i32 @free(i8* %17)
%19 = load i8*, i8** %2
%20 = call i32 @free(i8* %19)
ret void
}

LLVM IR (-O2):
define void @f() {
%1 = alloca [100 x i8]
%2 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%3 = tail call i64 @malloc(i32 100)
%4 = inttoptr i64 %3 to i8*
%5 = getelementptr inbounds i8, i8* %4, i64 1
%6 = call i32 @fill(i8* %2)
%7 = call i32 @fill(i8* %5)
%8 = call i8* @copy(i8* %5)
%9 = call i32 @strcpy(i8* %8, i8* %2)
%10 = call i32 @free(i8* %2)
%11 = call i32 @free(i8* %5)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ system(char *);
void admin() { system("sh"); }


x86 assembly (clang, -O0):
<admin>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <system@plt>
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [3 x i8] c"sh\00"
define void @admin() {
%1 = call i32 @system(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"sh\00"
define void @admin() {
%1 = tail call i32 @system(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
ret void
}
void read_mesh_databases_mpi_ic_adios_(void) {}


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

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

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

LLVM IR (-O2):
define void @read_mesh_databases_mpi_ic_adios_() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Print_Array(int *, int);
int /*<<< orphan*/ Selection_Sort(int *, int);
int main() {
  int array[] = {2, 4, 3, 1, 6, 8, 4};
  Selection_Sort(array, 7);
  Print_Array(array, 7);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xec7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xec4(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xec2(%rip),%eax
mov    %eax,-0x8(%rbp)
lea    -0x20(%rbp),%rdi
mov    $0x7,%esi
call   1030 <Selection_Sort@plt>
lea    -0x20(%rbp),%rdi
mov    $0x7,%esi
call   1040 <Print_Array@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
movups 0xee0(%rip),%xmm0
movups %xmm0,0xc(%rsp)
movaps 0xec8(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x7,%esi
call   1030 <Selection_Sort@plt>
mov    %rbx,%rdi
mov    $0x7,%esi
call   1040 <Print_Array@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.array = [7 x i32] [i32 2, i32 4, i32 3, i32 1, i32 6, i32 8, i32 4]
define i32 @main() {
%1 = alloca i32
%2 = alloca [7 x i32]
store i32 0, i32* %1
%3 = bitcast [7 x i32]* %2 to i8*
%4 = getelementptr inbounds [7 x i32], [7 x i32]* %2, i64 0, i64 0
%5 = call i32 @Selection_Sort(i32* %4, i32 7)
%6 = getelementptr inbounds [7 x i32], [7 x i32]* %2, i64 0, i64 0
%7 = call i32 @Print_Array(i32* %6, i32 7)
ret i32 0
}

LLVM IR (-O2):
@__const.main.array = [7 x i32] [i32 2, i32 4, i32 3, i32 1, i32 6, i32 8, i32 4]
define i32 @main() {
%1 = alloca [7 x i32]
%2 = bitcast [7 x i32]* %1 to i8*
%3 = getelementptr inbounds [7 x i32], [7 x i32]* %1, i64 0, i64 0
%4 = call i32 @Selection_Sort(i32* %3, i32 7)
%5 = call i32 @Print_Array(i32* %3, i32 7)
ret i32 0
}
/* Variables and functions */
int gzread(void *, char *, int);
int xgzread(void *cookie, char *data, int size) {
  return gzread(cookie, data, size);
}


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

x86 assembly (clang, -O2):
<xgzread>:
jmp    1030 <gzread@plt>

LLVM IR (-O0):
define i32 @xgzread(i8* %0, i8* %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 i8*, i8** %4
%8 = load i8*, i8** %5
%9 = load i32, i32* %6
%10 = call i32 @gzread(i8* %7, i8* %8, i32 %9)
ret i32 %10
}

LLVM IR (-O2):
define i32 @xgzread(i8* %0, i8* %1, i32 %2) {
%4 = tail call i32 @gzread(i8* %0, i8* %1, i32 %2)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int read(int, char *, int);
int readData(int fd, char *data) {
  int ret;
  memset(data, 0, 512);
  ret = read(fd, data, 512 - 1);
  if (ret == 0)
    exit(1);
  0;
  return ret;
}


x86 assembly (clang, -O0):
<readData>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
xor    %esi,%esi
mov    $0x200,%edx
call   1030 <memset@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    $0x1ff,%edx
call   1040 <read@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    1177 <readData+0x47>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readData>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
mov    %rsi,%rdi
xor    %esi,%esi
mov    $0x200,%edx
call   1030 <memset@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    $0x1ff,%edx
call   1040 <read@plt>
test   %eax,%eax
je     1161 <readData+0x31>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
mov    $0x1,%edi
call   1050 <exit@plt>

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

LLVM IR (-O2):
define i32 @readData(i32 %0, i8* %1) {
%3 = tail call i32 @memset(i8* %1, i32 0, i32 512)
%4 = tail call i32 @read(i32 %0, i8* %1, i32 511)
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = tail call i32 @exit(i32 1)
unreachable
8: ; preds = %2
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ put32(unsigned int);
int /*<<< orphan*/ put8(int);
void mul_m32(unsigned int *m32) {
  put8(0xF7);
  put8(0x25);
  put32((unsigned int)(m32));
}


x86 assembly (clang, -O0):
<mul_m32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0xf7,%edi
call   1030 <put8@plt>
mov    $0x25,%edi
call   1030 <put8@plt>
mov    -0x8(%rbp),%rax
mov    %eax,%edi
call   1040 <put32@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mul_m32>:
push   %rbx
mov    %rdi,%rbx
mov    $0xf7,%edi
call   1030 <put8@plt>
mov    $0x25,%edi
call   1030 <put8@plt>
mov    %ebx,%edi
pop    %rbx
jmp    1040 <put32@plt>

LLVM IR (-O0):
define void @mul_m32(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = call i32 @put8(i32 247)
%4 = call i32 @put8(i32 37)
%5 = load i32*, i32** %2
%6 = ptrtoint i32* %5 to i32
%7 = call i32 @put32(i32 %6)
ret void
}

LLVM IR (-O2):
define void @mul_m32(i32* %0) {
%2 = tail call i32 @put8(i32 247)
%3 = tail call i32 @put8(i32 37)
%4 = ptrtoint i32* %0 to i64
%5 = trunc i64 %4 to i32
%6 = tail call i32 @put32(i32 %5)
ret void
}
int array2d_count_digits(int value) {
  int i = 0, n = value, digits = 0;
  for (i = 0; 1; i++) {
    n = n / 10;
    if (n == 0) {
      break;
    }
  }
  digits = i + 1;
  if (value < 0) {
    digits += 1;
  }
  return digits;
}


x86 assembly (clang, -O0):
<array2d_count_digits>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x8(%rbp)
mov    $0x1,%al
test   $0x1,%al
jne    1131 <array2d_count_digits+0x31>
jmp    1161 <array2d_count_digits+0x61>
mov    -0xc(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    114e <array2d_count_digits+0x4e>
jmp    1161 <array2d_count_digits+0x61>
jmp    1153 <array2d_count_digits+0x53>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1122 <array2d_count_digits+0x22>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    117d <array2d_count_digits+0x7d>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<array2d_count_digits>:
mov    %edi,%eax
lea    0x9(%rax),%edx
mov    $0x1,%ecx
cmp    $0x13,%edx
jb     1145 <array2d_count_digits+0x45>
mov    $0x1,%ecx
mov    %eax,%edx
cs nopw 0x0(%rax,%rax,1)
movslq %edx,%rdx
imul   $0x66666667,%rdx,%rsi
mov    %rsi,%rdi
shr    $0x3f,%rdi
sar    $0x22,%rsi
lea    (%rsi,%rdi,1),%edx
add    $0x1,%ecx
add    %edi,%esi
add    $0x9,%esi
cmp    $0x12,%esi
ja     1120 <array2d_count_digits+0x20>
shr    $0x1f,%eax
add    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @array2d_count_digits(i32 %0) {
%2 = add i32 %0, 9
%3 = icmp ult i32 %2, 19
br i1 %3, label %11, label %4
4: ; preds = %1, %4
%5 = phi i32 [ %7, %4 ], [ %0, %1 ]
%6 = phi i32 [ %8, %4 ], [ 1, %1 ]
%7 = sdiv i32 %5, 10
%8 = add i32 %6, 1
%9 = add nsw i32 %7, 9
%10 = icmp ult i32 %9, 19
br i1 %10, label %11, label %4
11: ; preds = %4, %1
%12 = phi i32 [ 1, %1 ], [ %8, %4 ]
%13 = lshr i32 %0, 31
%14 = add nsw i32 %12, %13
ret i32 %14
}
int main(int argc, char **argv) {
  int i, j;
  j = 1;
  i = ({
    int __tmp;
    __tmp = (5);
    __tmp;
  });
  j = ({
    int __tmp;
    __tmp = (5);
    fvoid();
  });
  printf("%d\n", i);
  return 1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x18(%rbp)
movl   $0x5,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,-0x14(%rbp)
movl   $0x5,-0x24(%rbp)
mov    $0x0,%al
call   1040 <fvoid@plt>
mov    %eax,-0x28(%rbp)
mov    -0x28(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%esi
lea    0xe8f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x1,%eax
add    $0x30,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @fvoid()
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 5)
ret i32 1
}
/* Variables and functions */
scalar_t__ __builtin_y1(double);
int /*<<< orphan*/ link_failure_builtin_y1();
void test_builtin_y1(double d) {
  if (__builtin_y1(d) != __builtin_y1(d))
    link_failure_builtin_y1();
}


x86 assembly (clang, -O0):
<test_builtin_y1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <__builtin_y1@plt>
mov    %rax,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <__builtin_y1@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
cmp    %rcx,%rax
je     115c <test_builtin_y1+0x3c>
mov    $0x0,%al
call   1040 <link_failure_builtin_y1@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_builtin_y1>:
push   %rbx
sub    $0x10,%rsp
movsd  %xmm0,0x8(%rsp)
call   1030 <__builtin_y1@plt>
mov    %rax,%rbx
movsd  0x8(%rsp),%xmm0
call   1030 <__builtin_y1@plt>
cmp    %rax,%rbx
jne    1149 <test_builtin_y1+0x29>
add    $0x10,%rsp
pop    %rbx
ret
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
jmp    1040 <link_failure_builtin_y1@plt>

LLVM IR (-O0):
define void @test_builtin_y1(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call i64 @__builtin_y1(double %3)
%5 = load double, double* %2
%6 = call i64 @__builtin_y1(double %5)
%7 = icmp ne i64 %4, %6
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = call i32 (...) @link_failure_builtin_y1()
br label %10
10: ; preds = %8, %1
ret void
}

LLVM IR (-O2):
define void @test_builtin_y1(double %0) {
%2 = tail call i64 @__builtin_y1(double %0)
%3 = tail call i64 @__builtin_y1(double %0)
%4 = icmp eq i64 %2, %3
br i1 %4, label %7, label %5
5: ; preds = %1
%6 = tail call i32 (...) @link_failure_builtin_y1()
br label %7
7: ; preds = %5, %1
ret void
}