xunge/DecIR huggingface dataset:
int test_imm_EBuint32_mem(unsigned int *val) {
  return ((*val) & (0xEB << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_EBuint32_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, 235
%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_EBuint32_mem(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = and i32 %2, 235
%4 = icmp eq i32 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ hash_buffer(char const *, int /*<<< orphan*/);
int /*<<< orphan*/ strlen(char const *);
void hash_string(const char *s) { hash_buffer(s, strlen(s)); }


x86 assembly (clang, -O0):
<hash_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x10(%rbp),%rdi
mov    %eax,%esi
call   1040 <hash_buffer@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash_string>:
push   %rbx
mov    %rdi,%rbx
call   1030 <strlen@plt>
mov    %rbx,%rdi
mov    %eax,%esi
pop    %rbx
jmp    1040 <hash_buffer@plt>

LLVM IR (-O0):
define void @hash_string(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @strlen(i8* %4)
%6 = call i32 @hash_buffer(i8* %3, i32 %5)
ret void
}

LLVM IR (-O2):
define void @hash_string(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = tail call i32 @hash_buffer(i8* %0, i32 %2)
ret void
}
int base_bh() {}


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

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

LLVM IR (-O0):
define i32 @base_bh() {
%1 = alloca i32
%2 = load i32, i32* %1
ret i32 %2
}

LLVM IR (-O2):
define i32 @base_bh() {
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ VIM_HIF_SetReg8(int, unsigned char);
void VIM_JPEG_WriteYUVData(unsigned char byData) {
  VIM_HIF_SetReg8((0x0000 + 0x01C), byData);
}


x86 assembly (clang, -O0):
<VIM_JPEG_WriteYUVData>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    $0x1c,%edi
movzbl -0x1(%rbp),%esi
call   1030 <VIM_HIF_SetReg8@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<VIM_JPEG_WriteYUVData>:
mov    %edi,%esi
mov    $0x1c,%edi
jmp    1030 <VIM_HIF_SetReg8@plt>

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

LLVM IR (-O2):
define void @VIM_JPEG_WriteYUVData(i8 zeroext %0) {
%2 = tail call i32 @VIM_HIF_SetReg8(i32 28, i8 zeroext %0)
ret void
}
char checkTipoTrama(const unsigned char *tr) {
  switch (tr[16] & 3) {
  case 0:
    return 'I';
    break;
  case 1:
    return 'I';
    break;
  case 2:
    return 'S';
    break;
  case 3:
    return 'U';
    break;
  }
}


x86 assembly (clang, -O0):
<checkTipoTrama>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movzbl 0x10(%rax),%eax
and    $0x3,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x3,%eax
ja     1155 <checkTipoTrama+0x55>
mov    -0x18(%rbp),%rax
lea    0xed3(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movb   $0x49,-0x1(%rbp)
jmp    1155 <checkTipoTrama+0x55>
movb   $0x49,-0x1(%rbp)
jmp    1155 <checkTipoTrama+0x55>
movb   $0x53,-0x1(%rbp)
jmp    1155 <checkTipoTrama+0x55>
movb   $0x55,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<checkTipoTrama>:
mov    0x10(%rdi),%cl
shl    $0x3,%cl
mov    $0x55534949,%eax
shr    %cl,%eax
ret

LLVM IR (-O0):
define signext i8 @checkTipoTrama(i8* %0) {
%2 = alloca i8
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = getelementptr inbounds i8, i8* %4, i64 16
%6 = load i8, i8* %5
%7 = zext i8 %6 to i32
%8 = and i32 %7, 3
switch i32 %8, label %13 [
i32 0, label %9
i32 1, label %10
i32 2, label %11
i32 3, label %12
]
9: ; preds = %1
store i8 73, i8* %2
br label %13
10: ; preds = %1
store i8 73, i8* %2
br label %13
11: ; preds = %1
store i8 83, i8* %2
br label %13
12: ; preds = %1
store i8 85, i8* %2
br label %13
13: ; preds = %9, %10, %11, %12, %1
%14 = load i8, i8* %2
ret i8 %14
}

LLVM IR (-O2):
define signext i8 @checkTipoTrama(i8* nocapture %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 16
%3 = load i8, i8* %2
%4 = shl i8 %3, 3
%5 = and i8 %4, 24
%6 = zext i8 %5 to i32
%7 = lshr i32 1431521609, %6
%8 = trunc i32 %7 to i8
ret i8 %8
}
/* Variables and functions */
int /*<<< orphan*/ printLink(char *, char *);
int /*<<< orphan*/ printUsage();
int main(int argc, char *argv[]) {
  if (argc != 3) {
    printUsage();
    return -1;
  } else {
    printLink(argv[1], argv[2]);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     1153 <main+0x33>
mov    $0x0,%al
call   1030 <printUsage@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1168 <main+0x48>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
call   1040 <printLink@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
cmp    $0x3,%edi
jne    1137 <main+0x17>
mov    0x8(%rsi),%rdi
mov    0x10(%rsi),%rsi
call   1040 <printLink@plt>
xor    %eax,%eax
pop    %rcx
ret
xor    %eax,%eax
call   1030 <printUsage@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 3
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 (...) @printUsage()
br label %12
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = getelementptr inbounds i8*, i8** %1, i64 2
%10 = load i8*, i8** %9
%11 = tail call i32 @printLink(i8* %8, i8* %10)
br label %12
12: ; preds = %4, %6
%13 = phi i32 [ -1, %4 ], [ 0, %6 ]
ret i32 %13
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ system(char *);
int main(void) {
  int dec = 1;
  while (1) {
    int in = 0;
    scanf("%d", &in);
    system("clear");
    int bin = (1 << in);
    printf("%d\n", bin);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
lea    0xeac(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1050 <scanf@plt>
lea    0xe9f(%rip),%rdi
call   1030 <system@plt>
mov    -0xc(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %eax,-0x14(%rbp)
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%esi
lea    0xe86(%rip),%rdi
call   1040 <printf@plt>
jmp    1146 <main+0x16>

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
lea    0xec1(%rip),%r14
lea    0x4(%rsp),%r15
lea    0xeb8(%rip),%r12
lea    0xeb7(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movl   $0x0,0x4(%rsp)
mov    %r14,%rdi
mov    %r15,%rsi
call   1050 <scanf@plt>
mov    %r12,%rdi
call   1030 <system@plt>
movzbl 0x4(%rsp),%ecx
mov    $0x1,%esi
shl    %cl,%esi
mov    %rbx,%rdi
call   1040 <printf@plt>
jmp    1160 <main+0x30>

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [6 x i8] c"clear\00"
@.str.2 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 1, i32* %2
br label %5
5: ; preds = %0, %5
store i32 0, i32* %3
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%7 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%8 = load i32, i32* %3
%9 = shl i32 1, %8
store i32 %9, i32* %4
%10 = load i32, i32* %4
%11 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %10)
br label %5
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [6 x i8] c"clear\00"
@.str.2 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
br label %3
3: ; preds = %3, %0
store i32 0, i32* %1
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%5 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%6 = load i32, i32* %1
%7 = shl nuw i32 1, %6
%8 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %7)
br label %3
}
/* Type definitions */
struct Cyc_Lexing_lexbuf {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ Cyc_snarfsymbols_rec(struct Cyc_Lexing_lexbuf *, int);
int Cyc_snarfsymbols(struct Cyc_Lexing_lexbuf *lexbuf) {
  return ({ Cyc_snarfsymbols_rec(lexbuf, 15); });
}


x86 assembly (clang, -O0):
<Cyc_snarfsymbols>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0xf,%esi
call   1030 <Cyc_snarfsymbols_rec@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Cyc_snarfsymbols>:
mov    $0xf,%esi
jmp    1030 <Cyc_snarfsymbols_rec@plt>

LLVM IR (-O0):
%struct.Cyc_Lexing_lexbuf = type { i32 }
define i32 @Cyc_snarfsymbols(%struct.Cyc_Lexing_lexbuf* %0) {
%2 = alloca %struct.Cyc_Lexing_lexbuf*
%3 = alloca i32
store %struct.Cyc_Lexing_lexbuf* %0, %struct.Cyc_Lexing_lexbuf** %2
%4 = load %struct.Cyc_Lexing_lexbuf*, %struct.Cyc_Lexing_lexbuf** %2
%5 = call i32 @Cyc_snarfsymbols_rec(%struct.Cyc_Lexing_lexbuf* %4, i32 15)
store i32 %5, i32* %3
%6 = load i32, i32* %3
ret i32 %6
}

LLVM IR (-O2):
%struct.Cyc_Lexing_lexbuf = type { i32 }
define i32 @Cyc_snarfsymbols(%struct.Cyc_Lexing_lexbuf* %0) {
%2 = tail call i32 @Cyc_snarfsymbols_rec(%struct.Cyc_Lexing_lexbuf* %0, i32 15)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void *malloc(size_t);
int /*<<< orphan*/ printf(char *, void *, size_t);
void malloc_recursive(int i) {
  size_t size = i * 1024 * sizeof(char);
  void *ptr;
  if (i == 0)
    return;
  ptr = malloc(size);
  printf("addr=%p, size=%d\n", ptr, size);
  malloc_recursive(i - 1);
  free(ptr);
}


x86 assembly (clang, -O0):
<malloc_recursive>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shl    $0xa,%eax
cltq
shl    $0x0,%rax
mov    %rax,-0x10(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    116a <malloc_recursive+0x2a>
jmp    119f <malloc_recursive+0x5f>
mov    -0x10(%rbp),%rdi
call   1060 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
mov    -0x10(%rbp),%rdx
lea    0xe7a(%rip),%rdi
call   1040 <printf@plt>
mov    -0x4(%rbp),%edi
sub    $0x1,%edi
call   1050 <malloc_recursive@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<malloc_recursive>:
test   %edi,%edi
je     1187 <malloc_recursive+0x47>
push   %r15
push   %r14
push   %rbx
mov    %edi,%ebx
mov    %edi,%eax
shl    $0xa,%eax
movslq %eax,%r14
mov    %r14,%rdi
call   1060 <malloc@plt>
mov    %rax,%r15
lea    0xe9b(%rip),%rdi
mov    %rax,%rsi
mov    %r14,%rdx
call   1040 <printf@plt>
add    $0xffffffff,%ebx
mov    %ebx,%edi
call   1050 <malloc_recursive@plt>
mov    %r15,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <free@plt>
ret

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

LLVM IR (-O2):
@.str = [18 x i8] c"addr=%p, size=%d\0A\00"
define void @malloc_recursive(i32 %0) {
%2 = shl nsw i32 %0, 10
%3 = sext i32 %2 to i64
%4 = icmp eq i32 %0, 0
br i1 %4, label %5, label %6
5: ; preds = %1, %6
ret void
6: ; preds = %1
%7 = tail call i8* @malloc(i64 %3)
%8 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %7, i64 %3)
%9 = add nsw i32 %0, -1
tail call void @malloc_recursive(i32 %9)
%10 = tail call i32 @free(i8* %7)
br label %5
}
void d2i_OCSP_BASICRESP(void) {}


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

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

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

LLVM IR (-O2):
define void @d2i_OCSP_BASICRESP() {
ret void
}
unsigned long parity(unsigned long in) {
  in ^= in >> 16;
  in ^= in >> 8;
  in ^= in >> 4;
  in ^= in >> 2;
  in ^= in >> 1;
  return in & 1;
}


x86 assembly (clang, -O0):
<parity>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
shr    $0x10,%rax
xor    -0x8(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
shr    $0x8,%rax
xor    -0x8(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
shr    $0x4,%rax
xor    -0x8(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
shr    $0x2,%rax
xor    -0x8(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
shr    $0x1,%rax
xor    -0x8(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
and    $0x1,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<parity>:
mov    %rdi,%rax
shr    $0x10,%rax
xor    %rdi,%rax
mov    %rax,%rcx
shr    $0x8,%rcx
xor    %rax,%rcx
mov    %rcx,%rax
shr    $0x4,%rax
xor    %rcx,%rax
mov    %rax,%rcx
shr    $0x2,%rcx
xor    %eax,%ecx
mov    %ecx,%eax
shr    %eax
xor    %ecx,%eax
and    $0x1,%eax
ret

LLVM IR (-O0):
define i64 @parity(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = lshr i64 %3, 16
%5 = load i64, i64* %2
%6 = xor i64 %5, %4
store i64 %6, i64* %2
%7 = load i64, i64* %2
%8 = lshr i64 %7, 8
%9 = load i64, i64* %2
%10 = xor i64 %9, %8
store i64 %10, i64* %2
%11 = load i64, i64* %2
%12 = lshr i64 %11, 4
%13 = load i64, i64* %2
%14 = xor i64 %13, %12
store i64 %14, i64* %2
%15 = load i64, i64* %2
%16 = lshr i64 %15, 2
%17 = load i64, i64* %2
%18 = xor i64 %17, %16
store i64 %18, i64* %2
%19 = load i64, i64* %2
%20 = lshr i64 %19, 1
%21 = load i64, i64* %2
%22 = xor i64 %21, %20
store i64 %22, i64* %2
%23 = load i64, i64* %2
%24 = and i64 %23, 1
ret i64 %24
}

LLVM IR (-O2):
define i64 @parity(i64 %0) {
%2 = lshr i64 %0, 16
%3 = xor i64 %2, %0
%4 = lshr i64 %3, 8
%5 = xor i64 %4, %3
%6 = lshr i64 %5, 4
%7 = xor i64 %6, %5
%8 = lshr i64 %7, 2
%9 = xor i64 %8, %7
%10 = lshr i64 %9, 1
%11 = xor i64 %10, %9
%12 = and i64 %11, 1
ret i64 %12
}
__attribute__((always_)) void hlt(void) { __asm__ __volatile__("hlt"); }


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

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

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

LLVM IR (-O2):
define void @hlt() {
tail call void asm sideeffect "hlt", "~{dirflag},~{fpsr},~{flags}"()
ret void
}
/* Variables and functions */
int log2x(unsigned int);
void scale_binary_value(long x, int *nbits, unsigned *frac) {
  int i;
  i = log2x((unsigned)(x >> 16));
  *nbits += i;
  *frac = (unsigned)(x >> i);
}


x86 assembly (clang, -O0):
<scale_binary_value>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
sar    $0x10,%rax
mov    %eax,%edi
call   1030 <log2x@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%ecx
mov    -0x10(%rbp),%rax
add    (%rax),%ecx
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
mov    -0x1c(%rbp),%ecx
sar    %cl,%rax
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<scale_binary_value>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
shr    $0x10,%rdi
call   1030 <log2x@plt>
add    %eax,(%r15)
mov    %eax,%ecx
sar    %cl,%rbx
mov    %ebx,(%r14)
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @scale_binary_value(i64 %0, i32* %1, i32* %2) {
%4 = alloca i64
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32
store i64 %0, i64* %4
store i32* %1, i32** %5
store i32* %2, i32** %6
%8 = load i64, i64* %4
%9 = ashr i64 %8, 16
%10 = trunc i64 %9 to i32
%11 = call i32 @log2x(i32 %10)
store i32 %11, i32* %7
%12 = load i32, i32* %7
%13 = load i32*, i32** %5
%14 = load i32, i32* %13
%15 = add nsw i32 %14, %12
store i32 %15, i32* %13
%16 = load i64, i64* %4
%17 = load i32, i32* %7
%18 = zext i32 %17 to i64
%19 = ashr i64 %16, %18
%20 = trunc i64 %19 to i32
%21 = load i32*, i32** %6
store i32 %20, i32* %21
ret void
}

LLVM IR (-O2):
define void @scale_binary_value(i64 %0, i32* nocapture %1, i32* nocapture writeonly %2) {
%4 = lshr i64 %0, 16
%5 = trunc i64 %4 to i32
%6 = tail call i32 @log2x(i32 %5)
%7 = load i32, i32* %1
%8 = add nsw i32 %7, %6
store i32 %8, i32* %1
%9 = zext i32 %6 to i64
%10 = ashr i64 %0, %9
%11 = trunc i64 %10 to i32
store i32 %11, i32* %2
ret void
}
void putpixel(int x, int y, char color) {
  if (x < 0 || x >= 320)
    return;
  if (y < 0 || y >= 200)
    return;
  *((char *)(0xA0000 + (y * 320) + x)) = color;
}


x86 assembly (clang, -O0):
<putpixel>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
cmpl   $0x0,-0x4(%rbp)
jl     1126 <putpixel+0x26>
cmpl   $0x140,-0x4(%rbp)
jl     112b <putpixel+0x2b>
jmp    115d <putpixel+0x5d>
cmpl   $0x0,-0x8(%rbp)
jl     1142 <putpixel+0x42>
cmpl   $0xc8,-0x8(%rbp)
jl     1147 <putpixel+0x47>
jmp    115d <putpixel+0x5d>
mov    -0x9(%rbp),%cl
imul   $0x140,-0x8(%rbp),%eax
add    $0xa0000,%eax
add    -0x4(%rbp),%eax
cltq
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<putpixel>:
cmp    $0x13f,%edi
ja     1123 <putpixel+0x23>
cmp    $0xc7,%esi
ja     1123 <putpixel+0x23>
mov    %esi,%eax
lea    (%rax,%rax,4),%rax
shl    $0x6,%rax
mov    %edi,%ecx
mov    %dl,0xa0000(%rcx,%rax,1)
ret

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

LLVM IR (-O2):
define void @putpixel(i32 %0, i32 %1, i8 signext %2) {
%4 = icmp ugt i32 %0, 319
%5 = icmp ugt i32 %1, 199
%6 = or i1 %4, %5
br i1 %6, label %13, label %7
7: ; preds = %3
%8 = mul nuw nsw i32 %1, 320
%9 = add nuw nsw i32 %0, 655360
%10 = add nuw nsw i32 %9, %8
%11 = zext i32 %10 to i64
%12 = inttoptr i64 %11 to i8*
store i8 %2, i8* %12
br label %13
13: ; preds = %3, %7
ret void
}
/* Variables and functions */
int strcmp(char const *, char const *);
int compProc(const void *p1, const void *p2) {
  char const *pz1 = *(char *const *)p1;
  char const *pz2 = *(char *const *)p2;
  return strcmp(pz1, pz2);
}


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

x86 assembly (clang, -O2):
<compProc>:
mov    (%rdi),%rdi
mov    (%rsi),%rsi
jmp    1030 <strcmp@plt>

LLVM IR (-O0):
define i32 @compProc(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %3
%8 = bitcast i8* %7 to i8**
%9 = load i8*, i8** %8
store i8* %9, i8** %5
%10 = load i8*, i8** %4
%11 = bitcast i8* %10 to i8**
%12 = load i8*, i8** %11
store i8* %12, i8** %6
%13 = load i8*, i8** %5
%14 = load i8*, i8** %6
%15 = call i32 @strcmp(i8* %13, i8* %14)
ret i32 %15
}

LLVM IR (-O2):
define i32 @compProc(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i8**
%4 = load i8*, i8** %3
%5 = bitcast i8* %1 to i8**
%6 = load i8*, i8** %5
%7 = tail call i32 @strcmp(i8* dereferenceable(1) %4, i8* dereferenceable(1) %6)
ret i32 %7
}
void gdk_display_peek_event() {}


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

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

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

LLVM IR (-O2):
define void @gdk_display_peek_event() {
ret void
}
/* Variables and functions */
int __VERIFIER_nondet_int();
int main() {
  int c;
  int x, y;
  x = __VERIFIER_nondet_int();
  y = __VERIFIER_nondet_int();
  c = 0;
  while (x > y) {
    x = x - 1;
    c = c + 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <__VERIFIER_nondet_int@plt>
mov    %eax,-0xc(%rbp)
mov    $0x0,%al
call   1030 <__VERIFIER_nondet_int@plt>
mov    %eax,-0x10(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jle    115d <main+0x4d>
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    113a <main+0x2a>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <__VERIFIER_nondet_int@plt>
xor    %eax,%eax
call   1030 <__VERIFIER_nondet_int@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 = call i32 (...) @__VERIFIER_nondet_int()
store i32 %5, i32* %3
%6 = call i32 (...) @__VERIFIER_nondet_int()
store i32 %6, i32* %4
store i32 0, i32* %2
br label %7
7: ; preds = %11, %0
%8 = load i32, i32* %3
%9 = load i32, i32* %4
%10 = icmp sgt i32 %8, %9
br i1 %10, label %11, label %16
11: ; preds = %7
%12 = load i32, i32* %3
%13 = sub nsw i32 %12, 1
store i32 %13, i32* %3
%14 = load i32, i32* %2
%15 = add nsw i32 %14, 1
store i32 %15, i32* %2
br label %7
16: ; preds = %7
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @__VERIFIER_nondet_int()
%2 = tail call i32 (...) @__VERIFIER_nondet_int()
ret i32 0
}
int f(int s, int c) {
  int a1, a2, a3, x1, x2, x3, x;
  if (c > 0) {
    a1 = 2 * s;
    x1 = c + a1;
  } else {
    a1 = 4 * s;
    x1 = c + a1;
  }
  a2 = 6 * s;
  x2 = c + a2;
  x = x1 + x2;
  return x;
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jle    112b <f+0x2b>
mov    -0x4(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    113d <f+0x3d>
mov    -0x4(%rbp),%eax
shl    $0x2,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
imul   $0x6,-0x4(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%eax
add    -0x1c(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
test   %esi,%esi
setle  %cl
add    $0x1,%cl
mov    %edi,%edx
shl    %cl,%edx
lea    (%rdi,%rdi,2),%eax
add    %eax,%eax
lea    (%rax,%rsi,2),%eax
add    %edx,%eax
ret

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

LLVM IR (-O2):
define i32 @f(i32 %0, i32 %1) {
%3 = icmp slt i32 %1, 1
%4 = select i1 %3, i32 2, i32 1
%5 = shl nsw i32 %0, %4
%6 = mul nsw i32 %0, 6
%7 = shl i32 %1, 1
%8 = add i32 %7, %6
%9 = add i32 %8, %5
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ putchar(char const);
void put(const char s[]) {
  int i;
  for (i = 0; s[i]; i++)
    putchar(s[i]);
}


x86 assembly (clang, -O0):
<put>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
cmpb   $0x0,(%rax,%rcx,1)
je     1154 <put+0x44>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <putchar@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <put+0x13>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<put>:
push   %rbx
mov    (%rdi),%al
test   %al,%al
je     1133 <put+0x23>
mov    %rdi,%rbx
add    $0x1,%rbx
xchg   %ax,%ax
movsbl %al,%edi
call   1030 <putchar@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1120 <put+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @put(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %12, label %4
4: ; preds = %1, %4
%5 = phi i64 [ %8, %4 ], [ 0, %1 ]
%6 = phi i8 [ %10, %4 ], [ %2, %1 ]
%7 = tail call i32 @putchar(i8 signext %6)
%8 = add nuw i64 %5, 1
%9 = getelementptr inbounds i8, i8* %0, i64 %8
%10 = load i8, i8* %9
%11 = icmp eq i8 %10, 0
br i1 %11, label %12, label %4
12: ; preds = %4, %1
ret void
}
void test_107(unsigned short *x, unsigned int *y) { y[0] = x[1] >> 8; }


x86 assembly (clang, -O0):
<test_107>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movzwl 0x2(%rax),%ecx
sar    $0x8,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_107>:
movzbl 0x3(%rdi),%eax
mov    %eax,(%rsi)
ret

LLVM IR (-O0):
define void @test_107(i16* %0, i32* %1) {
%3 = alloca i16*
%4 = alloca i32*
store i16* %0, i16** %3
store i32* %1, i32** %4
%5 = load i16*, i16** %3
%6 = getelementptr inbounds i16, i16* %5, i64 1
%7 = load i16, i16* %6
%8 = zext i16 %7 to i32
%9 = ashr i32 %8, 8
%10 = load i32*, i32** %4
%11 = getelementptr inbounds i32, i32* %10, i64 0
store i32 %9, i32* %11
ret void
}

LLVM IR (-O2):
define void @test_107(i16* nocapture %0, i32* nocapture writeonly %1) {
%3 = getelementptr inbounds i16, i16* %0, i64 1
%4 = load i16, i16* %3
%5 = lshr i16 %4, 8
%6 = zext i16 %5 to i32
store i32 %6, i32* %1
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ __m512i;

/* Variables and functions */
void _mm512_storeu_epi8(void *, int /*<<< orphan*/);
void test_mm512_storeu_epi8(void *__P, __m512i __A) {
  return _mm512_storeu_epi8(__P, __A);
}


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

x86 assembly (clang, -O2):
<test_mm512_storeu_epi8>:
jmp    1030 <_mm512_storeu_epi8@plt>

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

LLVM IR (-O2):
define void @test_mm512_storeu_epi8(i8* %0, i32 %1) {
tail call void @_mm512_storeu_epi8(i8* %0, i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void hello_world() { printf("Hello, World!\n"); }


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

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

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

LLVM IR (-O2):
@str = [14 x i8] c"Hello, World!\00"
define void @hello_world() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int CountTree(int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  int n = CountTree(9);
  printf("%d is the number of trees\n", n);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x9,%edi
call   1040 <CountTree@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xec1(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [27 x i8] c"%d is the number of trees\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = call i32 @CountTree(i32 9)
store i32 %2, i32* %1
%3 = load i32, i32* %1
%4 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 %3)
ret i32 0
}

LLVM IR (-O2):
@.str = [27 x i8] c"%d is the number of trees\0A\00"
define i32 @main() {
%1 = tail call i32 @CountTree(i32 9)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}
/* Variables and functions */
int file_read(char *);
unsigned get_socket() { return file_read("socket.stim"); }


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

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

LLVM IR (-O0):
@.str = [12 x i8] c"socket.stim\00"
define i32 @get_socket() {
%1 = call i32 @file_read(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
ret i32 %1
}

LLVM IR (-O2):
@.str = [12 x i8] c"socket.stim\00"
define i32 @get_socket() {
%1 = tail call i32 @file_read(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
ret i32 %1
}
void rgb_shiftmask_get(int *shift, unsigned *mask, unsigned len, unsigned pos) {
  *shift = pos + len - 8;
  *mask = ((1 << len) - 1) << pos;
}


x86 assembly (clang, -O0):
<rgb_shiftmask_get>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    -0x18(%rbp),%ecx
add    -0x14(%rbp),%ecx
sub    $0x8,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x14(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
sub    $0x1,%eax
mov    -0x18(%rbp),%ecx
shl    %cl,%eax
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<rgb_shiftmask_get>:
mov    %ecx,%eax
mov    %edx,%ecx
lea    (%rcx,%rax,1),%edx
add    $0xfffffff8,%edx
mov    %edx,(%rdi)
mov    $0xffffffff,%edx
shl    %cl,%edx
not    %edx
mov    %eax,%ecx
shl    %cl,%edx
mov    %edx,(%rsi)
ret

LLVM IR (-O0):
define void @rgb_shiftmask_get(i32* %0, i32* %1, i32 %2, i32 %3) {
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
store i32* %0, i32** %5
store i32* %1, i32** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32, i32* %8
%10 = load i32, i32* %7
%11 = add i32 %9, %10
%12 = sub i32 %11, 8
%13 = load i32*, i32** %5
store i32 %12, i32* %13
%14 = load i32, i32* %7
%15 = shl i32 1, %14
%16 = sub nsw i32 %15, 1
%17 = load i32, i32* %8
%18 = shl i32 %16, %17
%19 = load i32*, i32** %6
store i32 %18, i32* %19
ret void
}

LLVM IR (-O2):
define void @rgb_shiftmask_get(i32* nocapture writeonly %0, i32* nocapture writeonly %1, i32 %2, i32 %3) {
%5 = add i32 %2, -8
%6 = add i32 %5, %3
store i32 %6, i32* %0
%7 = shl nsw i32 -1, %2
%8 = xor i32 %7, -1
%9 = shl i32 %8, %3
store i32 %9, i32* %1
ret void
}
int default_kad_validation(int mode, int ukad, int akad) { return 0; }


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

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

LLVM IR (-O0):
define i32 @default_kad_validation(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
ret i32 0
}

LLVM IR (-O2):
define i32 @default_kad_validation(i32 %0, i32 %1, i32 %2) {
ret i32 0
}
/* Variables and functions */
int syscall_write(int, char *, int);
int write(int file, char *ptr, int len) {
  return syscall_write(file, ptr, len);
}


x86 assembly (clang, -O0):
<write>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <syscall_write@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write>:
jmp    1030 <syscall_write@plt>

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

LLVM IR (-O2):
define i32 @write(i32 %0, i8* %1, i32 %2) {
%4 = tail call i32 @syscall_write(i32 %0, i8* %1, i32 %2)
ret i32 %4
}
void sigpipe_handler(int signum) { return; }


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

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

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

LLVM IR (-O2):
define void @sigpipe_handler(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ pl011_uart_write_char(int /*<<< orphan*/);
void pl011_uart_write_string(const char *str) {
  while (*str)
    pl011_uart_write_char(*str++);
}


x86 assembly (clang, -O0):
<pl011_uart_write_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1145 <pl011_uart_write_string+0x35>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%edi
call   1030 <pl011_uart_write_char@plt>
jmp    111c <pl011_uart_write_string+0xc>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pl011_uart_write_string>:
push   %rbx
mov    (%rdi),%al
test   %al,%al
je     1133 <pl011_uart_write_string+0x23>
mov    %rdi,%rbx
add    $0x1,%rbx
xchg   %ax,%ax
movsbl %al,%edi
call   1030 <pl011_uart_write_char@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1120 <pl011_uart_write_string+0x10>
pop    %rbx
ret

LLVM IR (-O0):
define void @pl011_uart_write_string(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
br label %3
3: ; preds = %7, %1
%4 = load i8*, i8** %2
%5 = load i8, i8* %4
%6 = icmp ne i8 %5, 0
br i1 %6, label %7, label %13
7: ; preds = %3
%8 = load i8*, i8** %2
%9 = getelementptr inbounds i8, i8* %8, i32 1
store i8* %9, i8** %2
%10 = load i8, i8* %8
%11 = sext i8 %10 to i32
%12 = call i32 @pl011_uart_write_char(i32 %11)
br label %3
13: ; preds = %3
ret void
}

LLVM IR (-O2):
define void @pl011_uart_write_string(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %12, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %10, %4 ], [ %2, %1 ]
%6 = phi i8* [ %7, %4 ], [ %0, %1 ]
%7 = getelementptr inbounds i8, i8* %6, i64 1
%8 = sext i8 %5 to i32
%9 = tail call i32 @pl011_uart_write_char(i32 %8)
%10 = load i8, i8* %7
%11 = icmp eq i8 %10, 0
br i1 %11, label %12, label %4
12: ; preds = %4, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ gethostname(char *, int);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ strncpy(char *, char *, int);
void __getmachinename(char *machineName) {
  char Name[150];
  int i = 0;
  memset(Name, 0, 150);
  gethostname(Name, 150);
  strncpy(machineName, Name, 150);
}


x86 assembly (clang, -O0):
<__getmachinename>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xa4(%rbp)
lea    -0xa0(%rbp),%rdi
xor    %esi,%esi
mov    $0x96,%edx
call   1040 <memset@plt>
lea    -0xa0(%rbp),%rdi
mov    $0x96,%esi
call   1050 <gethostname@plt>
mov    -0x8(%rbp),%rdi
lea    -0xa0(%rbp),%rsi
mov    $0x96,%edx
call   1030 <strncpy@plt>
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__getmachinename>:
push   %r14
push   %rbx
sub    $0x98,%rsp
mov    %rdi,%r14
mov    %rsp,%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x96,%edx
call   1040 <memset@plt>
mov    %rbx,%rdi
mov    $0x96,%esi
call   1050 <gethostname@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x96,%edx
call   1030 <strncpy@plt>
add    $0x98,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @__getmachinename(i8* %0) {
%2 = alloca i8*
%3 = alloca [150 x i8]
%4 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %4
%5 = getelementptr inbounds [150 x i8], [150 x i8]* %3, i64 0, i64 0
%6 = call i32 @memset(i8* %5, i32 0, i32 150)
%7 = getelementptr inbounds [150 x i8], [150 x i8]* %3, i64 0, i64 0
%8 = call i32 @gethostname(i8* %7, i32 150)
%9 = load i8*, i8** %2
%10 = getelementptr inbounds [150 x i8], [150 x i8]* %3, i64 0, i64 0
%11 = call i32 @strncpy(i8* %9, i8* %10, i32 150)
ret void
}

LLVM IR (-O2):
define void @__getmachinename(i8* %0) {
%2 = alloca [150 x i8]
%3 = getelementptr inbounds [150 x i8], [150 x i8]* %2, i64 0, i64 0
%4 = call i32 @memset(i8* %3, i32 0, i32 150)
%5 = call i32 @gethostname(i8* %3, i32 150)
%6 = call i32 @strncpy(i8* %0, i8* %3, i32 150)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void usage() {
  printf("\nusage: pfe (INTEGER X) (INTEGER Y) <=> X < Y && x > 1\n\n");
}


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

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

LLVM IR (-O0):
@.str = [57 x i8] c"\0Ausage: pfe (INTEGER X) (INTEGER Y) <=> X < Y && x > 1\0A\0A\00"
define void @usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [56 x i8] c"\0Ausage: pfe (INTEGER X) (INTEGER Y) <=> X < Y && x > 1\0A\00"
define void @usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([56 x i8], [56 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ _I8080_CPI();
void do0xFE() { _I8080_CPI(); }


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

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

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

LLVM IR (-O2):
define void @do0xFE() {
%1 = tail call i32 (...) @_I8080_CPI()
ret void
}
/* Type definitions */
typedef char uint32_t;

/* Variables and functions */
bool is_unicode_control(uint32_t ch) {
  return (ch < ' ' && ch != '\t' && ch != '\n') || (0x7F <= ch && ch <= 0x9F);
}


x86 assembly (clang, -O0):
<is_unicode_control>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
cmp    $0x20,%eax
jge    1136 <is_unicode_control+0x36>
movsbl -0x1(%rbp),%eax
cmp    $0x9,%eax
je     1136 <is_unicode_control+0x36>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0xa,%ecx
mov    %al,-0x2(%rbp)
jne    1161 <is_unicode_control+0x61>
movsbl -0x1(%rbp),%edx
xor    %eax,%eax
mov    $0x7f,%ecx
cmp    %edx,%ecx
mov    %al,-0x3(%rbp)
jg     115b <is_unicode_control+0x5b>
movsbl -0x1(%rbp),%eax
cmp    $0x9f,%eax
setle  %al
mov    %al,-0x3(%rbp)
mov    -0x3(%rbp),%al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_unicode_control>:
cmp    $0x20,%dil
setl   %al
lea    -0xb(%rdi),%ecx
cmp    $0xfe,%cl
setb   %cl
and    %al,%cl
cmp    $0x7f,%dil
sete   %al
or     %cl,%al
movzbl %al,%eax
ret

LLVM IR (-O0):
define i32 @is_unicode_control(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp slt i32 %4, 32
br i1 %5, label %6, label %14
6: ; preds = %1
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp ne i32 %8, 9
br i1 %9, label %10, label %14
10: ; preds = %6
%11 = load i8, i8* %2
%12 = sext i8 %11 to i32
%13 = icmp ne i32 %12, 10
br i1 %13, label %24, label %14
14: ; preds = %10, %6, %1
%15 = load i8, i8* %2
%16 = sext i8 %15 to i32
%17 = icmp sle i32 127, %16
br i1 %17, label %18, label %22
18: ; preds = %14
%19 = load i8, i8* %2
%20 = sext i8 %19 to i32
%21 = icmp sle i32 %20, 159
br label %22
22: ; preds = %18, %14
%23 = phi i1 [ false, %14 ], [ %21, %18 ]
br label %24
24: ; preds = %22, %10
%25 = phi i1 [ true, %10 ], [ %23, %22 ]
%26 = zext i1 %25 to i32
ret i32 %26
}

LLVM IR (-O2):
define i32 @is_unicode_control(i8 signext %0) {
%2 = icmp slt i8 %0, 32
%3 = add i8 %0, -11
%4 = icmp ult i8 %3, -2
%5 = and i1 %2, %4
%6 = icmp eq i8 %0, 127
%7 = or i1 %6, %5
%8 = zext i1 %7 to i32
ret i32 %8
}
int test_imm_CCuint64_midword_reg(unsigned long long val) {
  return ((val >> 16) & (0xCC << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_CCuint64_midword_reg(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = lshr i64 %3, 16
%5 = and i64 %4, 204
%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_CCuint64_midword_reg(i64 %0) {
%2 = and i64 %0, 13369344
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ strcpy(char *, char *);
char *tmp_name(void) {
  char name[30];
  static int sequence = 0;
  ++sequence;
  strcpy(name, "tmp");
  name[3] = sequence + '0';
  name[4] = '\0';
  return (name);
}


x86 assembly (clang, -O0):
<tmp_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0x2f0e(%rip),%eax
add    $0x1,%eax
mov    %eax,0x2f05(%rip)
lea    -0x20(%rbp),%rdi
lea    0xece(%rip),%rsi
call   1030 <strcpy@plt>
mov    0x2eef(%rip),%eax
add    $0x30,%eax
mov    %al,-0x1d(%rbp)
movb   $0x0,-0x1c(%rbp)
lea    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tmp_name>:
push   %rbx
sub    $0x20,%rsp
addl   $0x1,0x2f10(%rip)
lea    0xedd(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1030 <strcpy@plt>
mov    %rbx,%rax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@tmp_name.sequence = internal global i32 0
@.str = [4 x i8] c"tmp\00"
define i8* @tmp_name() {
%1 = alloca [30 x i8]
%2 = load i32, i32* @tmp_name.sequence
%3 = add nsw i32 %2, 1
store i32 %3, i32* @tmp_name.sequence
%4 = getelementptr inbounds [30 x i8], [30 x i8]* %1, i64 0, i64 0
%5 = call i32 @strcpy(i8* %4, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%6 = load i32, i32* @tmp_name.sequence
%7 = add nsw i32 %6, 48
%8 = trunc i32 %7 to i8
%9 = getelementptr inbounds [30 x i8], [30 x i8]* %1, i64 0, i64 3
store i8 %8, i8* %9
%10 = getelementptr inbounds [30 x i8], [30 x i8]* %1, i64 0, i64 4
store i8 0, i8* %10
%11 = getelementptr inbounds [30 x i8], [30 x i8]* %1, i64 0, i64 0
ret i8* %11
}

LLVM IR (-O2):
@tmp_name.sequence = internal unnamed_addr global i32 0
@.str = [4 x i8] c"tmp\00"
define i8* @tmp_name() {
%1 = alloca [30 x i8]
%2 = getelementptr inbounds [30 x i8], [30 x i8]* %1, i64 0, i64 0
%3 = load i32, i32* @tmp_name.sequence
%4 = add nsw i32 %3, 1
store i32 %4, i32* @tmp_name.sequence
%5 = call i32 @strcpy(i8* %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
ret i8* %2
}
int min_list_val(int *list) { return (list[0]); }


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

x86 assembly (clang, -O2):
<min_list_val>:
mov    (%rdi),%eax
ret

LLVM IR (-O0):
define i32 @min_list_val(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
ret i32 %5
}

LLVM IR (-O2):
define i32 @min_list_val(i32* nocapture %0) {
%2 = load i32, i32* %0
ret i32 %2
}