xunge/DecIR huggingface dataset:
int BTAC1C2_StereoBlockSizeFromSamples(int len) {
  return (8 + ((len + 1) / 2));
}


x86 assembly (clang, -O0):
<BTAC1C2_StereoBlockSizeFromSamples>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
add    $0x8,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<BTAC1C2_StereoBlockSizeFromSamples>:
mov    %edi,%eax
add    $0x1,%eax
shr    $0x1f,%eax
add    %edi,%eax
add    $0x1,%eax
sar    %eax
add    $0x8,%eax
ret

LLVM IR (-O0):
define i32 @BTAC1C2_StereoBlockSizeFromSamples(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = add nsw i32 %3, 1
%5 = sdiv i32 %4, 2
%6 = add nsw i32 8, %5
ret i32 %6
}

LLVM IR (-O2):
define i32 @BTAC1C2_StereoBlockSizeFromSamples(i32 %0) {
%2 = add nsw i32 %0, 1
%3 = sdiv i32 %2, 2
%4 = add nsw i32 %3, 8
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ remove(char *);
void cmt_test_cleanup(void) { remove("result_cmt"); }


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

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

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

LLVM IR (-O2):
@.str = [11 x i8] c"result_cmt\00"
define void @cmt_test_cleanup() {
%1 = tail call i32 @remove(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int exit(int no) {
  while (1) {
  }
  return 0;
}


x86 assembly (clang, -O0):
<exit>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
jmp    1107 <exit+0x7>

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

LLVM IR (-O0):
define i32 @exit(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
br label %3
3: ; preds = %1, %3
br label %3
}

LLVM IR (-O2):
define i32 @exit(i32 %0) {
br label %2
2: ; preds = %1, %2
br label %2
}
int test_00(int x, int y) { return x != y ? -1 : 0; }


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edx
mov    -0x8(%rbp),%esi
xor    %eax,%eax
mov    $0xffffffff,%ecx
cmp    %esi,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
xor    %eax,%eax
cmp    %esi,%edi
setne  %al
neg    %eax
ret

LLVM IR (-O0):
define i32 @test_00(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = icmp ne i32 %5, %6
%8 = zext i1 %7 to i64
%9 = select i1 %7, i32 -1, i32 0
ret i32 %9
}

LLVM IR (-O2):
define i32 @test_00(i32 %0, i32 %1) {
%3 = icmp ne i32 %0, %1
%4 = sext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
int ri_mem_free(void *ptr) {
  if (ptr == NULL) {
    return -1;
  }
  free(ptr);
  return 0;
}


x86 assembly (clang, -O0):
<ri_mem_free>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1133 <ri_mem_free+0x23>
movl   $0xffffffff,-0x4(%rbp)
jmp    1143 <ri_mem_free+0x33>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ri_mem_free>:
test   %rdi,%rdi
je     1122 <ri_mem_free+0x12>
push   %rax
call   1030 <free@plt>
xor    %eax,%eax
add    $0x8,%rsp
ret
mov    $0xffffffff,%eax
ret

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

LLVM IR (-O2):
define i32 @ri_mem_free(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @free(i8* %0)
br label %5
5: ; preds = %1, %3
%6 = phi i32 [ 0, %3 ], [ -1, %1 ]
ret i32 %6
}
/* Type definitions */
struct vec3 {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ assert(int /*<<< orphan*/);
int /*<<< orphan*/ xfree(struct vec3 *);
void vec3_destroy(struct vec3 *p) {
  assert(p != NULL);
  xfree(p);
}


x86 assembly (clang, -O0):
<vec3_destroy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x8(%rbp),%rdi
call   1030 <xfree@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vec3_destroy>:
push   %rbx
mov    %rdi,%rbx
xor    %edi,%edi
test   %rbx,%rbx
setne  %dil
call   1040 <assert@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <xfree@plt>

LLVM IR (-O0):
%struct.vec3 = type { i32 }
define void @vec3_destroy(%struct.vec3* %0) {
%2 = alloca %struct.vec3*
store %struct.vec3* %0, %struct.vec3** %2
%3 = load %struct.vec3*, %struct.vec3** %2
%4 = icmp ne %struct.vec3* %3, null
%5 = zext i1 %4 to i32
%6 = call i32 @assert(i32 %5)
%7 = load %struct.vec3*, %struct.vec3** %2
%8 = call i32 @xfree(%struct.vec3* %7)
ret void
}

LLVM IR (-O2):
%struct.vec3 = type { i32 }
define void @vec3_destroy(%struct.vec3* %0) {
%2 = icmp ne %struct.vec3* %0, null
%3 = zext i1 %2 to i32
%4 = tail call i32 @assert(i32 %3)
%5 = tail call i32 @xfree(%struct.vec3* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ setuid(int);
int someUserFunction();
int system(int);
main() {
  int i = someUserFunction();
  if (i == 0) {
    setuid(2);
    i = system(20);
  } else if (i == 1) {
    system(40);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <someUserFunction@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    116f <main+0x3f>
mov    $0x2,%edi
call   1050 <setuid@plt>
mov    $0x14,%edi
call   1030 <system@plt>
mov    %eax,-0x8(%rbp)
jmp    1188 <main+0x58>
cmpl   $0x1,-0x8(%rbp)
jne    1183 <main+0x53>
mov    $0x28,%edi
call   1030 <system@plt>
jmp    1188 <main+0x58>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <someUserFunction@plt>
cmp    $0x1,%eax
je     1152 <main+0x22>
test   %eax,%eax
jne    115c <main+0x2c>
mov    $0x2,%edi
call   1050 <setuid@plt>
mov    $0x14,%edi
jmp    1157 <main+0x27>
mov    $0x28,%edi
call   1030 <system@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 (...) @someUserFunction()
store i32 %3, i32* %2
%4 = load i32, i32* %2
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %0
%7 = call i32 @setuid(i32 2)
%8 = call i32 @system(i32 20)
store i32 %8, i32* %2
br label %15
9: ; preds = %0
%10 = load i32, i32* %2
%11 = icmp eq i32 %10, 1
br i1 %11, label %12, label %14
12: ; preds = %9
%13 = call i32 @system(i32 40)
br label %14
14: ; preds = %12, %9
br label %15
15: ; preds = %14, %6
%16 = load i32, i32* %1
ret i32 %16
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @someUserFunction()
switch i32 %1, label %7 [
i32 0, label %2
i32 1, label %4
]
2: ; preds = %0
%3 = tail call i32 @setuid(i32 2)
br label %4
4: ; preds = %0, %2
%5 = phi i32 [ 20, %2 ], [ 40, %0 ]
%6 = tail call i32 @system(i32 %5)
br label %7
7: ; preds = %4, %0
ret i32 0
}
/* Type definitions */
struct TreeNode {
  int dummy;
};

/* Variables and functions */
struct TreeNode **generate(int, int, int *);
struct TreeNode **generateTrees(int n, int *returnSize) {
  *returnSize = 0;
  if (!n)
    return NULL;
  return generate(1, n, returnSize);
}


x86 assembly (clang, -O0):
<generateTrees>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0xc(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movl   $0x0,(%rax)
cmpl   $0x0,-0xc(%rbp)
jne    1140 <generateTrees+0x30>
movq   $0x0,-0x8(%rbp)
jmp    1155 <generateTrees+0x45>
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
mov    $0x1,%edi
call   1030 <generate@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<generateTrees>:
mov    %rsi,%rdx
movl   $0x0,(%rsi)
test   %edi,%edi
je     1129 <generateTrees+0x19>
mov    %edi,%esi
mov    $0x1,%edi
jmp    1030 <generate@plt>
xor    %eax,%eax
ret

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

LLVM IR (-O2):
%struct.TreeNode = type { i32 }
define %struct.TreeNode** @generateTrees(i32 %0, i32* %1) {
store i32 0, i32* %1
%3 = icmp eq i32 %0, 0
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call %struct.TreeNode** @generate(i32 1, i32 %0, i32* %1)
br label %6
6: ; preds = %2, %4
%7 = phi %struct.TreeNode** [ %5, %4 ], [ null, %2 ]
ret %struct.TreeNode** %7
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void myproc(int a, int b) { printf("%d", a + b); }


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

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

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define void @myproc(i32 %0, i32 %1) {
%3 = add nsw i32 %1, %0
%4 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %3)
ret void
}
void outw(unsigned short port, unsigned short value) {
  __asm__ __volatile__("outw %w0,%w1" : : "a"(value), "Nd"(port));
}


x86 assembly (clang, -O0):
<outw>:
push   %rbp
mov    %rsp,%rbp
mov    %si,%ax
mov    %di,%cx
mov    %cx,-0x2(%rbp)
mov    %ax,-0x4(%rbp)
mov    -0x4(%rbp),%ax
mov    -0x2(%rbp),%dx
out    %ax,(%dx)
pop    %rbp
ret

x86 assembly (clang, -O2):
<outw>:
mov    %esi,%eax
mov    %edi,%edx
out    %ax,(%dx)
ret

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

LLVM IR (-O2):
define void @outw(i16 zeroext %0, i16 zeroext %1) {
tail call void asm sideeffect "outw ${0:w},${1:w}", "{ax},N{dx},~{dirflag},~{fpsr},~{flags}"(i16 %1, i16 %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ strlen(char const *);
int /*<<< orphan*/ write(int, char const *, int /*<<< orphan*/);
void send_string(int fd, const char *s) { write(fd, s, strlen(s)); }


x86 assembly (clang, -O0):
<send_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x1c(%rbp),%edi
mov    -0x18(%rbp),%rsi
mov    %eax,%edx
call   1030 <write@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<send_string>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
mov    %rsi,%rdi
call   1040 <strlen@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %eax,%edx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <write@plt>

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

LLVM IR (-O2):
define void @send_string(i32 %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %1)
%4 = tail call i32 @write(i32 %0, i8* %1, i32 %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ imprimeVetor(int *, int);
int /*<<< orphan*/ selecao(int *, int);
int main() {
  int v[5] = {8, 4, 6, 9, 1};
  selecao(v, 5);
  imprimeVetor(v, 5);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0xed1(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xece(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xecc(%rip),%eax
mov    %eax,-0x10(%rbp)
lea    -0x20(%rbp),%rdi
mov    $0x5,%esi
call   1030 <selecao@plt>
lea    -0x20(%rbp),%rdi
mov    $0x5,%esi
call   1040 <imprimeVetor@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
mov    0xee5(%rip),%eax
mov    %eax,0x10(%rsp)
movaps 0xeca(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x5,%esi
call   1030 <selecao@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
call   1040 <imprimeVetor@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@__const.main.v = [5 x i32] [i32 8, i32 4, i32 6, i32 9, i32 1]
define i32 @main() {
%1 = alloca [5 x i32]
%2 = bitcast [5 x i32]* %1 to i8*
%3 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 0
%4 = call i32 @selecao(i32* %3, i32 5)
%5 = call i32 @imprimeVetor(i32* %3, i32 5)
ret i32 0
}
int Cyc_BansheeIf_add_constraint(unsigned a, void *b) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @Cyc_BansheeIf_add_constraint(i32 %0, i8* nocapture readnone %1) {
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef scalar_t__ uint32_t;

/* Variables and functions */
uint8_t rdz_8(uint32_t addr) { return *((uint8_t *)addr); }


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

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

LLVM IR (-O0):
define i32 @rdz_8(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = inttoptr i64 %3 to i32*
%5 = load i32, i32* %4
ret i32 %5
}

LLVM IR (-O2):
define i32 @rdz_8(i64 %0) {
%2 = inttoptr i64 %0 to i32*
%3 = load i32, i32* %2
ret i32 %3
}
/* Variables and functions */
bool Boolean_0_toBoolean_2_Double(double value) { return value != 0.0; }


x86 assembly (clang, -O0):
<Boolean_0_toBoolean_2_Double>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
setne  %al
setp   %cl
or     %cl,%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Boolean_0_toBoolean_2_Double>:
xorpd  %xmm1,%xmm1
cmpneqsd %xmm0,%xmm1
movq   %xmm1,%rax
and    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @Boolean_0_toBoolean_2_Double(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fcmp une double %3, 0.000000e+00
%5 = zext i1 %4 to i32
ret i32 %5
}

LLVM IR (-O2):
define i32 @Boolean_0_toBoolean_2_Double(double %0) {
%2 = fcmp une double %0, 0.000000e+00
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isalpha(int);
void t_isalpha_0xa4() {
  Assert_real((isalpha(164) == 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_isalpha.c",
              825, ("isalpha should be 0 for 0xa4"));
}


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

x86 assembly (clang, -O2):
<t_isalpha_0xa4>:
push   %rax
mov    $0xa4,%edi
call   1030 <isalpha@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x339,%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_isalpha.c\00"
@.str.1 = [29 x i8] c"isalpha should be 0 for 0xa4\00"
define void @t_isalpha_0xa4() {
%1 = call i64 @isalpha(i32 164)
%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 825, i8* getelementptr inbounds ([29 x i8], [29 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_isalpha.c\00"
@.str.1 = [29 x i8] c"isalpha should be 0 for 0xa4\00"
define void @t_isalpha_0xa4() {
%1 = tail call i64 @isalpha(i32 164)
%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 825, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ sscanf(char *, char *, int *);
int t1(void) {
  int n = -1;
  sscanf("abc  ", "abc %n", &n);
  printf("t1: count=%d\n", n);
  return n != 5;
}


x86 assembly (clang, -O0):
<t1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0xffffffff,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    0xec9(%rip),%rsi
lea    -0x4(%rbp),%rdx
call   1040 <sscanf@plt>
mov    -0x4(%rbp),%esi
lea    0xebd(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x5,-0x4(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<t1>:
push   %rax
movl   $0xffffffff,0x4(%rsp)
ff
lea    0xed0(%rip),%rdi
lea    0xecf(%rip),%rsi
lea    0x4(%rsp),%rdx
call   1040 <sscanf@plt>
mov    0x4(%rsp),%esi
lea    0xec1(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
cmpl   $0x5,0x4(%rsp)
setne  %al
pop    %rcx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"abc \00"
@.str.1 = [7 x i8] c"abc %n\00"
@.str.2 = [14 x i8] c"t1: count=%d\0A\00"
define i32 @t1() {
%1 = alloca i32
store i32 -1, i32* %1
%2 = call i32 @sscanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%3 = load i32, i32* %1
%4 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i32 %3)
%5 = load i32, i32* %1
%6 = icmp ne i32 %5, 5
%7 = zext i1 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
@.str = [6 x i8] c"abc \00"
@.str.1 = [7 x i8] c"abc %n\00"
@.str.2 = [14 x i8] c"t1: count=%d\0A\00"
define i32 @t1() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 -1, i32* %1
%3 = call i32 @sscanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i32 %4)
%6 = load i32, i32* %1
%7 = icmp ne i32 %6, 5
%8 = zext i1 %7 to i32
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ initgraph(int *, int *, char *);
int /*<<< orphan*/ set_window_size(int, int);
int /*<<< orphan*/ set_window_size_pixmap(int, int);
void initial_animation() {
  int gd, gm;
  set_window_size(500, 500);
  set_window_size_pixmap(500, 500);
  initgraph(&gd, &gm, "");
}


x86 assembly (clang, -O0):
<initial_animation>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x1f4,%esi
mov    %esi,%edi
call   1040 <set_window_size@plt>
mov    $0x1f4,%esi
mov    %esi,%edi
call   1050 <set_window_size_pixmap@plt>
lea    -0x4(%rbp),%rdi
lea    -0x8(%rbp),%rsi
lea    0xea1(%rip),%rdx
call   1030 <initgraph@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<initial_animation>:
push   %rax
mov    $0x1f4,%edi
mov    $0x1f4,%esi
call   1040 <set_window_size@plt>
mov    $0x1f4,%edi
mov    $0x1f4,%esi
call   1050 <set_window_size_pixmap@plt>
lea    0xeaa(%rip),%rdx
lea    0x4(%rsp),%rdi
mov    %rsp,%rsi
call   1030 <initgraph@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
define void @initial_animation() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 @set_window_size(i32 500, i32 500)
%4 = call i32 @set_window_size_pixmap(i32 500, i32 500)
%5 = call i32 @initgraph(i32* %1, i32* %2, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
define void @initial_animation() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 @set_window_size(i32 500, i32 500)
%6 = tail call i32 @set_window_size_pixmap(i32 500, i32 500)
%7 = call i32 @initgraph(i32* %1, i32* %2, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int listen(int, int);
int listen_socket(int socket, int backlog) { return listen(socket, backlog); }


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

x86 assembly (clang, -O2):
<listen_socket>:
jmp    1030 <listen@plt>

LLVM IR (-O0):
define i32 @listen_socket(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = call i32 @listen(i32 %5, i32 %6)
ret i32 %7
}

LLVM IR (-O2):
define i32 @listen_socket(i32 %0, i32 %1) {
%3 = tail call i32 @listen(i32 %0, i32 %1)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ usage();
int main(int argc, char *argv[]) {
  if (argc == 1) {
    usage();
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    1137 <main+0x27>
mov    $0x0,%al
call   1030 <usage@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
cmp    $0x1,%edi
jne    1121 <main+0x11>
push   %rax
xor    %eax,%eax
call   1030 <usage@plt>
add    $0x8,%rsp
xor    %eax,%eax
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 eq i32 %6, 1
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = call i32 (...) @usage()
br label %10
10: ; preds = %8, %2
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = icmp eq i32 %0, 1
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 (...) @usage()
br label %6
6: ; preds = %4, %2
ret i32 0
}
/* Variables and functions */
int RAND_MAX;
int rand_zero(int);
int range_rand(int low, int high) {
  if (high - low + 1 > RAND_MAX) {
    return -1;
  }
  return rand_zero(high - low) + low;
}


x86 assembly (clang, -O0):
<range_rand>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
sub    -0x8(%rbp),%eax
add    $0x1,%eax
mov    0x2eba(%rip),%rcx
cmp    (%rcx),%eax
jle    1142 <range_rand+0x32>
movl   $0xffffffff,-0x4(%rbp)
jmp    1153 <range_rand+0x43>
mov    -0xc(%rbp),%edi
sub    -0x8(%rbp),%edi
call   1030 <rand_zero@plt>
add    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<range_rand>:
push   %rbx
sub    %edi,%esi
mov    0x2ece(%rip),%rcx
mov    $0xffffffff,%eax
cmp    (%rcx),%esi
jge    112e <range_rand+0x1e>
mov    %edi,%ebx
mov    %esi,%edi
call   1030 <rand_zero@plt>
add    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@RAND_MAX = global i32 0
define i32 @range_rand(i32 %0, i32 %1) {
%3 = sub nsw i32 %1, %0
%4 = load i32, i32* @RAND_MAX
%5 = icmp slt i32 %3, %4
br i1 %5, label %6, label %9
6: ; preds = %2
%7 = tail call i32 @rand_zero(i32 %3)
%8 = add nsw i32 %7, %0
br label %9
9: ; preds = %2, %6
%10 = phi i32 [ %8, %6 ], [ -1, %2 ]
ret i32 %10
}
long int lrint(double x) { return x; }


x86 assembly (clang, -O0):
<lrint>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
cvttsd2si -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<lrint>:
cvttsd2si %xmm0,%rax
ret

LLVM IR (-O0):
define i64 @lrint(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fptosi double %3 to i64
ret i64 %4
}

LLVM IR (-O2):
define i64 @lrint(double %0) {
%2 = fptosi double %0 to i64
ret i64 %2
}
int hwnat_qos_default_rule(void) {}


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

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

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

LLVM IR (-O2):
define i32 @hwnat_qos_default_rule() {
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ endwin();
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ usage();
void bomb(int exitv, char *msg, int showusage) {
  endwin();
  printf("%s", msg);
  if (showusage == 1) {
    usage();
  }
  exit(exitv);
}


x86 assembly (clang, -O0):
<bomb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    $0x0,%al
call   1050 <endwin@plt>
mov    -0x10(%rbp),%rsi
lea    0xe9c(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x1,-0x14(%rbp)
jne    117a <bomb+0x3a>
mov    $0x0,%al
call   1040 <usage@plt>
mov    -0x4(%rbp),%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<bomb>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%ebp
mov    %rsi,%rbx
mov    %edi,%r14d
xor    %eax,%eax
call   1050 <endwin@plt>
lea    0xea6(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
cmp    $0x1,%ebp
jne    116e <bomb+0x2e>
xor    %eax,%eax
call   1040 <usage@plt>
mov    %r14d,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
define void @bomb(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 = call i32 (...) @endwin()
%8 = load i8*, i8** %5
%9 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %8)
%10 = load i32, i32* %6
%11 = icmp eq i32 %10, 1
br i1 %11, label %12, label %14
12: ; preds = %3
%13 = call i32 (...) @usage()
br label %14
14: ; preds = %12, %3
%15 = load i32, i32* %4
%16 = call i32 @exit(i32 %15)
unreachable
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define void @bomb(i32 %0, i8* %1, i32 %2) {
%4 = tail call i32 (...) @endwin()
%5 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %1)
%6 = icmp eq i32 %2, 1
br i1 %6, label %7, label %9
7: ; preds = %3
%8 = tail call i32 (...) @usage()
br label %9
9: ; preds = %7, %3
%10 = tail call i32 @exit(i32 %0)
unreachable
}
void swap_char(char s[], int pos1, int pos2) {
  char a;
  a = s[pos1];
  s[pos1] = s[pos2];
  s[pos2] = a;
}


x86 assembly (clang, -O0):
<swap_char>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0x11(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x11(%rbp),%dl
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
pop    %rbp
ret

x86 assembly (clang, -O2):
<swap_char>:
movslq %esi,%rax
mov    (%rdi,%rax,1),%sil
movslq %edx,%rdx
mov    (%rdi,%rdx,1),%cl
mov    %cl,(%rdi,%rax,1)
mov    %sil,(%rdi,%rdx,1)
ret

LLVM IR (-O0):
define void @swap_char(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i8*, i8** %4
%9 = load i32, i32* %5
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i8, i8* %8, i64 %10
%12 = load i8, i8* %11
store i8 %12, i8* %7
%13 = load i8*, i8** %4
%14 = load i32, i32* %6
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8, i8* %13, i64 %15
%17 = load i8, i8* %16
%18 = load i8*, i8** %4
%19 = load i32, i32* %5
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8, i8* %18, i64 %20
store i8 %17, i8* %21
%22 = load i8, i8* %7
%23 = load i8*, i8** %4
%24 = load i32, i32* %6
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i8, i8* %23, i64 %25
store i8 %22, i8* %26
ret void
}

LLVM IR (-O2):
define void @swap_char(i8* nocapture %0, i32 %1, i32 %2) {
%4 = sext i32 %1 to i64
%5 = getelementptr inbounds i8, i8* %0, i64 %4
%6 = load i8, i8* %5
%7 = sext i32 %2 to i64
%8 = getelementptr inbounds i8, i8* %0, i64 %7
%9 = load i8, i8* %8
store i8 %9, i8* %5
store i8 %6, i8* %8
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int /*<<< orphan*/
nrf_802154_pib_extended_address_set(int /*<<< orphan*/ const *);
void nrf_802154_extended_address_set(const uint8_t *p_extended_address) {
  nrf_802154_pib_extended_address_set(p_extended_address);
}


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

x86 assembly (clang, -O2):
<nrf_802154_extended_address_set>:
jmp    1030 <nrf_802154_pib_extended_address_set@plt>

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

LLVM IR (-O2):
define void @nrf_802154_extended_address_set(i32* %0) {
%2 = tail call i32 @nrf_802154_pib_extended_address_set(i32* %0)
ret void
}
int issjisleadbyte(unsigned char c) {
  return (c >= 0x81 && c <= 0x9F) || (c >= 0xE0 && c <= 0xFC);
}


x86 assembly (clang, -O0):
<issjisleadbyte>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
cmp    $0x81,%eax
jl     112e <issjisleadbyte+0x2e>
movzbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x9f,%ecx
mov    %al,-0x2(%rbp)
jle    1158 <issjisleadbyte+0x58>
movzbl -0x1(%rbp),%ecx
xor    %eax,%eax
cmp    $0xe0,%ecx
mov    %al,-0x3(%rbp)
jl     1152 <issjisleadbyte+0x52>
movzbl -0x1(%rbp),%eax
cmp    $0xfc,%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):
<issjisleadbyte>:
lea    0x7f(%rdi),%eax
cmp    $0x1f,%al
setb   %al
add    $0x20,%dil
cmp    $0x1d,%dil
setb   %cl
or     %al,%cl
movzbl %cl,%eax
ret

LLVM IR (-O0):
define i32 @issjisleadbyte(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = zext i8 %3 to i32
%5 = icmp sge i32 %4, 129
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i8, i8* %2
%8 = zext i8 %7 to i32
%9 = icmp sle i32 %8, 159
br i1 %9, label %20, label %10
10: ; preds = %6, %1
%11 = load i8, i8* %2
%12 = zext i8 %11 to i32
%13 = icmp sge i32 %12, 224
br i1 %13, label %14, label %18
14: ; preds = %10
%15 = load i8, i8* %2
%16 = zext i8 %15 to i32
%17 = icmp sle i32 %16, 252
br label %18
18: ; preds = %14, %10
%19 = phi i1 [ false, %10 ], [ %17, %14 ]
br label %20
20: ; preds = %18, %6
%21 = phi i1 [ true, %6 ], [ %19, %18 ]
%22 = zext i1 %21 to i32
ret i32 %22
}

LLVM IR (-O2):
define i32 @issjisleadbyte(i8 zeroext %0) {
%2 = add i8 %0, 127
%3 = icmp ult i8 %2, 31
%4 = add i8 %0, 32
%5 = icmp ult i8 %4, 29
%6 = or i1 %3, %5
%7 = zext i1 %6 to i32
ret i32 %7
}
/* Type definitions */
struct tftphdr {
  int dummy;
};

/* Variables and functions */
struct tftphdr *rw_init(int);
struct tftphdr *r_init() {
  return rw_init(1);
}


x86 assembly (clang, -O0):
<r_init>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
call   1030 <rw_init@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<r_init>:
mov    $0x1,%edi
jmp    1030 <rw_init@plt>

LLVM IR (-O0):
%struct.tftphdr = type { i32 }
define %struct.tftphdr* @r_init() {
%1 = call %struct.tftphdr* @rw_init(i32 1)
ret %struct.tftphdr* %1
}

LLVM IR (-O2):
%struct.tftphdr = type { i32 }
define %struct.tftphdr* @r_init() {
%1 = tail call %struct.tftphdr* @rw_init(i32 1)
ret %struct.tftphdr* %1
}
/* Type definitions */
typedef unsigned int uint;

/* Variables and functions */
void f(unsigned int width) { uint src_bytes = width >> 3; }


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x3,%eax
mov    %eax,-0x8(%rbp)
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @f(i32 %0) {
ret void
}
int vde_chain_nm4_work(int *sz_arg, int *sz_res, int *sz_iw, int *sz_w) {
  if (sz_arg)
    *sz_arg = 4;
  if (sz_res)
    *sz_res = 3;
  if (sz_iw)
    *sz_iw = 0;
  if (sz_w)
    *sz_w = 48;
  return 0;
}


x86 assembly (clang, -O0):
<vde_chain_nm4_work>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1129 <vde_chain_nm4_work+0x29>
mov    -0x8(%rbp),%rax
movl   $0x4,(%rax)
cmpq   $0x0,-0x10(%rbp)
je     113e <vde_chain_nm4_work+0x3e>
mov    -0x10(%rbp),%rax
movl   $0x3,(%rax)
cmpq   $0x0,-0x18(%rbp)
je     1153 <vde_chain_nm4_work+0x53>
mov    -0x18(%rbp),%rax
movl   $0x0,(%rax)
cmpq   $0x0,-0x20(%rbp)
je     1168 <vde_chain_nm4_work+0x68>
mov    -0x20(%rbp),%rax
movl   $0x30,(%rax)
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<vde_chain_nm4_work>:
test   %rdi,%rdi
je     110b <vde_chain_nm4_work+0xb>
movl   $0x4,(%rdi)
test   %rsi,%rsi
je     1116 <vde_chain_nm4_work+0x16>
movl   $0x3,(%rsi)
test   %rdx,%rdx
je     1121 <vde_chain_nm4_work+0x21>
movl   $0x0,(%rdx)
test   %rcx,%rcx
je     112c <vde_chain_nm4_work+0x2c>
movl   $0x30,(%rcx)
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @vde_chain_nm4_work(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** %5
%10 = icmp ne i32* %9, null
br i1 %10, label %11, label %13
11: ; preds = %4
%12 = load i32*, i32** %5
store i32 4, i32* %12
br label %13
13: ; preds = %11, %4
%14 = load i32*, i32** %6
%15 = icmp ne i32* %14, null
br i1 %15, label %16, label %18
16: ; preds = %13
%17 = load i32*, i32** %6
store i32 3, i32* %17
br label %18
18: ; preds = %16, %13
%19 = load i32*, i32** %7
%20 = icmp ne i32* %19, null
br i1 %20, label %21, label %23
21: ; preds = %18
%22 = load i32*, i32** %7
store i32 0, i32* %22
br label %23
23: ; preds = %21, %18
%24 = load i32*, i32** %8
%25 = icmp ne i32* %24, null
br i1 %25, label %26, label %28
26: ; preds = %23
%27 = load i32*, i32** %8
store i32 48, i32* %27
br label %28
28: ; preds = %26, %23
ret i32 0
}

LLVM IR (-O2):
define i32 @vde_chain_nm4_work(i32* writeonly %0, i32* writeonly %1, i32* writeonly %2, i32* writeonly %3) {
%5 = icmp eq i32* %0, null
br i1 %5, label %7, label %6
6: ; preds = %4
store i32 4, i32* %0
br label %7
7: ; preds = %6, %4
%8 = icmp eq i32* %1, null
br i1 %8, label %10, label %9
9: ; preds = %7
store i32 3, i32* %1
br label %10
10: ; preds = %9, %7
%11 = icmp eq i32* %2, null
br i1 %11, label %13, label %12
12: ; preds = %10
store i32 0, i32* %2
br label %13
13: ; preds = %12, %10
%14 = icmp eq i32* %3, null
br i1 %14, label %16, label %15
15: ; preds = %13
store i32 48, i32* %3
br label %16
16: ; preds = %15, %13
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ print_foobar();
int main(int argc, char *argv[]) {
  print_foobar();
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <print_foobar@plt>
xor    %eax,%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 = call i32 (...) @print_foobar()
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @print_foobar()
ret i32 0
}
int not(int a) {
  if (a) {
    return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<not>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     111d <not+0x1d>
movl   $0x0,-0x4(%rbp)
jmp    1124 <not+0x24>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @not(i32 %0) {
%2 = icmp eq i32 %0, 0
%3 = zext i1 %2 to i32
ret i32 %3
}
void swap(int *a, int *b) {
  int temp;
  temp = *a;
  *a = *b;
  *b = temp;
  return;
}


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

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

LLVM IR (-O0):
define void @swap(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i32
store i32* %0, i32** %3
store i32* %1, i32** %4
%6 = load i32*, i32** %3
%7 = load i32, i32* %6
store i32 %7, i32* %5
%8 = load i32*, i32** %4
%9 = load i32, i32* %8
%10 = load i32*, i32** %3
store i32 %9, i32* %10
%11 = load i32, i32* %5
%12 = load i32*, i32** %4
store i32 %11, i32* %12
ret void
}

LLVM IR (-O2):
define void @swap(i32* nocapture %0, i32* nocapture %1) {
%3 = load i32, i32* %0
%4 = load i32, i32* %1
store i32 %4, i32* %0
store i32 %3, i32* %1
ret void
}
double mp_dmin1(double a, double b) {
  if (a <= b)
    return (a);
  else
    return (b);
}


x86 assembly (clang, -O0):
<mp_dmin1>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     1131 <mp_dmin1+0x31>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    113b <mp_dmin1+0x3b>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<mp_dmin1>:
movapd %xmm0,%xmm2
cmplesd %xmm1,%xmm2
andpd  %xmm2,%xmm0
andnpd %xmm1,%xmm2
orpd   %xmm2,%xmm0
ret

LLVM IR (-O0):
define double @mp_dmin1(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
store double %0, double* %4
store double %1, double* %5
%6 = load double, double* %4
%7 = load double, double* %5
%8 = fcmp ole double %6, %7
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = load double, double* %4
store double %10, double* %3
br label %13
11: ; preds = %2
%12 = load double, double* %5
store double %12, double* %3
br label %13
13: ; preds = %11, %9
%14 = load double, double* %3
ret double %14
}

LLVM IR (-O2):
define double @mp_dmin1(double %0, double %1) {
%3 = fcmp ole double %0, %1
%4 = select i1 %3, double %0, double %1
ret double %4
}
void fistp_m64abs(unsigned long long *m64) {
  if ((long)m64 & 0xFFFFFFFF80000000LL) {
    printf("Error: destination %lx not in lower 2GB for fistp_m64abs()\n",
           (long)m64);
    asm(" int $3; ");
  }
  put8(0xDF);
  put8(0x3C);
  put8(0x25);
  put32((int)(unsigned long)m64);
}


x86 assembly (clang, -O0):
<fistp_m64abs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
and    $0xffffffff80000000,%rax
cmp    $0x0,%rax
je     1163 <fistp_m64abs+0x33>
mov    -0x8(%rbp),%rsi
lea    0xea5(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
int3
mov    $0xdf,%edi
mov    $0x0,%al
call   1030 <put8@plt>
mov    $0x3c,%edi
mov    $0x0,%al
call   1030 <put8@plt>
mov    $0x25,%edi
mov    $0x0,%al
call   1030 <put8@plt>
mov    -0x8(%rbp),%rax
mov    %eax,%edi
mov    $0x0,%al
call   1050 <put32@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fistp_m64abs>:
push   %rbx
mov    %rdi,%rbx
test   $0xffffffff80000000,%rdi
je     114f <fistp_m64abs+0x1f>
lea    0xebc(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
int3
mov    $0xdf,%edi
xor    %eax,%eax
call   1030 <put8@plt>
mov    $0x3c,%edi
xor    %eax,%eax
call   1030 <put8@plt>
mov    $0x25,%edi
xor    %eax,%eax
call   1030 <put8@plt>
mov    %ebx,%edi
xor    %eax,%eax
pop    %rbx
jmp    1050 <put32@plt>

LLVM IR (-O0):
@.str = [60 x i8] c"Error: destination %lx not in lower 2GB for fistp_m64abs()\0A\00"
define void @fistp_m64abs(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = ptrtoint i64* %3 to i64
%5 = and i64 %4, -2147483648
%6 = icmp ne i64 %5, 0
br i1 %6, label %7, label %11
7: ; preds = %1
%8 = load i64*, i64** %2
%9 = ptrtoint i64* %8 to i64
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str, i64 0, i64 0), i64 %9)
br label %11
11: ; preds = %7, %1
%12 = call i32 (i32, ...) bitcast (i32 (...)* @put8 to i32 (i32, ...)*)(i32 223)
%13 = call i32 (i32, ...) bitcast (i32 (...)* @put8 to i32 (i32, ...)*)(i32 60)
%14 = call i32 (i32, ...) bitcast (i32 (...)* @put8 to i32 (i32, ...)*)(i32 37)
%15 = load i64*, i64** %2
%16 = ptrtoint i64* %15 to i64
%17 = trunc i64 %16 to i32
%18 = call i32 (i32, ...) bitcast (i32 (...)* @put32 to i32 (i32, ...)*)(i32 %17)
ret void
}

LLVM IR (-O2):
@.str = [60 x i8] c"Error: destination %lx not in lower 2GB for fistp_m64abs()\0A\00"
define void @fistp_m64abs(i64* %0) {
%2 = ptrtoint i64* %0 to i64
%3 = icmp ult i64* %0, inttoptr (i64 2147483648 to i64*)
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @.str, i64 0, i64 0), i64 %2)
tail call void asm sideeffect " int $$3; ", "~{dirflag},~{fpsr},~{flags}"()
br label %6
6: ; preds = %4, %1
%7 = tail call i32 (i32, ...) bitcast (i32 (...)* @put8 to i32 (i32, ...)*)(i32 223)
%8 = tail call i32 (i32, ...) bitcast (i32 (...)* @put8 to i32 (i32, ...)*)(i32 60)
%9 = tail call i32 (i32, ...) bitcast (i32 (...)* @put8 to i32 (i32, ...)*)(i32 37)
%10 = trunc i64 %2 to i32
%11 = tail call i32 (i32, ...) bitcast (i32 (...)* @put32 to i32 (i32, ...)*)(i32 %10)
ret void
}
/* Variables and functions */
void fixterm() {}


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

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

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

LLVM IR (-O2):
define void @fixterm() {
ret void
}
long reverseOffset(long offset, long arraySize) {
  return arraySize - 1 - offset;
}


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

x86 assembly (clang, -O2):
<reverseOffset>:
not    %rdi
lea    (%rdi,%rsi,1),%rax
ret

LLVM IR (-O0):
define i64 @reverseOffset(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %4
%6 = sub nsw i64 %5, 1
%7 = load i64, i64* %3
%8 = sub nsw i64 %6, %7
ret i64 %8
}

LLVM IR (-O2):
define i64 @reverseOffset(i64 %0, i64 %1) {
%3 = xor i64 %0, -1
%4 = add i64 %3, %1
ret i64 %4
}
/* Variables and functions */
int /*<<< orphan*/ init();
int /*<<< orphan*/ lee(int /*<<< orphan*/, int /*<<< orphan*/, int, int);
int main() {
  init();
  lee(0, 0, 3, 3);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <init@plt>
xor    %esi,%esi
mov    $0x3,%ecx
mov    %esi,%edi
mov    %ecx,%edx
call   1030 <lee@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <init@plt>
xor    %edi,%edi
xor    %esi,%esi
mov    $0x3,%edx
mov    $0x3,%ecx
call   1030 <lee@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 (...) @init()
%2 = call i32 @lee(i32 0, i32 0, i32 3, i32 3)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @init()
%2 = tail call i32 @lee(i32 0, i32 0, i32 3, i32 3)
ret i32 0
}
void setCounter(int counterId) {}


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

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

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

LLVM IR (-O2):
define void @setCounter(i32 %0) {
ret void
}
void foo304(int p) {}


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

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

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

LLVM IR (-O2):
define void @foo304(i32 %0) {
ret void
}
int HelpItem74(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @HelpItem74() {
ret i32 0
}