xunge/DecIR huggingface dataset:
int freeLock(int lockNumber) {
  int *lockPos = lockNumber ? (int *)5242888 : (int *)5242892;
  (*lockPos) = 0;
}


x86 assembly (clang, -O0):
<freeLock>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edx
mov    $0x50000c,%eax
mov    $0x500008,%ecx
cmp    $0x0,%edx
cmovne %rcx,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<freeLock>:
xor    %eax,%eax
test   %edi,%edi
sete   %al
movl   $0x0,0x500008(,%rax,4)
ret

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

LLVM IR (-O2):
define i32 @freeLock(i32 %0) {
%2 = icmp eq i32 %0, 0
%3 = select i1 %2, i32* inttoptr (i64 5242892 to i32*), i32* inttoptr (i64 5242888 to i32*)
store i32 0, i32* %3
ret i32 undef
}
/* Variables and functions */
scalar_t__ lex_ok();
long parse_expression();
int /*<<< orphan*/ printf(char *, long);
int /*<<< orphan*/ syntax_error(char *);
int main() {
  long value = parse_expression();
  if (lex_ok()) {
    syntax_error("expected end of input");
  }
  printf("%ld\n", value);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1060 <parse_expression@plt>
mov    %rax,-0x10(%rbp)
mov    $0x0,%al
call   1040 <lex_ok@plt>
cmp    $0x0,%rax
je     1177 <main+0x37>
lea    0xe8e(%rip),%rdi
call   1050 <syntax_error@plt>
mov    -0x10(%rbp),%rsi
lea    0xe94(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1060 <parse_expression@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1040 <lex_ok@plt>
test   %rax,%rax
je     1163 <main+0x23>
lea    0xea2(%rip),%rdi
call   1050 <syntax_error@plt>
lea    0xeac(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [22 x i8] c"expected end of input\00"
@.str.1 = [5 x i8] c"%ld\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
store i32 0, i32* %1
%3 = call i64 (...) @parse_expression()
store i64 %3, i64* %2
%4 = call i64 (...) @lex_ok()
%5 = icmp ne i64 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = call i32 @syntax_error(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %0
%9 = load i64, i64* %2
%10 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i64 %9)
%11 = load i32, i32* %1
ret i32 %11
}

LLVM IR (-O2):
@.str = [22 x i8] c"expected end of input\00"
@.str.1 = [5 x i8] c"%ld\0A\00"
define i32 @main() {
%1 = tail call i64 (...) @parse_expression()
%2 = tail call i64 (...) @lex_ok()
%3 = icmp eq i64 %2, 0
br i1 %3, label %6, label %4
4: ; preds = %0
%5 = tail call i32 @syntax_error(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %4, %0
%7 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i64 %1)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ EVP_MD_CTX;

/* Variables and functions */
int /*<<< orphan*/ EVP_MD_CTX_md_data(int /*<<< orphan*/ *);
int SHA512_Final(unsigned char *, int /*<<< orphan*/);
int final512(EVP_MD_CTX *ctx, unsigned char *md) {
  return SHA512_Final(md, EVP_MD_CTX_md_data(ctx));
}


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

x86 assembly (clang, -O2):
<final512>:
push   %rbx
mov    %rsi,%rbx
call   1030 <EVP_MD_CTX_md_data@plt>
mov    %rbx,%rdi
mov    %eax,%esi
pop    %rbx
jmp    1040 <SHA512_Final@plt>

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

LLVM IR (-O2):
define i32 @final512(i32* %0, i8* %1) {
%3 = tail call i32 @EVP_MD_CTX_md_data(i32* %0)
%4 = tail call i32 @SHA512_Final(i8* %1, i32 %3)
ret i32 %4
}
/* Variables and functions */
int fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ stdout;
int c_left() { return fputs("[D", stdout); }


x86 assembly (clang, -O0):
<c_left>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%esi
lea    0xedc(%rip),%rdi
call   1030 <fputs@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<c_left>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%esi
lea    0xee0(%rip),%rdi
jmp    1030 <fputs@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"\1B[D\00"
@stdout = global i32 0
define i32 @c_left() {
%1 = load i32, i32* @stdout
%2 = call i32 @fputs(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 %2
}

LLVM IR (-O2):
@.str = [4 x i8] c"\1B[D\00"
@stdout = global i32 0
define i32 @c_left() {
%1 = load i32, i32* @stdout
%2 = tail call i32 @fputs(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ retrieve_and_write(int, int);
int /*<<< orphan*/ scanf(char *, int *);
void test_solution_retrieval(int n) {
  int k;
  printf("Give index to a solution : ");
  scanf("%d", &k);
  retrieve_and_write(n, k);
}


x86 assembly (clang, -O0):
<test_solution_retrieval>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xebe(%rip),%rdi
call   1030 <printf@plt>
lea    0xece(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1040 <retrieve_and_write@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_solution_retrieval>:
push   %rbx
sub    $0x10,%rsp
mov    %edi,%ebx
lea    0xec2(%rip),%rdi
call   1030 <printf@plt>
lea    0xed2(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%esi
mov    %ebx,%edi
call   1040 <retrieve_and_write@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [28 x i8] c"Give index to a solution : \00"
@.str.1 = [3 x i8] c"%d\00"
define void @test_solution_retrieval(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%6 = load i32, i32* %2
%7 = load i32, i32* %3
%8 = call i32 @retrieve_and_write(i32 %6, i32 %7)
ret void
}

LLVM IR (-O2):
@.str = [28 x i8] c"Give index to a solution : \00"
@.str.1 = [3 x i8] c"%d\00"
define void @test_solution_retrieval(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%6 = load i32, i32* %2
%7 = call i32 @retrieve_and_write(i32 %0, i32 %6)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void print_int(int result[], int m) {
  for (m--; m >= 0; m--)
    printf("%d", result[m]);
}


x86 assembly (clang, -O0):
<print_int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jl     1157 <print_int+0x47>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xebc(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    1128 <print_int+0x18>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_int>:
push   %r15
push   %r14
push   %rbx
test   %esi,%esi
jle    1149 <print_int+0x39>
mov    %rdi,%r15
mov    %esi,%ebx
add    $0x1,%rbx
lea    0xed7(%rip),%r14
nopl   0x0(%rax)
lea    -0x2(%rbx),%eax
mov    (%r15,%rax,4),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
add    $0xffffffffffffffff,%rbx
cmp    $0x1,%rbx
ja     1130 <print_int+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define void @print_int(i32* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %14
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ %5, %4 ], [ %8, %6 ]
%8 = add nsw i64 %7, -1
%9 = and i64 %8, 4294967295
%10 = getelementptr inbounds i32, i32* %0, i64 %9
%11 = load i32, i32* %10
%12 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = icmp ugt i64 %7, 1
br i1 %13, label %6, label %14
14: ; preds = %6, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int, int);
int /*<<< orphan*/ stderr;
extern void mocks_verboseAssertIntEquals(int expected, int actual) {
  if (expected != actual) {
    fprintf(stderr, "\n*** MOCKS: expected %d got %d!!! ***\n", expected,
            actual);
  }
}


x86 assembly (clang, -O0):
<mocks_verboseAssertIntEquals>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
je     1145 <mocks_verboseAssertIntEquals+0x35>
mov    0x2eaf(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%edx
mov    -0x8(%rbp),%ecx
lea    0xec0(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mocks_verboseAssertIntEquals>:
cmp    %esi,%edi
jne    1115 <mocks_verboseAssertIntEquals+0x5>
ret
mov    %esi,%ecx
mov    %edi,%edx
mov    0x2ec0(%rip),%rax
mov    (%rax),%edi
lea    0xed7(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [39 x i8] c"\0A*** MOCKS: expected %d got %d!!! ***\0A\00"
define void @mocks_verboseAssertIntEquals(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
br i1 %7, label %8, label %13
8: ; preds = %2
%9 = load i32, i32* @stderr
%10 = load i32, i32* %3
%11 = load i32, i32* %4
%12 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i32 %10, i32 %11)
br label %13
13: ; preds = %8, %2
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [39 x i8] c"\0A*** MOCKS: expected %d got %d!!! ***\0A\00"
define void @mocks_verboseAssertIntEquals(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, %1
br i1 %3, label %7, label %4
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %1)
br label %7
7: ; preds = %4, %2
ret void
}
int negate(int number) {
  number = -number;
  return number;
}


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

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

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

LLVM IR (-O2):
define i32 @negate(i32 %0) {
%2 = sub nsw i32 0, %0
ret i32 %2
}
/* Variables and functions */
scalar_t__ RAND_MAX;
scalar_t__ random();
double drandom(void) { return ((double)random()) / ((double)RAND_MAX + 1.0); }


x86 assembly (clang, -O0):
<drandom>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <random@plt>
cvtsi2sd %rax,%xmm0
mov    0x2ec1(%rip),%rax
cvtsi2sdq (%rax),%xmm1
movsd  0xecc(%rip),%xmm2
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<drandom>:
push   %rax
xor    %eax,%eax
call   1030 <random@plt>
cvtsi2sd %rax,%xmm0
mov    0x2ec4(%rip),%rax
cvtsi2sdq (%rax),%xmm1
addsd  0xecf(%rip),%xmm1
divsd  %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
@RAND_MAX = global i64 0
define double @drandom() {
%1 = call i64 (...) @random()
%2 = sitofp i64 %1 to double
%3 = load i64, i64* @RAND_MAX
%4 = sitofp i64 %3 to double
%5 = fadd double %4, 1.000000e+00
%6 = fdiv double %2, %5
ret double %6
}

LLVM IR (-O2):
@RAND_MAX = global i64 0
define double @drandom() {
%1 = tail call i64 (...) @random()
%2 = sitofp i64 %1 to double
%3 = load i64, i64* @RAND_MAX
%4 = sitofp i64 %3 to double
%5 = fadd double %4, 1.000000e+00
%6 = fdiv double %2, %5
ret double %6
}
/* Variables and functions */
int /*<<< orphan*/ debug(char *, ...);
int M11_f(char *s) {
  debug("M11_f(const char *s) is not yet implemented!\n");
  debug("%s\n", s);
  return 1;
}


x86 assembly (clang, -O0):
<M11_f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xedd(%rip),%rdi
mov    $0x0,%al
call   1030 <debug@plt>
mov    -0x8(%rbp),%rsi
lea    0xef9(%rip),%rdi
mov    $0x0,%al
call   1030 <debug@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<M11_f>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rdi
xor    %eax,%eax
call   1030 <debug@plt>
lea    0xf05(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <debug@plt>
mov    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [46 x i8] c"M11_f(const char *s) is not yet implemented!\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @M11_f(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
%4 = load i8*, i8** %2
%5 = call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %4)
ret i32 1
}

LLVM IR (-O2):
@.str = [46 x i8] c"M11_f(const char *s) is not yet implemented!\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @M11_f(i8* %0) {
%2 = tail call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %0)
ret i32 1
}
void displayYUV_setSize(int width, int height) {}


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

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

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

LLVM IR (-O2):
define void @displayYUV_setSize(i32 %0, i32 %1) {
ret void
}
void RTReqQueueIsBusy(void) {}


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

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

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

LLVM IR (-O2):
define void @RTReqQueueIsBusy() {
ret void
}
float eq_float(float a, float b) { return a == b; }


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

x86 assembly (clang, -O2):
<eq_float>:
cmpeqss %xmm1,%xmm0
movss  0xef3(%rip),%xmm1
andps  %xmm1,%xmm0
ret

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

LLVM IR (-O2):
define float @eq_float(float %0, float %1) {
%3 = fcmp oeq float %0, %1
%4 = uitofp i1 %3 to float
ret float %4
}
int test_imm_00uint64_lowword_mem(unsigned long long *val) {
  return ((*val) & (0x00 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
mov    $0xffffffd8,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_00uint64_lowword_mem(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64, i64* %3
%5 = and i64 %4, 0
%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_00uint64_lowword_mem(i64* nocapture readnone %0) {
ret i32 -40
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void INThandler(int sig) {
  printf("ERROR: please use /quit or /exit or /part to quit");
}


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

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

LLVM IR (-O0):
@.str = [50 x i8] c"ERROR: please use /quit or /exit or /part to quit\00"
define void @INThandler(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [50 x i8] c"ERROR: please use /quit or /exit or /part to quit\00"
define void @INThandler(i32 %0) {
%2 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_mutex_t;

/* Variables and functions */
int pthread_mutex_destroy(pthread_mutex_t *__mutex) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @pthread_mutex_destroy(i32* nocapture readnone %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ snprintf(char *, int, char *, char *);
int /*<<< orphan*/ system(char *);
void start_irssi(char nickname[]) {
  char chaine[100] = {0};
  snprintf(chaine, 100, "su --command='screen -dmS irc_logger irssi' %s\n",
           nickname);
  printf("%s", chaine);
  system(chaine);
}


x86 assembly (clang, -O0):
<start_irssi>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x70(%rbp),%rdi
xor    %esi,%esi
mov    $0x64,%edx
call   1060 <memset@plt>
lea    -0x70(%rbp),%rdi
mov    -0x8(%rbp),%rcx
mov    $0x64,%esi
lea    0xe90(%rip),%rdx
call   1050 <snprintf@plt>
lea    -0x70(%rbp),%rsi
lea    0xeb0(%rip),%rdi
call   1040 <printf@plt>
lea    -0x70(%rbp),%rdi
call   1030 <system@plt>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<start_irssi>:
push   %rbx
sub    $0x70,%rsp
mov    %rdi,%rcx
xorps  %xmm0,%xmm0
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
movl   $0x0,0x60(%rsp)
lea    0xe99(%rip),%rdx
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x64,%esi
call   1050 <snprintf@plt>
lea    0xeb2(%rip),%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1030 <system@plt>
add    $0x70,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [48 x i8] c"su --command='screen -dmS irc_logger irssi' %s\0A\00"
@.str.1 = [3 x i8] c"%s\00"
define void @start_irssi(i8* %0) {
%2 = alloca i8*
%3 = alloca [100 x i8]
store i8* %0, i8** %2
%4 = bitcast [100 x i8]* %3 to i8*
%5 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%6 = load i8*, i8** %2
%7 = call i32 @snprintf(i8* %5, i32 100, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%9 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %8)
%10 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%11 = call i32 @system(i8* %10)
ret void
}

LLVM IR (-O2):
@.str = [48 x i8] c"su --command='screen -dmS irc_logger irssi' %s\0A\00"
@.str.1 = [3 x i8] c"%s\00"
define void @start_irssi(i8* %0) {
%2 = alloca [100 x i8]
%3 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%4 = call i32 @snprintf(i8* %3, i32 100, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0), i8* %0)
%5 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %3)
%6 = call i32 @system(i8* %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ close(int);
void closeClient(int socket) { close(socket); }


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

x86 assembly (clang, -O2):
<closeClient>:
jmp    1030 <close@plt>

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

LLVM IR (-O2):
define void @closeClient(i32 %0) {
%2 = tail call i32 @close(i32 %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int errno;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
void error_shutdown(char *msg, int error_val) {
  errno = error_val;
  perror(msg);
  exit(EXIT_FAILURE);
}


x86 assembly (clang, -O0):
<error_shutdown>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
mov    0x2ea7(%rip),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rdi
call   1030 <perror@plt>
mov    0x2e8d(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<error_shutdown>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    %esi,(%rax)
call   1030 <perror@plt>
mov    0x2ea2(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@errno = global i32 0
@EXIT_FAILURE = global i32 0
define void @error_shutdown(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
store i32 %5, i32* @errno
%6 = load i8*, i8** %3
%7 = call i32 @perror(i8* %6)
%8 = load i32, i32* @EXIT_FAILURE
%9 = call i32 @exit(i32 %8)
unreachable
}

LLVM IR (-O2):
@errno = global i32 0
@EXIT_FAILURE = global i32 0
define void @error_shutdown(i8* nocapture %0, i32 %1) {
store i32 %1, i32* @errno
%3 = tail call i32 @perror(i8* %0)
%4 = load i32, i32* @EXIT_FAILURE
%5 = tail call i32 @exit(i32 %4)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ very_long_function(int);
main() { very_long_function(1); }


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

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

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 @very_long_function(i32 1)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @very_long_function(i32 1)
ret i32 0
}
/* Variables and functions */
int setBit(int, int);
int setOffSet(int mask, int offset) {
  for (int i = 0; i < offset; i++) {
    mask = setBit(mask, i);
  }
  return mask;
}


x86 assembly (clang, -O0):
<setOffSet>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    114d <setOffSet+0x3d>
mov    -0x4(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1030 <setBit@plt>
mov    %eax,-0x4(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1125 <setOffSet+0x15>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setOffSet>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%eax
test   %esi,%esi
jle    1130 <setOffSet+0x20>
mov    %esi,%ebx
xor    %ebp,%ebp
nopl   (%rax)
mov    %eax,%edi
mov    %ebp,%esi
call   1030 <setBit@plt>
add    $0x1,%ebp
cmp    %ebp,%ebx
jne    1120 <setOffSet+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @setOffSet(i32 %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %6, label %4
4: ; preds = %6, %2
%5 = phi i32 [ %0, %2 ], [ %9, %6 ]
ret i32 %5
6: ; preds = %2, %6
%7 = phi i32 [ %10, %6 ], [ 0, %2 ]
%8 = phi i32 [ %9, %6 ], [ %0, %2 ]
%9 = tail call i32 @setBit(i32 %8, i32 %7)
%10 = add nuw nsw i32 %7, 1
%11 = icmp eq i32 %10, %1
br i1 %11, label %4, label %6
}
/* Variables and functions */
int /*<<< orphan*/ io_loop_remove_fd_n(int, int);
void io_loop_remove_fd(int fd) {
  int i;
  for (i = 0; i < 3; i++)
    io_loop_remove_fd_n(fd, i);
}


x86 assembly (clang, -O0):
<io_loop_remove_fd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    1145 <io_loop_remove_fd+0x35>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <io_loop_remove_fd_n@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1122 <io_loop_remove_fd+0x12>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<io_loop_remove_fd>:
push   %rbx
mov    %edi,%ebx
xor    %esi,%esi
call   1030 <io_loop_remove_fd_n@plt>
mov    %ebx,%edi
mov    $0x1,%esi
call   1030 <io_loop_remove_fd_n@plt>
mov    %ebx,%edi
mov    $0x2,%esi
pop    %rbx
jmp    1030 <io_loop_remove_fd_n@plt>

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

LLVM IR (-O2):
define void @io_loop_remove_fd(i32 %0) {
%2 = tail call i32 @io_loop_remove_fd_n(i32 %0, i32 0)
%3 = tail call i32 @io_loop_remove_fd_n(i32 %0, i32 1)
%4 = tail call i32 @io_loop_remove_fd_n(i32 %0, i32 2)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ ssize_t;

/* Variables and functions */
int /*<<< orphan*/ send(int, char const *, scalar_t__, int /*<<< orphan*/);
scalar_t__ strlen(char const *);
ssize_t send_string(int fd, const char *value) {
  return send(fd, value, strlen(value) + 1, 0);
}


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   1030 <strlen@plt>
mov    -0x1c(%rbp),%edi
mov    -0x18(%rbp),%rsi
mov    %rax,%rdx
add    $0x1,%rdx
xor    %ecx,%ecx
call   1040 <send@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   1030 <strlen@plt>
lea    0x1(%rax),%rdx
mov    %ebp,%edi
mov    %rbx,%rsi
xor    %ecx,%ecx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <send@plt>

LLVM IR (-O0):
define i32 @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 i64 @strlen(i8* %7)
%9 = add nsw i64 %8, 1
%10 = call i32 @send(i32 %5, i8* %6, i64 %9, i32 0)
ret i32 %10
}

LLVM IR (-O2):
define i32 @send_string(i32 %0, i8* %1) {
%3 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%4 = add nsw i64 %3, 1
%5 = tail call i32 @send(i32 %0, i8* %1, i64 %4, i32 0)
ret i32 %5
}
int add(int x, int y, int z) { return x + y; }


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

x86 assembly (clang, -O2):
<add>:
lea    (%rdi,%rsi,1),%eax
ret

LLVM IR (-O0):
define i32 @add(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
%7 = load i32, i32* %4
%8 = load i32, i32* %5
%9 = add nsw i32 %7, %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @add(i32 %0, i32 %1, i32 %2) {
%4 = add nsw i32 %1, %0
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ delay(int);
int /*<<< orphan*/ mbus_remote_register_write(int, int, int);
void set_pmu_sleep_radio() {
  mbus_remote_register_write(0x6, 0x15,
                             ((0 << 19) | (0 << 18) | (0 << 17) | (3 << 14) |
                              (0 << 13) | (14 << 9) | (14 << 5) | (1)));
  delay(100);
  mbus_remote_register_write(0x6, 0x15,
                             ((0 << 19) | (0 << 18) | (0 << 17) | (3 << 14) |
                              (0 << 13) | (14 << 9) | (14 << 5) | (1)));
  delay(100);
  mbus_remote_register_write(
      0x6, 0x17, ((3 << 14) | (0 << 13) | (2 << 9) | (3 << 5) | (1)));
  delay(100);
}


x86 assembly (clang, -O0):
<set_pmu_sleep_radio>:
push   %rbp
mov    %rsp,%rbp
mov    $0x6,%edi
mov    $0x15,%esi
mov    $0xddc1,%edx
call   1040 <mbus_remote_register_write@plt>
mov    $0x64,%edi
call   1030 <delay@plt>
mov    $0x6,%edi
mov    $0x15,%esi
mov    $0xddc1,%edx
call   1040 <mbus_remote_register_write@plt>
mov    $0x64,%edi
call   1030 <delay@plt>
mov    $0x6,%edi
mov    $0x17,%esi
mov    $0xc461,%edx
call   1040 <mbus_remote_register_write@plt>
mov    $0x64,%edi
call   1030 <delay@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_pmu_sleep_radio>:
push   %rax
mov    $0x6,%edi
mov    $0x15,%esi
mov    $0xddc1,%edx
call   1040 <mbus_remote_register_write@plt>
mov    $0x64,%edi
call   1030 <delay@plt>
mov    $0x6,%edi
mov    $0x15,%esi
mov    $0xddc1,%edx
call   1040 <mbus_remote_register_write@plt>
mov    $0x64,%edi
call   1030 <delay@plt>
mov    $0x6,%edi
mov    $0x17,%esi
mov    $0xc461,%edx
call   1040 <mbus_remote_register_write@plt>
mov    $0x64,%edi
pop    %rax
jmp    1030 <delay@plt>

LLVM IR (-O0):
define void @set_pmu_sleep_radio() {
%1 = call i32 @mbus_remote_register_write(i32 6, i32 21, i32 56769)
%2 = call i32 @delay(i32 100)
%3 = call i32 @mbus_remote_register_write(i32 6, i32 21, i32 56769)
%4 = call i32 @delay(i32 100)
%5 = call i32 @mbus_remote_register_write(i32 6, i32 23, i32 50273)
%6 = call i32 @delay(i32 100)
ret void
}

LLVM IR (-O2):
define void @set_pmu_sleep_radio() {
%1 = tail call i32 @mbus_remote_register_write(i32 6, i32 21, i32 56769)
%2 = tail call i32 @delay(i32 100)
%3 = tail call i32 @mbus_remote_register_write(i32 6, i32 21, i32 56769)
%4 = tail call i32 @delay(i32 100)
%5 = tail call i32 @mbus_remote_register_write(i32 6, i32 23, i32 50273)
%6 = tail call i32 @delay(i32 100)
ret void
}
void _mesa_svga24_dummy_function(void) {}


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

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

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

LLVM IR (-O2):
define void @_mesa_svga24_dummy_function() {
ret void
}
int test(int x, int y) {
  int v = x || y;
  return v;
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    $0x1,%al
cmpl   $0x0,-0x4(%rbp)
mov    %al,-0xd(%rbp)
jne    1123 <test+0x23>
cmpl   $0x0,-0x8(%rbp)
setne  %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test>:
xor    %eax,%eax
or     %esi,%edi
setne  %al
ret

LLVM IR (-O0):
define i32 @test(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 = icmp ne i32 %6, 0
br i1 %7, label %11, label %8
8: ; preds = %2
%9 = load i32, i32* %4
%10 = icmp ne i32 %9, 0
br label %11
11: ; preds = %8, %2
%12 = phi i1 [ true, %2 ], [ %10, %8 ]
%13 = zext i1 %12 to i32
store i32 %13, i32* %5
%14 = load i32, i32* %5
ret i32 %14
}

LLVM IR (-O2):
define i32 @test(i32 %0, i32 %1) {
%3 = or i32 %1, %0
%4 = icmp ne i32 %3, 0
%5 = zext i1 %4 to i32
ret i32 %5
}
void event_tex(s) char *s;
{}


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

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

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

LLVM IR (-O2):
define void @event_tex(i8* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int main() {
  struct Fraction1 {
    int numerator;
    int denominator;
  };
  struct Fraction1 f1;
  f1.numerator = 22;
  f1.denominator = 7;
  printf("Numerator =   %d\n", f1.numerator);
  printf("             ---\n");
  printf("Denominator = %d\n", f1.denominator);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x16,-0x10(%rbp)
movl   $0x7,-0xc(%rbp)
mov    -0x10(%rbp),%esi
lea    0xec9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xecd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%esi
lea    0xece(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
mov    $0x16,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xee9(%rip),%rdi
call   1030 <puts@plt>
lea    0xecb(%rip),%rdi
mov    $0x7,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.Fraction1 = type { i32, i32 }
@.str = [18 x i8] c"Numerator = %d\0A\00"
@.str.1 = [18 x i8] c" ---\0A\00"
@.str.2 = [18 x i8] c"Denominator = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.Fraction1
store i32 0, i32* %1
%3 = getelementptr inbounds %struct.Fraction1, %struct.Fraction1* %2, i32 0, i32 0
store i32 22, i32* %3
%4 = getelementptr inbounds %struct.Fraction1, %struct.Fraction1* %2, i32 0, i32 1
store i32 7, i32* %4
%5 = getelementptr inbounds %struct.Fraction1, %struct.Fraction1* %2, i32 0, i32 0
%6 = load i32, i32* %5
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
%9 = getelementptr inbounds %struct.Fraction1, %struct.Fraction1* %2, i32 0, i32 1
%10 = load i32, i32* %9
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 %10)
ret i32 0
}

LLVM IR (-O2):
@.str = [18 x i8] c"Numerator = %d\0A\00"
@.str.2 = [18 x i8] c"Denominator = %d\0A\00"
@str = [17 x i8] c" ---\00"
define i32 @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 22)
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 7)
ret i32 0
}
void *__memcheck_mockup(void *user_data) { return user_data; }


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

x86 assembly (clang, -O2):
<__memcheck_mockup>:
mov    %rdi,%rax
ret

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

LLVM IR (-O2):
define i8* @__memcheck_mockup(i8* readnone returned %0) {
ret i8* %0
}
int st_ptrhash(x, size)
char *x;
int size;
{ return ((int)((unsigned long)(x) >> 2) % size); }


x86 assembly (clang, -O0):
<st_ptrhash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
shr    $0x2,%rax
cltd
idivl  -0xc(%rbp)
mov    %edx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<st_ptrhash>:
mov    %rdi,%rax
shr    $0x2,%rax
cltd
idiv   %esi
mov    %edx,%eax
ret

LLVM IR (-O0):
define i32 @st_ptrhash(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 = ptrtoint i8* %5 to i64
%7 = lshr i64 %6, 2
%8 = trunc i64 %7 to i32
%9 = load i32, i32* %4
%10 = srem i32 %8, %9
ret i32 %10
}

LLVM IR (-O2):
define i32 @st_ptrhash(i8* %0, i32 %1) {
%3 = ptrtoint i8* %0 to i64
%4 = lshr i64 %3, 2
%5 = trunc i64 %4 to i32
%6 = srem i32 %5, %1
ret i32 %6
}
/* Variables and functions */
int hidCodeFromString(char *);
int /*<<< orphan*/ hidMap(int, int /*<<< orphan*/);
int /*<<< orphan*/ scriptThrowException(char *);
void consoleCmdUnmap(char *key) {
  int code = hidCodeFromString(key);
  if (!code) {
    scriptThrowException("Wrong key shortcut");
    return;
  }
  hidMap(code, 0);
}


x86 assembly (clang, -O0):
<consoleCmdUnmap>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <hidCodeFromString@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    1163 <consoleCmdUnmap+0x33>
lea    0xea7(%rip),%rdi
call   1050 <scriptThrowException@plt>
jmp    116d <consoleCmdUnmap+0x3d>
mov    -0xc(%rbp),%edi
xor    %esi,%esi
call   1030 <hidMap@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<consoleCmdUnmap>:
push   %rax
call   1040 <hidCodeFromString@plt>
test   %eax,%eax
je     1144 <consoleCmdUnmap+0x14>
mov    %eax,%edi
xor    %esi,%esi
pop    %rax
jmp    1030 <hidMap@plt>
lea    0xeb5(%rip),%rdi
pop    %rax
jmp    1050 <scriptThrowException@plt>

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

LLVM IR (-O2):
@.str = [19 x i8] c"Wrong key shortcut\00"
define void @consoleCmdUnmap(i8* %0) {
%2 = tail call i32 @hidCodeFromString(i8* %0)
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @scriptThrowException(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
br label %8
6: ; preds = %1
%7 = tail call i32 @hidMap(i32 %2, i32 0)
br label %8
8: ; preds = %6, %4
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
main() {
  int year;
  printf("Enter the year");
  scanf("%d", &year);
  if (year % 4 == 0) {
    printf("It is a leap year");
  } else {
    printf("It is not a leap year");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
lea    0xecd(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1170 <main+0x50>
lea    0xeac(%rip),%rdi
call   1030 <printf@plt>
jmp    117c <main+0x5c>
lea    0xead(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <printf@plt>
lea    0xedb(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
testb  $0x3,0x4(%rsp)
lea    0xec8(%rip),%rax
lea    0xed3(%rip),%rdi
cmove  %rax,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [15 x i8] c"Enter the year\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [18 x i8] c"It is a leap year\00"
@.str.3 = [22 x i8] c"It is not a leap year\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%5 = load i32, i32* %2
%6 = srem i32 %5, 4
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %0
%9 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
br label %12
10: ; preds = %0
%11 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0))
br label %12
12: ; preds = %10, %8
ret i32 0
}

LLVM IR (-O2):
@.str = [15 x i8] c"Enter the year\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [18 x i8] c"It is a leap year\00"
@.str.3 = [22 x i8] c"It is not a leap year\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = and i32 %5, 3
%7 = icmp eq i32 %6, 0
%8 = select i1 %7, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0)
%9 = call i32 @printf(i8* dereferenceable(1) %8)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void iWar_Usage() { printf("Wee\n"); }


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

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

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

LLVM IR (-O2):
@str = [4 x i8] c"Wee\00"
define void @iWar_Usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str, i64 0, i64 0))
ret void
}
void native_safe_halt(void) { asm volatile("sti; hlt" : : : "memory"); }


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

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

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

LLVM IR (-O2):
define void @native_safe_halt() {
tail call void asm sideeffect "sti; hlt", "~{memory},~{dirflag},~{fpsr},~{flags}"()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(int argc, char **argv) {
  printf("C Program Running!\n");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [20 x i8] c"C Program Running!\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [19 x i8] c"C Program Running!\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
ret i32 0
}
int test_imm_DFint8_mem(signed char *val) {
  return ((*val) & (0xDF << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_DFint8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, -33
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ abort();
f(int a, int b, int c) {
  if (a != 2 || b != 2 || c != 3)
    abort();
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jne    113f <f+0x2f>
cmpl   $0x2,-0xc(%rbp)
jne    113f <f+0x2f>
cmpl   $0x3,-0x10(%rbp)
je     1146 <f+0x36>
mov    $0x0,%al
call   1030 <abort@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
cmp    $0x2,%edi
jne    1120 <f+0x10>
cmp    $0x2,%esi
jne    1120 <f+0x10>
cmp    $0x3,%edx
jne    1120 <f+0x10>
ret
push   %rax
xor    %eax,%eax
call   1030 <abort@plt>

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

LLVM IR (-O2):
define i32 @f(i32 %0, i32 %1, i32 %2) {
%4 = icmp ne i32 %0, 2
%5 = icmp ne i32 %1, 2
%6 = or i1 %4, %5
%7 = icmp ne i32 %2, 3
%8 = or i1 %6, %7
br i1 %8, label %9, label %11
9: ; preds = %3
%10 = tail call i32 (...) @abort()
unreachable
11: ; preds = %3
ret i32 undef
}