xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
uint32_t TimerMatchGet(uint32_t ui32Base, uint32_t ui32Timer) {
  ;
  ;
  return ((ui32Timer == 0x000000ff)
              ? (*((volatile unsigned long *)(ui32Base + 0x00000030)))
              : (*((volatile unsigned long *)(ui32Base + 0x00000034))));
}


x86 assembly (clang, -O0):
<TimerMatchGet>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0xff,-0x8(%rbp)
jne    112b <TimerMatchGet+0x2b>
mov    -0x4(%rbp),%eax
add    $0x30,%eax
cltq
mov    (%rax),%rax
mov    %rax,-0x10(%rbp)
jmp    113a <TimerMatchGet+0x3a>
mov    -0x4(%rbp),%eax
add    $0x34,%eax
cltq
mov    (%rax),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<TimerMatchGet>:
xor    %eax,%eax
cmp    $0xff,%esi
setne  %al
lea    0x30(,%rax,4),%eax
movslq %edi,%rcx
mov    (%rax,%rcx,1),%rax
ret

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

LLVM IR (-O2):
define i32 @TimerMatchGet(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, 255
%4 = select i1 %3, i32 48, i32 52
%5 = add nsw i32 %4, %0
%6 = sext i32 %5 to i64
%7 = inttoptr i64 %6 to i64*
%8 = load volatile i64, i64* %7
%9 = trunc i64 %8 to i32
ret i32 %9
}
/* Variables and functions */
int f144(int *);
int f145(int *p) { return f144(p); }


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

x86 assembly (clang, -O2):
<f145>:
jmp    1030 <f144@plt>

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

LLVM IR (-O2):
define i32 @f145(i32* %0) {
%2 = tail call i32 @f144(i32* %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *);
void usage(void) {
  printf("\nUsage: rm FILENAME ...\n\n");
  exit(1);
}


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

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

LLVM IR (-O0):
@.str = [26 x i8] c"\0AUsage: rm FILENAME ...\0A\0A\00"
define void @usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@str = [25 x i8] c"\0AUsage: rm FILENAME ...\0A\00"
define void @usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @exit(i32 1)
unreachable
}
void av_video_enc_params_alloc() {}


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

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

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

LLVM IR (-O2):
define void @av_video_enc_params_alloc() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, unsigned int, unsigned int);
void ICPrintLastIndexByLength(unsigned int length) {
  printf("If length of array = %u ; Index of last element = %u\n", length,
         length - 1);
}


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

x86 assembly (clang, -O2):
<ICPrintLastIndexByLength>:
mov    %edi,%esi
lea    -0x1(%rsi),%edx
lea    0xee4(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [54 x i8] c"If length of array = %u ; Index of last element = %u\0A\00"
define void @ICPrintLastIndexByLength(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* %2
%5 = sub i32 %4, 1
%6 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0), i32 %3, i32 %5)
ret void
}

LLVM IR (-O2):
@.str = [54 x i8] c"If length of array = %u ; Index of last element = %u\0A\00"
define void @ICPrintLastIndexByLength(i32 %0) {
%2 = add i32 %0, -1
%3 = tail call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %2)
ret void
}
/* Type definitions */
struct ptr_list {
  int dummy;
};
struct expression_list {
  int dummy;
};

/* Variables and functions */
int ptr_list_size(struct ptr_list *);
int expression_list_size(struct expression_list *list) {
  return ptr_list_size((struct ptr_list *)(list));
}


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

x86 assembly (clang, -O2):
<expression_list_size>:
jmp    1030 <ptr_list_size@plt>

LLVM IR (-O0):
%struct.expression_list = type { i32 }
%struct.ptr_list = type { i32 }
define i32 @expression_list_size(%struct.expression_list* %0) {
%2 = alloca %struct.expression_list*
store %struct.expression_list* %0, %struct.expression_list** %2
%3 = load %struct.expression_list*, %struct.expression_list** %2
%4 = bitcast %struct.expression_list* %3 to %struct.ptr_list*
%5 = call i32 @ptr_list_size(%struct.ptr_list* %4)
ret i32 %5
}

LLVM IR (-O2):
%struct.expression_list = type { i32 }
%struct.ptr_list = type { i32 }
define i32 @expression_list_size(%struct.expression_list* %0) {
%2 = bitcast %struct.expression_list* %0 to %struct.ptr_list*
%3 = tail call i32 @ptr_list_size(%struct.ptr_list* %2)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main(int argc, char *argv[]) {
  int num, sqr;
  printf("Enter an integer value: ");
  scanf("%d", &num);
  sqr = (num * num);
  printf("The square of %d is %d\n", num, (num * num));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed5(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x14(%rbp),%eax
imul   -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%esi
mov    -0x14(%rbp),%edx
imul   -0x14(%rbp),%edx
lea    0xeb4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xee3(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%esi
mov    %esi,%edx
imul   %esi,%edx
lea    0xecc(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [25 x i8] c"Enter an integer value: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [24 x i8] c"The square of %d is %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store i8** %1, i8*** %4
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %5)
%9 = load i32, i32* %5
%10 = load i32, i32* %5
%11 = mul nsw i32 %9, %10
store i32 %11, i32* %6
%12 = load i32, i32* %5
%13 = load i32, i32* %5
%14 = load i32, i32* %5
%15 = mul nsw i32 %13, %14
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i32 %12, i32 %15)
ret i32 0
}

LLVM IR (-O2):
@.str = [25 x i8] c"Enter an integer value: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [24 x i8] c"The square of %d is %d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%7 = load i32, i32* %3
%8 = mul nsw i32 %7, %7
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i32 %7, i32 %8)
ret i32 0
}
void create_ctx_debugfs(struct ipc_log_context *ctxt, const char *mod_name) {}


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

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

LLVM IR (-O0):
%struct.ipc_log_context = type opaque
define void @create_ctx_debugfs(%struct.ipc_log_context* %0, i8* %1) {
%3 = alloca %struct.ipc_log_context*
%4 = alloca i8*
store %struct.ipc_log_context* %0, %struct.ipc_log_context** %3
store i8* %1, i8** %4
ret void
}

LLVM IR (-O2):
%struct.ipc_log_context = type opaque
define void @create_ctx_debugfs(%struct.ipc_log_context* nocapture %0, i8* nocapture %1) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ HplMsp430GeneralIOP__40__IO__selectModuleFunc();
void Msp430Adc12ImplP__Port60__selectModuleFunc(void) {
  HplMsp430GeneralIOP__40__IO__selectModuleFunc();
}


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

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

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

LLVM IR (-O2):
define void @Msp430Adc12ImplP__Port60__selectModuleFunc() {
%1 = tail call i32 (...) @HplMsp430GeneralIOP__40__IO__selectModuleFunc()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(int *);
int *malloc(int const);
int main(void) {
  const int SZ = 10;
  int *array = malloc(SZ * sizeof(int));
  for (int *p = array; p < &array[SZ];)
    *p++ = 0;
  free(array);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xa,-0x8(%rbp)
mov    $0x28,%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x10(%rbp),%rcx
add    $0x28,%rcx
cmp    %rcx,%rax
jae    117b <main+0x5b>
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x4,%rcx
mov    %rcx,-0x18(%rbp)
movl   $0x0,(%rax)
jmp    114c <main+0x2c>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x28,%edi
call   1040 <malloc@plt>
xorps  %xmm0,%xmm0
movups %xmm0,(%rax)
movups %xmm0,0x10(%rax)
movq   $0x0,0x20(%rax)
mov    %rax,%rdi
call   1030 <free@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
store i32 10, i32* %2
%5 = call i32* @malloc(i32 40)
store i32* %5, i32** %3
%6 = load i32*, i32** %3
store i32* %6, i32** %4
br label %7
7: ; preds = %12, %0
%8 = load i32*, i32** %4
%9 = load i32*, i32** %3
%10 = getelementptr inbounds i32, i32* %9, i64 10
%11 = icmp ult i32* %8, %10
br i1 %11, label %12, label %15
12: ; preds = %7
%13 = load i32*, i32** %4
%14 = getelementptr inbounds i32, i32* %13, i32 1
store i32* %14, i32** %4
store i32 0, i32* %13
br label %7
15: ; preds = %7
%16 = load i32*, i32** %3
%17 = call i32 @free(i32* %16)
%18 = load i32, i32* %1
ret i32 %18
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32* @malloc(i32 40)
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @free(i32* %1)
ret i32 0
}
/* Variables and functions */
void putc(char c) {
  while (!((*((volatile unsigned long *)0xE2900010)) & (1 << 2)))
    ;
  (*((volatile unsigned long *)0xE2900020)) = c;
}


x86 assembly (clang, -O0):
<putc>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    $0xe2900010,%eax
mov    (%rax),%rax
and    $0x4,%rax
cmp    $0x0,%rax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    112c <putc+0x2c>
jmp    1131 <putc+0x31>
jmp    110a <putc+0xa>
movsbq -0x1(%rbp),%rcx
mov    $0xe2900020,%eax
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<putc>:
mov    $0xe2900010,%eax
cs nopw 0x0(%rax,%rax,1)
nop
testq  $0x4,(%rax)
je     1110 <putc+0x10>
movsbq %dil,%rcx
mov    %rcx,0x10(%rax)
ret

LLVM IR (-O0):
define void @putc(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
br label %3
3: ; preds = %8, %1
%4 = load volatile i64, i64* inttoptr (i64 3801088016 to i64*)
%5 = and i64 %4, 4
%6 = icmp ne i64 %5, 0
%7 = xor i1 %6, true
br i1 %7, label %8, label %9
8: ; preds = %3
br label %3
9: ; preds = %3
%10 = load i8, i8* %2
%11 = sext i8 %10 to i64
store volatile i64 %11, i64* inttoptr (i64 3801088032 to i64*)
ret void
}

LLVM IR (-O2):
define void @putc(i8 signext %0) {
br label %2
2: ; preds = %2, %1
%3 = load volatile i64, i64* inttoptr (i64 3801088016 to i64*)
%4 = and i64 %3, 4
%5 = icmp eq i64 %4, 0
br i1 %5, label %2, label %6
6: ; preds = %2
%7 = sext i8 %0 to i64
store volatile i64 %7, i64* inttoptr (i64 3801088032 to i64*)
ret void
}
int test_imm_90int64_midword_reg(long long val) {
  return ((val >> 16) & (0x90 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_90int64_midword_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdx
sar    $0x10,%rdx
and    $0x90,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_90int64_midword_reg>:
test   $0x900000,%edi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_90int64_midword_reg(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = ashr i64 %3, 16
%5 = and i64 %4, 144
%6 = icmp ne i64 %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_90int64_midword_reg(i64 %0) {
%2 = and i64 %0, 9437184
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
void XtIsWidget() {}


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

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

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

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

/* Variables and functions */
int /*<<< orphan*/ memcpy(void *, void const *, int /*<<< orphan*/);
void pgm_read_block(const void *s, void *dest, uint8_t len) {
  memcpy(dest, s, len);
}


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

x86 assembly (clang, -O2):
<pgm_read_block>:
mov    %rdi,%rax
mov    %rsi,%rdi
mov    %rax,%rsi
jmp    1030 <memcpy@plt>

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

LLVM IR (-O2):
define void @pgm_read_block(i8* %0, i8* %1, i32 %2) {
%4 = tail call i32 @memcpy(i8* %1, i8* %0, i32 %2)
ret void
}
void loader() {}


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

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

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

LLVM IR (-O2):
define void @loader() {
ret void
}
/* Variables and functions */
scalar_t__ pthread_self();
int Ego() {
  int return_val;
  return_val = (int)pthread_self();
  return (return_val);
}


x86 assembly (clang, -O0):
<Ego>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <pthread_self@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @Ego() {
%1 = alloca i32
%2 = call i64 (...) @pthread_self()
%3 = trunc i64 %2 to i32
store i32 %3, i32* %1
%4 = load i32, i32* %1
ret i32 %4
}

LLVM IR (-O2):
define i32 @Ego() {
%1 = tail call i64 (...) @pthread_self()
%2 = trunc i64 %1 to i32
ret i32 %2
}
/* Type definitions */
struct tcb {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ tprintf(char *, int);
void printfd(struct tcb *tcp, int fd) { tprintf("%d", fd); }


x86 assembly (clang, -O0):
<printfd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xed7(%rip),%rdi
call   1030 <tprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.tcb = type { i32 }
@.str = [3 x i8] c"%d\00"
define void @printfd(%struct.tcb* %0, i32 %1) {
%3 = alloca %struct.tcb*
%4 = alloca i32
store %struct.tcb* %0, %struct.tcb** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = call i32 @tprintf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %5)
ret void
}

LLVM IR (-O2):
%struct.tcb = type { i32 }
@.str = [3 x i8] c"%d\00"
define void @printfd(%struct.tcb* nocapture readnone %0, i32 %1) {
%3 = tail call i32 @tprintf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %1)
ret void
}
/* Variables and functions */
int is_Prime(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int /*<<< orphan*/);
int main() {
  char s[10];
  scanf("%s", ({
          printf("Enter a number:");
          s;
        }));
  printf("%d", is_Prime(s));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xebd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0xe(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %eax,%esi
lea    0xe9e(%rip),%rdi
call   1040 <scanf@plt>
lea    -0xe(%rbp),%rdi
call   1050 <is_Prime@plt>
mov    %eax,%esi
lea    0xe9a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xec7(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x6(%rsp),%rbx
lea    0xeb1(%rip),%rdi
mov    %ebx,%esi
call   1040 <scanf@plt>
mov    %rbx,%rdi
call   1050 <is_Prime@plt>
lea    0xeae(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [16 x i8] c"Enter a number:\00"
@.str.2 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i8]
%3 = alloca i8*
store i32 0, i32* %1
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%5 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = ptrtoint i8* %6 to i32
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%10 = call i32 @is_Prime(i8* %9)
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %10)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [16 x i8] c"Enter a number:\00"
@.str.2 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca [10 x i8]
%2 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%4 = ptrtoint [10 x i8]* %1 to i64
%5 = trunc i64 %4 to i32
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = call i32 @is_Prime(i8* %2)
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %7)
ret i32 0
}
int check_year(int year) {
  if (year >= 1 && year <= 10)
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<check_year>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x1,-0x8(%rbp)
jl     1127 <check_year+0x27>
cmpl   $0xa,-0x8(%rbp)
jg     1127 <check_year+0x27>
movl   $0x1,-0x4(%rbp)
jmp    112e <check_year+0x2e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_year>:
add    $0xffffffff,%edi
xor    %eax,%eax
cmp    $0xa,%edi
setb   %al
ret

LLVM IR (-O0):
define i32 @check_year(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp sge i32 %4, 1
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i32, i32* %3
%8 = icmp sle i32 %7, 10
br i1 %8, label %9, label %10
9: ; preds = %6
store i32 1, i32* %2
br label %11
10: ; preds = %6, %1
store i32 0, i32* %2
br label %11
11: ; preds = %10, %9
%12 = load i32, i32* %2
ret i32 %12
}

LLVM IR (-O2):
define i32 @check_year(i32 %0) {
%2 = add i32 %0, -1
%3 = icmp ult i32 %2, 10
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void printArray(int arr[], int n) {
  int i;
  for (i = 0; i < n; ++i)
    printf("%d ", arr[i]);
  printf("\n");
}


x86 assembly (clang, -O0):
<printArray>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1159 <printArray+0x49>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <printArray+0x16>
lea    0xea4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printArray>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    1157 <printArray+0x37>
mov    %rdi,%r15
mov    %esi,%r12d
lea    0xec7(%rip),%r14
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    (%r15,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1140 <printArray+0x20>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%d \00"
@.str.1 = [2 x i8] c"\0A\00"
define void @printArray(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %6
6: ; preds = %17, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %4
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %20
10: ; preds = %6
%11 = load i32*, i32** %3
%12 = load i32, i32* %5
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i32, i32* %11, i64 %13
%15 = load i32, i32* %14
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %15)
br label %17
17: ; preds = %10
%18 = load i32, i32* %5
%19 = add nsw i32 %18, 1
store i32 %19, i32* %5
br label %6
20: ; preds = %6
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d \00"
define void @printArray(i32* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %11, %6 ]
%8 = getelementptr inbounds i32, i32* %0, i64 %7
%9 = load i32, i32* %8
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = add nuw nsw i64 %7, 1
%12 = icmp eq i64 %11, %5
br i1 %12, label %13, label %6
13: ; preds = %6, %2
%14 = tail call i32 @putchar(i32 10)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isspace(int);
void t_isspace_0x37() {
  Assert_real((isspace(55) == 0),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_isspace.c",
              280, ("isspace should be 0 for 7"));
}


x86 assembly (clang, -O0):
<t_isspace_0x37>:
push   %rbp
mov    %rsp,%rbp
mov    $0x37,%edi
call   1030 <isspace@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xebf(%rip),%rsi
mov    $0x118,%edx
lea    0xf5b(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_isspace_0x37>:
push   %rax
mov    $0x37,%edi
call   1030 <isspace@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x118,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isspace.c\00"
@.str.1 = [26 x i8] c"isspace should be 0 for 7\00"
define void @t_isspace_0x37() {
%1 = call i64 @isspace(i32 55)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 280, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isspace.c\00"
@.str.1 = [26 x i8] c"isspace should be 0 for 7\00"
define void @t_isspace_0x37() {
%1 = tail call i64 @isspace(i32 55)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 280, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}
struct flub *flub_toss_compact(struct flub *flub, unsigned long error) {
  return (struct flub *)error;
}


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

x86 assembly (clang, -O2):
<flub_toss_compact>:
mov    %rsi,%rax
ret

LLVM IR (-O0):
%struct.flub = type opaque
define %struct.flub* @flub_toss_compact(%struct.flub* %0, i64 %1) {
%3 = alloca %struct.flub*
%4 = alloca i64
store %struct.flub* %0, %struct.flub** %3
store i64 %1, i64* %4
%5 = load i64, i64* %4
%6 = inttoptr i64 %5 to %struct.flub*
ret %struct.flub* %6
}

LLVM IR (-O2):
%struct.flub = type opaque
define %struct.flub* @flub_toss_compact(%struct.flub* nocapture readnone %0, i64 %1) {
%3 = inttoptr i64 %1 to %struct.flub*
ret %struct.flub* %3
}
int nearest_even(int x) {
  if (x % 2 == 0)
    return x;
  else
    return x - 1;
}


x86 assembly (clang, -O0):
<nearest_even>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1126 <nearest_even+0x26>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    112f <nearest_even+0x2f>
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<nearest_even>:
mov    %edi,%eax
and    $0xfffffffe,%eax
ret

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

LLVM IR (-O2):
define i32 @nearest_even(i32 %0) {
%2 = and i32 %0, -2
ret i32 %2
}
int debug_strlen(const char *c) {}


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

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

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

LLVM IR (-O2):
define i32 @debug_strlen(i8* nocapture readnone %0) {
ret i32 undef
}
int get_col(int width, float f) {
  return width / 2 + (int)((width / 2) * f / 10000);
}


x86 assembly (clang, -O0):
<get_col>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movss  %xmm0,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
cvtsi2ss %ecx,%xmm0
mulss  -0x8(%rbp),%xmm0
movss  0xec5(%rip),%xmm1
divss  %xmm1,%xmm0
cvttss2si %xmm0,%ecx
add    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_col>:
mov    %edi,%ecx
shr    $0x1f,%ecx
add    %edi,%ecx
sar    %ecx
cvtsi2ss %ecx,%xmm1
mulss  %xmm0,%xmm1
divss  0xee7(%rip),%xmm1
cvttss2si %xmm1,%eax
add    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @get_col(i32 %0, float %1) {
%3 = alloca i32
%4 = alloca float
store i32 %0, i32* %3
store float %1, float* %4
%5 = load i32, i32* %3
%6 = sdiv i32 %5, 2
%7 = load i32, i32* %3
%8 = sdiv i32 %7, 2
%9 = sitofp i32 %8 to float
%10 = load float, float* %4
%11 = fmul float %9, %10
%12 = fdiv float %11, 1.000000e+04
%13 = fptosi float %12 to i32
%14 = add nsw i32 %6, %13
ret i32 %14
}

LLVM IR (-O2):
define i32 @get_col(i32 %0, float %1) {
%3 = sdiv i32 %0, 2
%4 = sitofp i32 %3 to float
%5 = fmul float %4, %1
%6 = fdiv float %5, 1.000000e+04
%7 = fptosi float %6 to i32
%8 = add nsw i32 %3, %7
ret i32 %8
}
int execute_getgroups() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @execute_getgroups() {
ret i32 0
}
/* Type definitions */
struct SN_env {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ SN_close_env(struct SN_env *, int /*<<< orphan*/);
extern void russian_UTF_8_close_env(struct SN_env *z) { SN_close_env(z, 0); }


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

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

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

LLVM IR (-O2):
%struct.SN_env = type { i32 }
define void @russian_UTF_8_close_env(%struct.SN_env* %0) {
%2 = tail call i32 @SN_close_env(%struct.SN_env* %0, i32 0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ test_find();
int /*<<< orphan*/ test_freq();
int /*<<< orphan*/ test_scan();
int /*<<< orphan*/ test_sort();
int main() {
  test_scan();
  test_find();
  test_sort();
  test_freq();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1050 <test_scan@plt>
mov    $0x0,%al
call   1030 <test_find@plt>
mov    $0x0,%al
call   1040 <test_sort@plt>
mov    $0x0,%al
call   1060 <test_freq@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1050 <test_scan@plt>
xor    %eax,%eax
call   1030 <test_find@plt>
xor    %eax,%eax
call   1040 <test_sort@plt>
xor    %eax,%eax
call   1060 <test_freq@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @test_scan()
%3 = call i32 (...) @test_find()
%4 = call i32 (...) @test_sort()
%5 = call i32 (...) @test_freq()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @test_scan()
%2 = tail call i32 (...) @test_find()
%3 = tail call i32 (...) @test_sort()
%4 = tail call i32 (...) @test_freq()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int main() {
  char A[] = "Hello";
  char B[10];
  strcpy(B, A);
  printf("A=%s\nB=%s\n", A, B);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xecb(%rip),%eax
mov    %eax,-0xa(%rbp)
mov    0xec5(%rip),%ax
mov    %ax,-0x6(%rbp)
lea    -0x14(%rbp),%rdi
lea    -0xa(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0xa(%rbp),%rsi
lea    -0x14(%rbp),%rdx
lea    0xea7(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
movw   $0x6f,0xc(%rsp)
movl   $0x6c6c6548,0x8(%rsp)
6c
lea    0xe(%rsp),%r14
lea    0x8(%rsp),%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
lea    0xeb4(%rip),%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.A = [6 x i8] c"Hello\00"
@.str = [11 x i8] c"A=%s\0AB=%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [6 x i8]
%3 = alloca [10 x i8]
store i32 0, i32* %1
%4 = bitcast [6 x i8]* %2 to i8*
%5 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [6 x i8], [6 x i8]* %2, i64 0, i64 0
%7 = call i32 @strcpy(i8* %5, i8* %6)
%8 = getelementptr inbounds [6 x i8], [6 x i8]* %2, i64 0, i64 0
%9 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
%10 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %8, i8* %9)
ret i32 0
}

LLVM IR (-O2):
@__const.main.A = [6 x i8] c"Hello\00"
@.str = [11 x i8] c"A=%s\0AB=%s\0A\00"
define i32 @main() {
%1 = alloca [6 x i8]
%2 = alloca [10 x i8]
%3 = getelementptr inbounds [6 x i8], [6 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%5 = call i32 @strcpy(i8* %4, i8* %3)
%6 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %3, i8* %4)
ret i32 0
}
int test_imm_36int8_mem(signed char *val) {
  return ((*val) & (0x36 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_36int8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, 54
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
void stop_monitor() {}


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

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

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

LLVM IR (-O2):
define void @stop_monitor() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ vecNf_mult_vecNf(float *, float const *, float const *, int);
void vec4f_mult_vec4f(float m[16], const float A[4], const float B[4]) {
  vecNf_mult_vecNf(m, A, B, 4);
}


x86 assembly (clang, -O0):
<vec4f_mult_vec4f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    $0x4,%ecx
call   1030 <vecNf_mult_vecNf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vec4f_mult_vec4f>:
mov    $0x4,%ecx
jmp    1030 <vecNf_mult_vecNf@plt>

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

LLVM IR (-O2):
define void @vec4f_mult_vec4f(float* %0, float* %1, float* %2) {
%4 = tail call i32 @vecNf_mult_vecNf(float* %0, float* %1, float* %2, i32 4)
ret void
}
int mask_shift(int d) {
  int n;
  n = 0;
  while ((d & 1) == 0) {
    d = d >> 1;
    n++;
  }
  return n;
}


x86 assembly (clang, -O0):
<mask_shift>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x4(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
jne    1134 <mask_shift+0x34>
mov    -0x4(%rbp),%eax
sar    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    110e <mask_shift+0xe>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mask_shift>:
xor    %eax,%eax
test   $0x1,%dil
jne    111d <mask_shift+0x1d>
xor    %eax,%eax
mov    %edi,%ecx
nopl   0x0(%rax)
sar    %ecx
add    $0x1,%eax
test   $0x2,%dil
mov    %ecx,%edi
je     1110 <mask_shift+0x10>
ret

LLVM IR (-O0):
define i32 @mask_shift(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
br label %4
4: ; preds = %8, %1
%5 = load i32, i32* %2
%6 = and i32 %5, 1
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %13
8: ; preds = %4
%9 = load i32, i32* %2
%10 = ashr i32 %9, 1
store i32 %10, i32* %2
%11 = load i32, i32* %3
%12 = add nsw i32 %11, 1
store i32 %12, i32* %3
br label %4
13: ; preds = %4
%14 = load i32, i32* %3
ret i32 %14
}

LLVM IR (-O2):
define i32 @mask_shift(i32 %0) {
%2 = and i32 %0, 1
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %11
4: ; preds = %1, %4
%5 = phi i32 [ %8, %4 ], [ 0, %1 ]
%6 = phi i32 [ %7, %4 ], [ %0, %1 ]
%7 = ashr i32 %6, 1
%8 = add nuw nsw i32 %5, 1
%9 = and i32 %6, 2
%10 = icmp eq i32 %9, 0
br i1 %10, label %4, label %11
11: ; preds = %4, %1
%12 = phi i32 [ 0, %1 ], [ %8, %4 ]
ret i32 %12
}
/* Variables and functions */
void *opa_realloc(void *, size_t);
void *realloc(void *ptr, size_t size) { return opa_realloc(ptr, size); }


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

x86 assembly (clang, -O2):
<realloc>:
jmp    1030 <opa_realloc@plt>

LLVM IR (-O0):
define i8* @realloc(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%5 = load i8*, i8** %3
%6 = load i64, i64* %4
%7 = call i8* @opa_realloc(i8* %5, i64 %6)
ret i8* %7
}

LLVM IR (-O2):
define i8* @realloc(i8* %0, i64 %1) {
%3 = tail call i8* @opa_realloc(i8* %0, i64 %1)
ret i8* %3
}
/* Variables and functions */
int increment(int);
int callee5(int n) {
  register int l1 = increment(n);
  register int l2 = increment(l1);
  register int l3 = increment(l2);
  register int l4 = increment(l3);
  register int l5 = increment(l4);
  return l1 + l2 + l3 + l4 + l5;
}


x86 assembly (clang, -O0):
<callee5>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <increment@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <increment@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1030 <increment@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%edi
call   1030 <increment@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
call   1030 <increment@plt>
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
add    -0x14(%rbp),%eax
add    -0x18(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<callee5>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
call   1030 <increment@plt>
mov    %eax,%r14d
mov    %eax,%edi
call   1030 <increment@plt>
mov    %eax,%ebp
mov    %eax,%edi
call   1030 <increment@plt>
mov    %eax,%r15d
mov    %eax,%edi
call   1030 <increment@plt>
mov    %eax,%ebx
mov    %eax,%edi
call   1030 <increment@plt>
add    %r14d,%ebp
add    %r15d,%ebp
add    %ebx,%ebp
add    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @callee5(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %2
%8 = load i32, i32* %2
%9 = call i32 @increment(i32 %8)
store i32 %9, i32* %3
%10 = load i32, i32* %3
%11 = call i32 @increment(i32 %10)
store i32 %11, i32* %4
%12 = load i32, i32* %4
%13 = call i32 @increment(i32 %12)
store i32 %13, i32* %5
%14 = load i32, i32* %5
%15 = call i32 @increment(i32 %14)
store i32 %15, i32* %6
%16 = load i32, i32* %6
%17 = call i32 @increment(i32 %16)
store i32 %17, i32* %7
%18 = load i32, i32* %3
%19 = load i32, i32* %4
%20 = add nsw i32 %18, %19
%21 = load i32, i32* %5
%22 = add nsw i32 %20, %21
%23 = load i32, i32* %6
%24 = add nsw i32 %22, %23
%25 = load i32, i32* %7
%26 = add nsw i32 %24, %25
ret i32 %26
}

LLVM IR (-O2):
define i32 @callee5(i32 %0) {
%2 = tail call i32 @increment(i32 %0)
%3 = tail call i32 @increment(i32 %2)
%4 = tail call i32 @increment(i32 %3)
%5 = tail call i32 @increment(i32 %4)
%6 = tail call i32 @increment(i32 %5)
%7 = add nsw i32 %3, %2
%8 = add nsw i32 %7, %4
%9 = add nsw i32 %8, %5
%10 = add nsw i32 %9, %6
ret i32 %10
}
/* Type definitions */
struct iovec {
  int dummy;
};
typedef int ssize_t;

/* Variables and functions */
int /*<<< orphan*/ ENOSYS;
int /*<<< orphan*/ errno;
ssize_t writev(int fildes, const struct iovec *iov, int iovcnt) {
  errno = ENOSYS;
  return -1;
}


x86 assembly (clang, -O0):
<writev>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    0x2ed3(%rip),%rax
mov    (%rax),%ecx
mov    0x2eba(%rip),%rax
mov    %ecx,(%rax)
mov    $0xffffffff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<writev>:
mov    0x2ee1(%rip),%rax
mov    (%rax),%eax
mov    0x2ec8(%rip),%rcx
mov    %eax,(%rcx)
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
%struct.iovec = type { i32 }
@ENOSYS = global i32 0
@errno = global i32 0
define i32 @writev(i32 %0, %struct.iovec* %1, i32 %2) {
%4 = alloca i32
%5 = alloca %struct.iovec*
%6 = alloca i32
store i32 %0, i32* %4
store %struct.iovec* %1, %struct.iovec** %5
store i32 %2, i32* %6
%7 = load i32, i32* @ENOSYS
store i32 %7, i32* @errno
ret i32 -1
}

LLVM IR (-O2):
%struct.iovec = type { i32 }
@ENOSYS = global i32 0
@errno = global i32 0
define i32 @writev(i32 %0, %struct.iovec* nocapture readnone %1, i32 %2) {
%4 = load i32, i32* @ENOSYS
store i32 %4, i32* @errno
ret i32 -1
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
char *pack_u8(char *buf, uint8_t val) {
  *(uint8_t *)buf = val;
  return buf + sizeof(uint8_t);
}


x86 assembly (clang, -O0):
<pack_u8>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
add    $0x4,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<pack_u8>:
mov    %esi,(%rdi)
lea    0x4(%rdi),%rax
ret

LLVM IR (-O0):
define i8* @pack_u8(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = load i8*, i8** %3
%7 = bitcast i8* %6 to i32*
store i32 %5, i32* %7
%8 = load i8*, i8** %3
%9 = getelementptr inbounds i8, i8* %8, i64 4
ret i8* %9
}

LLVM IR (-O2):
define i8* @pack_u8(i8* writeonly %0, i32 %1) {
%3 = bitcast i8* %0 to i32*
store i32 %1, i32* %3
%4 = getelementptr inbounds i8, i8* %0, i64 4
ret i8* %4
}
/* Variables and functions */
int /*<<< orphan*/ amicable_below(int);
int main() {
  amicable_below(1500);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x5dc,%edi
call   1030 <amicable_below@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @amicable_below(i32 1500)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @amicable_below(i32 1500)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ japi_setinsets(int, int, int, int, int);
void j_setinsets(int arg0, int arg1, int arg2, int arg3, int arg4) {
  japi_setinsets(arg0, arg1, arg2, arg3, arg4);
}


x86 assembly (clang, -O0):
<j_setinsets>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8d,-0x14(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
mov    -0x14(%rbp),%r8d
call   1030 <japi_setinsets@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<j_setinsets>:
jmp    1030 <japi_setinsets@plt>

LLVM IR (-O0):
define void @j_setinsets(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 %0, i32* %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i32 %4, i32* %10
%11 = load i32, i32* %6
%12 = load i32, i32* %7
%13 = load i32, i32* %8
%14 = load i32, i32* %9
%15 = load i32, i32* %10
%16 = call i32 @japi_setinsets(i32 %11, i32 %12, i32 %13, i32 %14, i32 %15)
ret void
}

LLVM IR (-O2):
define void @j_setinsets(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = tail call i32 @japi_setinsets(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4)
ret void
}
int c100(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @c100() {
ret i32 0
}
void test_25_2(int *mem) { __atomic_sub_fetch(mem, 1, 4); }


x86 assembly (clang, -O0):
<test_25_2>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdx
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
mov    %ecx,%eax
neg    %eax
lock xadd %eax,(%rdx)
sub    %ecx,%eax
mov    %eax,-0x10(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_25_2>:
lock subl $0x1,(%rdi)
ret

LLVM IR (-O0):
define void @test_25_2(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32
store i32* %0, i32** %2
%5 = load i32*, i32** %2
store i32 1, i32* %3
%6 = load i32, i32* %3
%7 = atomicrmw sub i32* %5, i32 %6 acq_rel
%8 = sub i32 %7, %6
store i32 %8, i32* %4
%9 = load i32, i32* %4
ret void
}

LLVM IR (-O2):
define void @test_25_2(i32* nocapture %0) {
%2 = atomicrmw sub i32* %0, i32 1 acq_rel
ret void
}