xunge/DecIR huggingface dataset:
void CFGMR3QueryStringAlloc(void) {}


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

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

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

LLVM IR (-O2):
define void @CFGMR3QueryStringAlloc() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ regex_t;

/* Variables and functions */
int /*<<< orphan*/ free(int /*<<< orphan*/ *);
int /*<<< orphan*/ regfree(int /*<<< orphan*/ *);
void c_regfree_(regex_t **preg) {
  regfree(*preg);
  free(*preg);
}


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

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

LLVM IR (-O0):
define void @c_regfree_(i32** %0) {
%2 = alloca i32**
store i32** %0, i32*** %2
%3 = load i32**, i32*** %2
%4 = load i32*, i32** %3
%5 = call i32 @regfree(i32* %4)
%6 = load i32**, i32*** %2
%7 = load i32*, i32** %6
%8 = call i32 @free(i32* %7)
ret void
}

LLVM IR (-O2):
define void @c_regfree_(i32** nocapture %0) {
%2 = load i32*, i32** %0
%3 = tail call i32 @regfree(i32* %2)
%4 = load i32*, i32** %0
%5 = tail call i32 @free(i32* %4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void display(int a) { printf("%d", a); }


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

x86 assembly (clang, -O2):
<display>:
mov    %edi,%esi
lea    0xee7(%rip),%rdi
jmp    1030 <printf@plt>

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

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

/* Variables and functions */
uint8_t ses_config_enclosure_descriptor_num_processes(uint8_t *data) {
  return data[0] & 0x7;
}


x86 assembly (clang, -O0):
<ses_config_enclosure_descriptor_num_processes>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
and    $0x7,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ses_config_enclosure_descriptor_num_processes>:
mov    (%rdi),%eax
and    $0x7,%eax
ret

LLVM IR (-O0):
define i32 @ses_config_enclosure_descriptor_num_processes(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = getelementptr inbounds i32, i32* %3, i64 0
%5 = load i32, i32* %4
%6 = and i32 %5, 7
ret i32 %6
}

LLVM IR (-O2):
define i32 @ses_config_enclosure_descriptor_num_processes(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = and i32 %2, 7
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ k_core_dump();
int /*<<< orphan*/ kmem_check_leak();
int /*<<< orphan*/ kmem_check_start();
int /*<<< orphan*/ kmem_check_stop();
int /*<<< orphan*/ mtrace();
int main() {
  mtrace();
  k_core_dump();
  kmem_check_start();
  getchar();
  kmem_check_leak();
  getchar();
  kmem_check_stop();
  getchar();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1080 <mtrace@plt>
mov    $0x0,%al
call   1060 <k_core_dump@plt>
mov    $0x0,%al
call   1070 <kmem_check_start@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    $0x0,%al
call   1030 <kmem_check_leak@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    $0x0,%al
call   1040 <kmem_check_stop@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1080 <mtrace@plt>
xor    %eax,%eax
call   1060 <k_core_dump@plt>
xor    %eax,%eax
call   1070 <kmem_check_start@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
xor    %eax,%eax
call   1030 <kmem_check_leak@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
xor    %eax,%eax
call   1040 <kmem_check_stop@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @mtrace()
%3 = call i32 (...) @k_core_dump()
%4 = call i32 (...) @kmem_check_start()
%5 = call i32 (...) @getchar()
%6 = call i32 (...) @kmem_check_leak()
%7 = call i32 (...) @getchar()
%8 = call i32 (...) @kmem_check_stop()
%9 = call i32 (...) @getchar()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @mtrace()
%2 = tail call i32 (...) @k_core_dump()
%3 = tail call i32 (...) @kmem_check_start()
%4 = tail call i32 (...) @getchar()
%5 = tail call i32 (...) @kmem_check_leak()
%6 = tail call i32 (...) @getchar()
%7 = tail call i32 (...) @kmem_check_stop()
%8 = tail call i32 (...) @getchar()
ret i32 0
}
/* Type definitions */
struct ctrl_command {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ send_error(char *);
void send_zipstats(struct ctrl_command *unused) {
  send_error("can't send_zipstats -- no zlib support!");
}


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

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

LLVM IR (-O0):
%struct.ctrl_command = type { i32 }
@.str = [40 x i8] c"can't send_zipstats -- no zlib support!\00"
define void @send_zipstats(%struct.ctrl_command* %0) {
%2 = alloca %struct.ctrl_command*
store %struct.ctrl_command* %0, %struct.ctrl_command** %2
%3 = call i32 @send_error(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
%struct.ctrl_command = type { i32 }
@.str = [40 x i8] c"can't send_zipstats -- no zlib support!\00"
define void @send_zipstats(%struct.ctrl_command* nocapture readnone %0) {
%2 = tail call i32 @send_error(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
ret void
}
int main(void) {
#pragma omp parallel
  {
#pragma omp for schedule(guided, 10)
    for (int i = 0; i < 1826; i += 10)
      ;
#pragma omp for schedule(guided, 10)
    for (int i = 0; i > -1826; i -= 10)
      ;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x722,-0x8(%rbp)
jge    1132 <main+0x32>
jmp    1124 <main+0x24>
mov    -0x8(%rbp),%eax
add    $0xa,%eax
mov    %eax,-0x8(%rbp)
jmp    1112 <main+0x12>
movl   $0x0,-0xc(%rbp)
cmpl   $0xfffff8de,-0xc(%rbp)
jle    1159 <main+0x59>
jmp    114b <main+0x4b>
mov    -0xc(%rbp),%eax
sub    $0xa,%eax
mov    %eax,-0xc(%rbp)
jmp    1139 <main+0x39>
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
br label %4
4: ; preds = %8, %0
%5 = load i32, i32* %2
%6 = icmp slt i32 %5, 1826
br i1 %6, label %7, label %11
7: ; preds = %4
br label %8
8: ; preds = %7
%9 = load i32, i32* %2
%10 = add nsw i32 %9, 10
store i32 %10, i32* %2
br label %4
11: ; preds = %4
store i32 0, i32* %3
br label %12
12: ; preds = %16, %11
%13 = load i32, i32* %3
%14 = icmp sgt i32 %13, -1826
br i1 %14, label %15, label %19
15: ; preds = %12
br label %16
16: ; preds = %15
%17 = load i32, i32* %3
%18 = sub nsw i32 %17, 10
store i32 %18, i32* %3
br label %12
19: ; preds = %12
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
void insl(unsigned short _port, unsigned long *_buff, unsigned _len) {
  asm("cld; rep; insl" ::"D"(_buff), "d"(_port), "c"(_len));
}


x86 assembly (clang, -O0):
<insl>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x2(%rbp),%dx
mov    -0x14(%rbp),%ecx
cld
rep insl (%dx),%es:(%rdi)
pop    %rbp
ret

x86 assembly (clang, -O2):
<insl>:
mov    %edx,%ecx
mov    %edi,%edx
mov    %rsi,%rdi
cld
rep insl (%dx),%es:(%rdi)
ret

LLVM IR (-O0):
define void @insl(i16 zeroext %0, i64* %1, i32 %2) {
%4 = alloca i16
%5 = alloca i64*
%6 = alloca i32
store i16 %0, i16* %4
store i64* %1, i64** %5
store i32 %2, i32* %6
%7 = load i64*, i64** %5
%8 = load i16, i16* %4
%9 = load i32, i32* %6
ret void
}

LLVM IR (-O2):
define void @insl(i16 zeroext %0, i64* %1, i32 %2) {
tail call void asm sideeffect "cld; rep; insl", "{di},{dx},{cx},~{dirflag},~{fpsr},~{flags}"(i64* %1, i16 %0, i32 %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ gv7600_read_reg(int, int /*<<< orphan*/);
int /*<<< orphan*/ spidev_close(int);
int spidev_open(char *, int /*<<< orphan*/);
int main() {
  int fd = spidev_open("/dev/spidev.0", 0);
  gv7600_read_reg(fd, 0);
  spidev_close(fd);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xec8(%rip),%rdi
xor    %esi,%esi
call   1030 <spidev_open@plt>
mov    %eax,%ebx
mov    %eax,%edi
xor    %esi,%esi
call   1040 <gv7600_read_reg@plt>
mov    %ebx,%edi
call   1050 <spidev_close@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [14 x i8] c"/dev/spidev.0\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @spidev_open(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 0)
store i32 %3, i32* %2
%4 = load i32, i32* %2
%5 = call i32 @gv7600_read_reg(i32 %4, i32 0)
%6 = load i32, i32* %2
%7 = call i32 @spidev_close(i32 %6)
ret i32 0
}

LLVM IR (-O2):
@.str = [14 x i8] c"/dev/spidev.0\00"
define i32 @main() {
%1 = tail call i32 @spidev_open(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 0)
%2 = tail call i32 @gv7600_read_reg(i32 %1, i32 0)
%3 = tail call i32 @spidev_close(i32 %1)
ret i32 0
}
void destroyColorArrays(double **color_array, int width, int height) {
  int i;
  for (i = 0; i < width; i++) {
    free(color_array[i]);
  }
  free(color_array);
}


x86 assembly (clang, -O0):
<destroyColorArrays>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1154 <destroyColorArrays+0x44>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1129 <destroyColorArrays+0x19>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<destroyColorArrays>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
test   %esi,%esi
jle    1142 <destroyColorArrays+0x32>
mov    %esi,%r15d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%r14,%rbx,8),%rdi
call   1030 <free@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1130 <destroyColorArrays+0x20>
mov    %r14,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @destroyColorArrays(double** nocapture %0, i32 %1, i32 %2) {
%4 = icmp sgt i32 %1, 0
br i1 %4, label %5, label %14
5: ; preds = %3
%6 = zext i32 %1 to i64
br label %7
7: ; preds = %5, %7
%8 = phi i64 [ 0, %5 ], [ %12, %7 ]
%9 = getelementptr inbounds double*, double** %0, i64 %8
%10 = bitcast double** %9 to i8**
%11 = load i8*, i8** %10
tail call void @free(i8* %11)
%12 = add nuw nsw i64 %8, 1
%13 = icmp eq i64 %12, %6
br i1 %13, label %14, label %7
14: ; preds = %7, %3
%15 = bitcast double** %0 to i8*
tail call void @free(i8* %15)
ret void
}
/* Type definitions */
typedef int int32_t;

/* Variables and functions */
int32_t return_int32_2() { return 1073741823; }


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

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

LLVM IR (-O0):
define i32 @return_int32_2() {
ret i32 1073741823
}

LLVM IR (-O2):
define i32 @return_int32_2() {
ret i32 1073741823
}
/* Type definitions */
typedef int /*<<< orphan*/ A;

/* Variables and functions */
int MaxSubsequenceSum(int *, int);
int /*<<< orphan*/ printf(char *, int);
main() {
  static int A[] = {4, -3, 5, -2, -1, 2, 6, -2};
  printf("Maxsum = %d\n", MaxSubsequenceSum(A, sizeof(A) / sizeof(A[0])));
  return 0;
}


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

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

LLVM IR (-O0):
@main.A = internal global [8 x i32] [i32 4, i32 -3, i32 5, i32 -2, i32 -1, i32 2, i32 6, i32 -2]
@.str = [13 x i8] c"Maxsum = %d\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @MaxSubsequenceSum(i32* getelementptr inbounds ([8 x i32], [8 x i32]* @main.A, i64 0, i64 0), i32 8)
%3 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %2)
ret i32 0
}

LLVM IR (-O2):
@main.A = internal global [8 x i32] [i32 4, i32 -3, i32 5, i32 -2, i32 -1, i32 2, i32 6, i32 -2]
@.str = [13 x i8] c"Maxsum = %d\0A\00"
define i32 @main() {
%1 = tail call i32 @MaxSubsequenceSum(i32* getelementptr inbounds ([8 x i32], [8 x i32]* @main.A, i64 0, i64 0), i32 8)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}
double piemathAdd(double a, double b) { return a + b; }


x86 assembly (clang, -O0):
<piemathAdd>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
addsd  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<piemathAdd>:
addsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @piemathAdd(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = load double, double* %4
%7 = fadd double %5, %6
ret double %7
}

LLVM IR (-O2):
define double @piemathAdd(double %0, double %1) {
%3 = fadd double %0, %1
ret double %3
}
/* Variables and functions */
int /*<<< orphan*/ GPIO_Configuration();
int /*<<< orphan*/ NVIC_Configuration();
int /*<<< orphan*/ RCC_Configuration();
void BSP_Init() {
  RCC_Configuration();
  GPIO_Configuration();
  NVIC_Configuration();
}


x86 assembly (clang, -O0):
<BSP_Init>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1050 <RCC_Configuration@plt>
mov    $0x0,%al
call   1030 <GPIO_Configuration@plt>
mov    $0x0,%al
call   1040 <NVIC_Configuration@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<BSP_Init>:
push   %rax
xor    %eax,%eax
call   1050 <RCC_Configuration@plt>
xor    %eax,%eax
call   1030 <GPIO_Configuration@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <NVIC_Configuration@plt>

LLVM IR (-O0):
define void @BSP_Init() {
%1 = call i32 (...) @RCC_Configuration()
%2 = call i32 (...) @GPIO_Configuration()
%3 = call i32 (...) @NVIC_Configuration()
ret void
}

LLVM IR (-O2):
define void @BSP_Init() {
%1 = tail call i32 (...) @RCC_Configuration()
%2 = tail call i32 (...) @GPIO_Configuration()
%3 = tail call i32 (...) @NVIC_Configuration()
ret void
}
/* Type definitions */
typedef int wchar_t;

/* Variables and functions */
wchar_t test8(void) { return L'\b'; }


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

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

LLVM IR (-O0):
define i32 @test8() {
ret i32 8
}

LLVM IR (-O2):
define i32 @test8() {
ret i32 8
}
void rop3_255_0_0(unsigned char *D, unsigned char S, unsigned char T) {
  unsigned char stk1;
  stk1 = 255;
  *D = stk1;
}


x86 assembly (clang, -O0):
<rop3_255_0_0>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %sil,%cl
mov    %rdi,-0x8(%rbp)
mov    %cl,-0x9(%rbp)
mov    %al,-0xa(%rbp)
movb   $0xff,-0xb(%rbp)
mov    -0xb(%rbp),%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<rop3_255_0_0>:
movb   $0xff,(%rdi)
ret

LLVM IR (-O0):
define void @rop3_255_0_0(i8* %0, i8 zeroext %1, i8 zeroext %2) {
%4 = alloca i8*
%5 = alloca i8
%6 = alloca i8
%7 = alloca i8
store i8* %0, i8** %4
store i8 %1, i8* %5
store i8 %2, i8* %6
store i8 -1, i8* %7
%8 = load i8, i8* %7
%9 = load i8*, i8** %4
store i8 %8, i8* %9
ret void
}

LLVM IR (-O2):
define void @rop3_255_0_0(i8* nocapture writeonly %0, i8 zeroext %1, i8 zeroext %2) {
store i8 -1, i8* %0
ret void
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
__attribute__((always_)) char nibble_to_hexchar(uint8_t nibble) {
  if (nibble > 9) {
    return (char)('A' + (nibble - 10));
  } else {
    return (char)('0' + nibble);
  }
}


x86 assembly (clang, -O0):
<nibble_to_hexchar>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x9,-0x8(%rbp)
jle    1122 <nibble_to_hexchar+0x22>
mov    -0x8(%rbp),%eax
sub    $0xa,%eax
add    $0x41,%eax
mov    %al,-0x1(%rbp)
jmp    112b <nibble_to_hexchar+0x2b>
mov    -0x8(%rbp),%eax
add    $0x30,%eax
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<nibble_to_hexchar>:
cmp    $0xa,%edi
mov    $0x37,%ecx
mov    $0x30,%eax
cmovge %ecx,%eax
add    %dil,%al
ret

LLVM IR (-O0):
define signext i8 @nibble_to_hexchar(i32 %0) {
%2 = alloca i8
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp sgt i32 %4, 9
br i1 %5, label %6, label %11
6: ; preds = %1
%7 = load i32, i32* %3
%8 = sub nsw i32 %7, 10
%9 = add nsw i32 65, %8
%10 = trunc i32 %9 to i8
store i8 %10, i8* %2
br label %15
11: ; preds = %1
%12 = load i32, i32* %3
%13 = add nsw i32 48, %12
%14 = trunc i32 %13 to i8
store i8 %14, i8* %2
br label %15
15: ; preds = %11, %6
%16 = load i8, i8* %2
ret i8 %16
}

LLVM IR (-O2):
define signext i8 @nibble_to_hexchar(i32 %0) {
%2 = icmp sgt i32 %0, 9
%3 = trunc i32 %0 to i8
%4 = select i1 %2, i8 55, i8 48
%5 = add i8 %4, %3
ret i8 %5
}
/* Type definitions */
struct snmp_pdu {
  int dummy;
};

/* Variables and functions */
struct snmp_pdu *_clone_pdu(struct snmp_pdu *, int /*<<< orphan*/);
struct snmp_pdu *snmp_clone_pdu(struct snmp_pdu *pdu) {
  return _clone_pdu(pdu, 0);
}


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

x86 assembly (clang, -O2):
<snmp_clone_pdu>:
xor    %esi,%esi
jmp    1030 <_clone_pdu@plt>

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

LLVM IR (-O2):
%struct.snmp_pdu = type { i32 }
define %struct.snmp_pdu* @snmp_clone_pdu(%struct.snmp_pdu* %0) {
%2 = tail call %struct.snmp_pdu* @_clone_pdu(%struct.snmp_pdu* %0, i32 0)
ret %struct.snmp_pdu* %2
}
/* Variables and functions */
int atoi(char *);
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char *argv[]) {
  int n = atoi(argv[1]);
  printf("%d\n", n * (n + 1) / 2);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0x14(%rbp),%ecx
add    $0x1,%ecx
imul   %ecx,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
lea    0xe9d(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x8(%rsi),%rdi
call   1040 <atoi@plt>
lea    0x1(%rax),%ecx
imul   %eax,%ecx
mov    %ecx,%esi
shr    $0x1f,%esi
add    %ecx,%esi
sar    %esi
lea    0xec0(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%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
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i8**, i8*** %5
%8 = getelementptr inbounds i8*, i8** %7, i64 1
%9 = load i8*, i8** %8
%10 = call i32 @atoi(i8* %9)
store i32 %10, i32* %6
%11 = load i32, i32* %6
%12 = load i32, i32* %6
%13 = add nsw i32 %12, 1
%14 = mul nsw i32 %11, %13
%15 = sdiv i32 %14, 2
%16 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %15)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\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 @atoi(i8* %4)
%6 = add nsw i32 %5, 1
%7 = mul nsw i32 %6, %5
%8 = sdiv i32 %7, 2
%9 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %8)
ret i32 0
}
char nibble2hexchr(int i) {
  unsigned char c = i & 0xf;
  return ((c < 10) ? (c + '0') : (c - 10 + 'a'));
}


x86 assembly (clang, -O0):
<nibble2hexchr>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xf,%eax
mov    %al,-0x5(%rbp)
movzbl -0x5(%rbp),%eax
cmp    $0xa,%eax
jge    112c <nibble2hexchr+0x2c>
movzbl -0x5(%rbp),%eax
add    $0x30,%eax
mov    %eax,-0xc(%rbp)
jmp    1139 <nibble2hexchr+0x39>
movzbl -0x5(%rbp),%eax
sub    $0xa,%eax
add    $0x61,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
movsbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<nibble2hexchr>:
and    $0xf,%edi
lea    0x57(%rdi),%eax
lea    0x30(%rdi),%ecx
cmp    $0xa,%edi
movzbl %cl,%ecx
movzbl %al,%eax
cmovb  %ecx,%eax
ret

LLVM IR (-O0):
define signext i8 @nibble2hexchr(i32 %0) {
%2 = alloca i32
%3 = alloca i8
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = and i32 %4, 15
%6 = trunc i32 %5 to i8
store i8 %6, i8* %3
%7 = load i8, i8* %3
%8 = zext i8 %7 to i32
%9 = icmp slt i32 %8, 10
br i1 %9, label %10, label %14
10: ; preds = %1
%11 = load i8, i8* %3
%12 = zext i8 %11 to i32
%13 = add nsw i32 %12, 48
br label %19
14: ; preds = %1
%15 = load i8, i8* %3
%16 = zext i8 %15 to i32
%17 = sub nsw i32 %16, 10
%18 = add nsw i32 %17, 97
br label %19
19: ; preds = %14, %10
%20 = phi i32 [ %13, %10 ], [ %18, %14 ]
%21 = trunc i32 %20 to i8
ret i8 %21
}

LLVM IR (-O2):
define signext i8 @nibble2hexchr(i32 %0) {
%2 = and i32 %0, 15
%3 = icmp ult i32 %2, 10
%4 = or i32 %2, 48
%5 = add nuw nsw i32 %2, 87
%6 = select i1 %3, i32 %4, i32 %5
%7 = trunc i32 %6 to i8
ret i8 %7
}
int main(void) {
  int i = 41;
  if (++i > 41) {
    return i;
  } else {
    return 99;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x29,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
cmp    $0x29,%eax
jle    112f <main+0x2f>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1136 <main+0x36>
movl   $0x63,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 42
}
/* Type definitions */
struct sockaddr_in {
  int dummy;
};
struct sockaddr {
  int dummy;
};
typedef int socklen_t;

/* Variables and functions */
int accept(int, struct sockaddr *, int *);
int /*<<< orphan*/ perror(char *);
int socket_accept(int server, struct sockaddr_in *addr) {
  int client;
  socklen_t ssize;
  ssize = sizeof(struct sockaddr_in);
  client = accept(server, (struct sockaddr *)addr, &ssize);
  if (client < 0)
    perror("server could not connect to client");
  return client;
}


x86 assembly (clang, -O0):
<socket_accept>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x4,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    -0x18(%rbp),%rdx
call   1040 <accept@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    115f <socket_accept+0x3f>
lea    0xea6(%rip),%rdi
call   1030 <perror@plt>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<socket_accept>:
push   %rbx
sub    $0x10,%rsp
movl   $0x4,0xc(%rsp)
lea    0xc(%rsp),%rdx
call   1040 <accept@plt>
mov    %eax,%ebx
test   %eax,%eax
js     1145 <socket_accept+0x25>
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
ret
lea    0xeb4(%rip),%rdi
call   1030 <perror@plt>
jmp    113d <socket_accept+0x1d>

LLVM IR (-O0):
%struct.sockaddr_in = type { i32 }
%struct.sockaddr = type { i32 }
@.str = [35 x i8] c"server could not connect to client\00"
define i32 @socket_accept(i32 %0, %struct.sockaddr_in* %1) {
%3 = alloca i32
%4 = alloca %struct.sockaddr_in*
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store %struct.sockaddr_in* %1, %struct.sockaddr_in** %4
store i32 4, i32* %6
%7 = load i32, i32* %3
%8 = load %struct.sockaddr_in*, %struct.sockaddr_in** %4
%9 = bitcast %struct.sockaddr_in* %8 to %struct.sockaddr*
%10 = call i32 @accept(i32 %7, %struct.sockaddr* %9, i32* %6)
store i32 %10, i32* %5
%11 = load i32, i32* %5
%12 = icmp slt i32 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %2
%14 = call i32 @perror(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
br label %15
15: ; preds = %13, %2
%16 = load i32, i32* %5
ret i32 %16
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32 }
%struct.sockaddr = type { i32 }
@.str = [35 x i8] c"server could not connect to client\00"
define i32 @socket_accept(i32 %0, %struct.sockaddr_in* %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
store i32 4, i32* %3
%5 = bitcast %struct.sockaddr_in* %1 to %struct.sockaddr*
%6 = call i32 @accept(i32 %0, %struct.sockaddr* %5, i32* %3)
%7 = icmp slt i32 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = call i32 @perror(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %8, %2
ret i32 %6
}
int palin(char s[], int n) {
  if (n == 0)
    return 1;
  else if (s != s + n)
    return 0;
  else
    return palin(s + 1, n - 1);
}


x86 assembly (clang, -O0):
<palin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    1135 <palin+0x25>
movl   $0x1,-0x4(%rbp)
jmp    116f <palin+0x5f>
mov    -0x10(%rbp),%rax
mov    -0x10(%rbp),%rcx
movslq -0x14(%rbp),%rdx
add    %rdx,%rcx
cmp    %rcx,%rax
je     1159 <palin+0x49>
movl   $0x0,-0x4(%rbp)
jmp    116f <palin+0x5f>
mov    -0x10(%rbp),%rdi
add    $0x1,%rdi
mov    -0x14(%rbp),%esi
sub    $0x1,%esi
call   1030 <palin@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<palin>:
xor    %eax,%eax
test   %esi,%esi
sete   %al
ret

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

LLVM IR (-O2):
define i32 @palin(i8* nocapture readnone %0, i32 %1) {
%3 = icmp eq i32 %1, 0
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ DAC_ISR();
int /*<<< orphan*/ TIM6_ISR();
void TIM6_DAC_ISR(void) {
  TIM6_ISR();
  DAC_ISR();
}


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

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

LLVM IR (-O0):
define void @TIM6_DAC_ISR() {
%1 = call i32 (...) @TIM6_ISR()
%2 = call i32 (...) @DAC_ISR()
ret void
}

LLVM IR (-O2):
define void @TIM6_DAC_ISR() {
%1 = tail call i32 (...) @TIM6_ISR()
%2 = tail call i32 (...) @DAC_ISR()
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ sigset_t;

/* Variables and functions */
int /*<<< orphan*/ EINVAL;
int /*<<< orphan*/ ENOSYS;
int /*<<< orphan*/ __set_errno(int /*<<< orphan*/);
int sigpending(sigset_t *set) {
  if (set == NULL) {
    __set_errno(EINVAL);
    return -1;
  }
  __set_errno(ENOSYS);
  return -1;
}


x86 assembly (clang, -O0):
<sigpending>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1141 <sigpending+0x31>
mov    0x2eaa(%rip),%rax
mov    (%rax),%edi
call   1030 <__set_errno@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1156 <sigpending+0x46>
mov    0x2ea0(%rip),%rax
mov    (%rax),%edi
call   1030 <__set_errno@plt>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sigpending>:
push   %rax
test   %rdi,%rdi
jne    111f <sigpending+0xf>
mov    0x2ebb(%rip),%rax
jmp    1126 <sigpending+0x16>
mov    0x2ec2(%rip),%rax
mov    (%rax),%edi
call   1030 <__set_errno@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
@EINVAL = global i32 0
@ENOSYS = global i32 0
define i32 @sigpending(i32* %0) {
%2 = alloca i32
%3 = alloca i32*
store i32* %0, i32** %3
%4 = load i32*, i32** %3
%5 = icmp eq i32* %4, null
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load i32, i32* @EINVAL
%8 = call i32 @__set_errno(i32 %7)
store i32 -1, i32* %2
br label %12
9: ; preds = %1
%10 = load i32, i32* @ENOSYS
%11 = call i32 @__set_errno(i32 %10)
store i32 -1, i32* %2
br label %12
12: ; preds = %9, %6
%13 = load i32, i32* %2
ret i32 %13
}

LLVM IR (-O2):
@EINVAL = global i32 0
@ENOSYS = global i32 0
define i32 @sigpending(i32* readnone %0) {
%2 = icmp eq i32* %0, null
%3 = load i32, i32* @EINVAL
%4 = load i32, i32* @ENOSYS
%5 = select i1 %2, i32 %3, i32 %4
%6 = tail call i32 @__set_errno(i32 %5)
ret i32 -1
}
char *FS__CLIB_strchr(const char *s, int c) {
  const char ch = c;
  for (; *s != ch; ++s) {
    if (*s == '\0') {
      return 0;
    }
  }
  return ((char *)s);
}


x86 assembly (clang, -O0):
<FS__CLIB_strchr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %al,-0x15(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
movsbl -0x15(%rbp),%ecx
cmp    %ecx,%eax
je     1157 <FS__CLIB_strchr+0x57>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1141 <FS__CLIB_strchr+0x41>
movq   $0x0,-0x8(%rbp)
jmp    115f <FS__CLIB_strchr+0x5f>
jmp    1146 <FS__CLIB_strchr+0x46>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1111 <FS__CLIB_strchr+0x11>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<FS__CLIB_strchr>:
mov    %rdi,%rax
movsbl %sil,%ecx
movsbl (%rdi),%edx
cmp    %edx,%ecx
je     1120 <FS__CLIB_strchr+0x20>
xchg   %ax,%ax
test   %dl,%dl
je     1121 <FS__CLIB_strchr+0x21>
movsbl 0x1(%rax),%edx
add    $0x1,%rax
cmp    %edx,%ecx
jne    1110 <FS__CLIB_strchr+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i8* @FS__CLIB_strchr(i8* %0, i32 %1) {
%3 = shl i32 %1, 24
%4 = ashr exact i32 %3, 24
%5 = load i8, i8* %0
%6 = sext i8 %5 to i32
%7 = icmp eq i32 %4, %6
br i1 %7, label %17, label %8
8: ; preds = %2, %12
%9 = phi i8 [ %14, %12 ], [ %5, %2 ]
%10 = phi i8* [ %13, %12 ], [ %0, %2 ]
%11 = icmp eq i8 %9, 0
br i1 %11, label %17, label %12
12: ; preds = %8
%13 = getelementptr inbounds i8, i8* %10, i64 1
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = icmp eq i32 %4, %15
br i1 %16, label %17, label %8
17: ; preds = %8, %12, %2
%18 = phi i8* [ %0, %2 ], [ %13, %12 ], [ null, %8 ]
ret i8* %18
}
int test_imm_B8int32_mem(int *val) {
  return ((*val) & (0xB8 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_B8int32_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%edx
and    $0xb8,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_B8int32_mem>:
testb  $0xb8,(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_B8int32_mem(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = load i32, i32* %3
%5 = and i32 %4, 184
%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_B8int32_mem(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = and i32 %2, 184
%4 = icmp eq i32 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
int non(int a) { return a; }


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

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

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

LLVM IR (-O2):
define i32 @non(i32 returned %0) {
ret i32 %0
}
/* Type definitions */
typedef int int64_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, double);
double stdlib_strided_dsemwd(int, int, double *, int);
int main() {
  double x[] = {1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0};
  int64_t N = 4;
  int64_t stride = 2;
  double v = stdlib_strided_dsemwd(N, 1, x, stride);
  printf("standard error of the mean: %lf\n", v);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
lea    -0x40(%rbp),%rdi
lea    0xebd(%rip),%rsi
mov    $0x40,%edx
call   1050 <memcpy@plt>
movl   $0x4,-0x44(%rbp)
movl   $0x2,-0x48(%rbp)
mov    -0x44(%rbp),%edi
lea    -0x40(%rbp),%rdx
mov    -0x48(%rbp),%ecx
mov    $0x1,%esi
call   1040 <stdlib_strided_dsemwd@plt>
movsd  %xmm0,-0x50(%rbp)
movsd  -0x50(%rbp),%xmm0
lea    0xec0(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x48,%rsp
movaps 0xf05(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xee9(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xecd(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xeb1(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdx
mov    $0x4,%edi
mov    $0x1,%esi
mov    $0x2,%ecx
call   1040 <stdlib_strided_dsemwd@plt>
lea    0xecf(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x48,%rsp
ret

LLVM IR (-O0):
@__const.main.x = [8 x double] [double 1.000000e+00, double 2.000000e+00, double 3.000000e+00, double 4.000000e+00, double 5.000000e+00, double 6.000000e+00, double 7.000000e+00, double 8.000000e+00]
@.str = [33 x i8] c"standard error of the mean: %lf\0A\00"
define i32 @main() {
%1 = alloca [8 x double]
%2 = alloca i32
%3 = alloca i32
%4 = alloca double
%5 = bitcast [8 x double]* %1 to i8*
store i32 4, i32* %2
store i32 2, i32* %3
%6 = load i32, i32* %2
%7 = getelementptr inbounds [8 x double], [8 x double]* %1, i64 0, i64 0
%8 = load i32, i32* %3
%9 = call double @stdlib_strided_dsemwd(i32 %6, i32 1, double* %7, i32 %8)
store double %9, double* %4
%10 = load double, double* %4
%11 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), double %10)
ret i32 0
}

LLVM IR (-O2):
@__const.main.x = [8 x double] [double 1.000000e+00, double 2.000000e+00, double 3.000000e+00, double 4.000000e+00, double 5.000000e+00, double 6.000000e+00, double 7.000000e+00, double 8.000000e+00]
@.str = [33 x i8] c"standard error of the mean: %lf\0A\00"
define i32 @main() {
%1 = alloca [8 x double]
%2 = bitcast [8 x double]* %1 to i8*
%3 = getelementptr inbounds [8 x double], [8 x double]* %1, i64 0, i64 0
%4 = call double @stdlib_strided_dsemwd(i32 4, i32 1, double* %3, i32 2)
%5 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), double %4)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void grep_error(char *message) {
  fprintf(stderr, "%s", message);
  exit(1);
}


x86 assembly (clang, -O0):
<grep_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xec0(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<grep_error>:
push   %rax
mov    %rdi,%rdx
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [3 x i8] c"%s\00"
define void @grep_error(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)
%6 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [3 x i8] c"%s\00"
define void @grep_error(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)
%4 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ output_char(char);
void output(char opcode) { output_char(opcode); }


x86 assembly (clang, -O0):
<output>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edi
call   1030 <output_char@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<output>:
jmp    1030 <output_char@plt>

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

LLVM IR (-O2):
define void @output(i8 signext %0) {
%2 = tail call i32 @output_char(i8 signext %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
pan() { printf("Panie Janie!\n"); }


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

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

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

LLVM IR (-O2):
@str = [13 x i8] c"Panie Janie!\00"
define i32 @pan() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
ret i32 undef
}
int test_imm_96uint8_reg(unsigned char val) {
  return ((val) & (-0x96 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_96uint8_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, -150
%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_96uint8_reg(i8 zeroext %0) {
%2 = and i8 %0, 106
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
int gl_fx_dummy_function_glidew(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @gl_fx_dummy_function_glidew() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void ngx_signal_handler(int signo) { printf("signo id = %d\n", signo); }


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

x86 assembly (clang, -O2):
<ngx_signal_handler>:
mov    %edi,%esi
lea    0xee7(%rip),%rdi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [15 x i8] c"signo id = %d\0A\00"
define void @ngx_signal_handler(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ foo();
int main(void) {
  int x, y, r;
  if (r) {
    x = 3;
    y = 5;
  } else {
    x = 4;
    y = 6;
  }
  assert(x < y);
  assert(y - x == 2);
  foo();
  assert(x < y);
  assert(y - x == 2);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
cmpl   $0x0,-0x10(%rbp)
je     114c <main+0x2c>
movl   $0x3,-0x8(%rbp)
movl   $0x5,-0xc(%rbp)
jmp    115a <main+0x3a>
movl   $0x4,-0x8(%rbp)
movl   $0x6,-0xc(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
setl   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0xc(%rbp),%eax
sub    -0x8(%rbp),%eax
cmp    $0x2,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    $0x0,%al
call   1040 <foo@plt>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
setl   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0xc(%rbp),%eax
sub    -0x8(%rbp),%eax
cmp    $0x2,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x1,%edi
call   1030 <assert@plt>
mov    $0x1,%edi
call   1030 <assert@plt>
xor    %eax,%eax
call   1040 <foo@plt>
mov    $0x1,%edi
call   1030 <assert@plt>
mov    $0x1,%edi
call   1030 <assert@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = load i32, i32* %4
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %0
store i32 3, i32* %2
store i32 5, i32* %3
br label %9
8: ; preds = %0
store i32 4, i32* %2
store i32 6, i32* %3
br label %9
9: ; preds = %8, %7
%10 = load i32, i32* %2
%11 = load i32, i32* %3
%12 = icmp slt i32 %10, %11
%13 = zext i1 %12 to i32
%14 = call i32 @assert(i32 %13)
%15 = load i32, i32* %3
%16 = load i32, i32* %2
%17 = sub nsw i32 %15, %16
%18 = icmp eq i32 %17, 2
%19 = zext i1 %18 to i32
%20 = call i32 @assert(i32 %19)
%21 = call i32 (...) @foo()
%22 = load i32, i32* %2
%23 = load i32, i32* %3
%24 = icmp slt i32 %22, %23
%25 = zext i1 %24 to i32
%26 = call i32 @assert(i32 %25)
%27 = load i32, i32* %3
%28 = load i32, i32* %2
%29 = sub nsw i32 %27, %28
%30 = icmp eq i32 %29, 2
%31 = zext i1 %30 to i32
%32 = call i32 @assert(i32 %31)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @assert(i32 1)
%2 = tail call i32 @assert(i32 1)
%3 = tail call i32 (...) @foo()
%4 = tail call i32 @assert(i32 1)
%5 = tail call i32 @assert(i32 1)
ret i32 0
}
extern __attribute__((__always___, __gnu___)) void *
memchr(void *__s, int __c, long unsigned int __n) {
  return __builtin_memchr(__s, __c, __n);
}


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

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

LLVM IR (-O0):
define i8* @memchr(i8* %0, i32 %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i64
store i8* %0, i8** %4
store i32 %1, i32* %5
store i64 %2, i64* %6
%7 = load i8*, i8** %4
%8 = load i32, i32* %5
%9 = load i64, i64* %6
%10 = call i8* @memchr(i8* %7, i32 %8, i64 %9)
ret i8* %10
}

LLVM IR (-O2):
define noalias i8* @memchr(i8* nocapture readnone %0, i32 %1, i64 %2) {
br label %4
4: ; preds = %4, %3
br label %4
}