xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ itemInvChooseItem();
int /*<<< orphan*/ itemWield(int /*<<< orphan*/);
void input_wield(void) { itemWield(itemInvChooseItem()); }


x86 assembly (clang, -O0):
<input_wield>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <itemInvChooseItem@plt>
mov    %eax,%edi
call   1040 <itemWield@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<input_wield>:
push   %rax
xor    %eax,%eax
call   1030 <itemInvChooseItem@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <itemWield@plt>

LLVM IR (-O0):
define void @input_wield() {
%1 = call i32 (...) @itemInvChooseItem()
%2 = call i32 @itemWield(i32 %1)
ret void
}

LLVM IR (-O2):
define void @input_wield() {
%1 = tail call i32 (...) @itemInvChooseItem()
%2 = tail call i32 @itemWield(i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ __print_int(int);
int main() {
  int i = 0;
  int a = 0;
  int b = 10;
  int c = 0;
  while (i < 5) {
    a = b * 4;
    c = a * b;
    i++;
  }
  __print_int(c);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0xa,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x5,-0x8(%rbp)
jge    1166 <main+0x56>
mov    -0x10(%rbp),%eax
shl    $0x2,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
imul   -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    113b <main+0x2b>
mov    -0x14(%rbp),%edi
call   1030 <__print_int@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @__print_int(i32 400)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_mutex_t;

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int);
int pthread_mutex_unlock(int /*<<< orphan*/ *);
int /*<<< orphan*/ stderr;
void safe_mutex_unlock(pthread_mutex_t *mutex) {
  int ret = pthread_mutex_unlock(mutex);
  if (ret != 0) {
    fprintf(stderr, "pthread_mutex_unlock error [%d]! Aborting immediately!\n",
            ret);
    exit(1);
  }
}


x86 assembly (clang, -O0):
<safe_mutex_unlock>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <pthread_mutex_unlock@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1174 <safe_mutex_unlock+0x44>
mov    0x2e87(%rip),%rax
mov    (%rax),%edi
mov    -0xc(%rbp),%edx
lea    0xe9b(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<safe_mutex_unlock>:
push   %rax
call   1040 <pthread_mutex_unlock@plt>
test   %eax,%eax
jne    113c <safe_mutex_unlock+0xc>
pop    %rax
ret
mov    0x2e9d(%rip),%rcx
mov    (%rcx),%edi
lea    0xeb4(%rip),%rsi
mov    %eax,%edx
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [56 x i8] c"pthread_mutex_unlock error [%d]! Aborting immediately!\0A\00"
define void @safe_mutex_unlock(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
%4 = load i32*, i32** %2
%5 = call i32 @pthread_mutex_unlock(i32* %4)
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %13
8: ; preds = %1
%9 = load i32, i32* @stderr
%10 = load i32, i32* %3
%11 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = call i32 @exit(i32 1)
unreachable
13: ; preds = %1
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [56 x i8] c"pthread_mutex_unlock error [%d]! Aborting immediately!\0A\00"
define void @safe_mutex_unlock(i32* %0) {
%2 = tail call i32 @pthread_mutex_unlock(i32* %0)
%3 = icmp eq i32 %2, 0
br i1 %3, label %8, label %4
4: ; preds = %1
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0), i32 %2)
%7 = tail call i32 @exit(i32 1)
unreachable
8: ; preds = %1
ret void
}
/* Variables and functions */
int EXIT_SUCCESS;
int /*<<< orphan*/ printf(char *, int);
int proc();
int main(int argc, char *argv[]) {
  printf("%i\n", proc());
  return EXIT_SUCCESS;
}


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   1040 <proc@plt>
mov    %eax,%esi
lea    0xeba(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e8e(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [4 x i8] c"%i\0A\00"
@EXIT_SUCCESS = global i32 0
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 (...) @proc()
%7 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = load i32, i32* @EXIT_SUCCESS
ret i32 %8
}

LLVM IR (-O2):
@.str = [4 x i8] c"%i\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @proc()
%4 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = load i32, i32* @EXIT_SUCCESS
ret i32 %5
}
__attribute((always_)) void old(a, b) int a, b;
{}


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

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

LLVM IR (-O0):
define void @old(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 @old(i32 %0, i32 %1) {
ret void
}
void foo549(int p) {}


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

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

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

LLVM IR (-O2):
define void @foo549(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int getpid();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ sleep(int);
void manage_child() {
  printf("Child process (PID %d)\n", getpid());
  printf("Child: I am doing some stuff for 10 seconds...\n");
  sleep(10);
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<manage_child>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %eax,%esi
lea    0xeac(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xeb6(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0xa,%edi
call   1060 <sleep@plt>
mov    0x2e66(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<manage_child>:
push   %rax
xor    %eax,%eax
call   1040 <getpid@plt>
lea    0xea1(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xea9(%rip),%rdi
call   1030 <puts@plt>
mov    $0xa,%edi
call   1070 <sleep@plt>
mov    0x2e5b(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [24 x i8] c"Child process (PID %d)\0A\00"
@.str.1 = [48 x i8] c"Child: I am doing some stuff for 10 seconds...\0A\00"
@EXIT_SUCCESS = global i32 0
define void @manage_child() {
%1 = call i32 (...) @getpid()
%2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 @sleep(i32 10)
%5 = load i32, i32* @EXIT_SUCCESS
%6 = call i32 @exit(i32 %5)
unreachable
}

LLVM IR (-O2):
@.str = [24 x i8] c"Child process (PID %d)\0A\00"
@EXIT_SUCCESS = global i32 0
@str = [47 x i8] c"Child: I am doing some stuff for 10 seconds...\00"
define void @manage_child() {
%1 = tail call i32 (...) @getpid()
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @sleep(i32 10)
%5 = load i32, i32* @EXIT_SUCCESS
%6 = tail call i32 @exit(i32 %5)
unreachable
}
/* Type definitions */
struct szl_stream {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct szl_stream *);
int /*<<< orphan*/ szl_stream_close(struct szl_stream *);
__attribute__((nonnull(1))) void szl_stream_free(struct szl_stream *strm) {
  szl_stream_close(strm);
  free(strm);
}


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

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

LLVM IR (-O0):
%struct.szl_stream = type { i32 }
define void @szl_stream_free(%struct.szl_stream* %0) {
%2 = alloca %struct.szl_stream*
store %struct.szl_stream* %0, %struct.szl_stream** %2
%3 = load %struct.szl_stream*, %struct.szl_stream** %2
%4 = call i32 @szl_stream_close(%struct.szl_stream* %3)
%5 = load %struct.szl_stream*, %struct.szl_stream** %2
%6 = call i32 @free(%struct.szl_stream* %5)
ret void
}

LLVM IR (-O2):
%struct.szl_stream = type { i32 }
define void @szl_stream_free(%struct.szl_stream* %0) {
%2 = tail call i32 @szl_stream_close(%struct.szl_stream* %0)
%3 = tail call i32 @free(%struct.szl_stream* %0)
ret void
}
int dbsp2row(pos)
int pos;
{ return (2 + 2 * (pos / 64)); }


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

x86 assembly (clang, -O2):
<dbsp2row>:
lea    0x3f(%rdi),%eax
test   %edi,%edi
cmovns %edi,%eax
sar    $0x6,%eax
add    %eax,%eax
add    $0x2,%eax
ret

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

LLVM IR (-O2):
define i32 @dbsp2row(i32 %0) {
%2 = sdiv i32 %0, 64
%3 = shl nsw i32 %2, 1
%4 = add nsw i32 %3, 2
ret i32 %4
}
int test_imm_24uint8_reg(unsigned char val) {
  return ((val) & (-0x24 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_24uint8_reg(i8 zeroext %0) {
%2 = and i8 %0, -36
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, void *);
int /*<<< orphan*/ stderr;
void rtpp_module_if_start_fin(void *pub) {
  fprintf(stderr,
          "Method rtpp_module_if@%p::start (rtpp_module_if_start) is invoked "
          "after destruction\x0a",
          pub);
  abort();
}


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

x86 assembly (clang, -O2):
<rtpp_module_if_start_fin>:
push   %rax
mov    %rdi,%rdx
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1040 <fprintf@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [85 x i8] c"Method rtpp_module_if@%p::start (rtpp_module_if_start) is invoked after destruction\0A\00"
define void @rtpp_module_if_start_fin(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([85 x i8], [85 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = call i32 (...) @abort()
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [85 x i8] c"Method rtpp_module_if@%p::start (rtpp_module_if_start) is invoked after destruction\0A\00"
define void @rtpp_module_if_start_fin(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([85 x i8], [85 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = tail call i32 (...) @abort()
unreachable
}
void rop3_178_1_1(unsigned char *D, unsigned char S, unsigned char T) {
  unsigned char stk1;
  unsigned char stk2;
  unsigned char stk3;
  stk2 = S ^ T;
  stk3 = *D ^ S;
  stk2 = stk2 | stk3;
  stk1 = S ^ stk2;
  *D = (stk1 & (~S) & (~T)) | (*D & S) | (*D & T);
}


x86 assembly (clang, -O0):
<rop3_178_1_1>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %sil,%cl
mov    %rdi,-0x8(%rbp)
mov    %cl,-0x9(%rbp)
mov    %al,-0xa(%rbp)
movzbl -0x9(%rbp),%eax
movzbl -0xa(%rbp),%ecx
xor    %ecx,%eax
mov    %al,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
movzbl -0x9(%rbp),%ecx
xor    %ecx,%eax
mov    %al,-0xd(%rbp)
movzbl -0xc(%rbp),%eax
movzbl -0xd(%rbp),%ecx
or     %ecx,%eax
mov    %al,-0xc(%rbp)
movzbl -0x9(%rbp),%eax
movzbl -0xc(%rbp),%ecx
xor    %ecx,%eax
mov    %al,-0xb(%rbp)
movzbl -0xb(%rbp),%eax
movzbl -0x9(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
movzbl -0xa(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl (%rcx),%ecx
movzbl -0x9(%rbp),%edx
and    %edx,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl (%rcx),%ecx
movzbl -0xa(%rbp),%edx
and    %edx,%ecx
or     %ecx,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @rop3_178_1_1(i8* %0, i8 zeroext %1, i8 zeroext %2) {
%4 = alloca i8*
%5 = alloca i8
%6 = alloca i8
%7 = alloca i8
%8 = alloca i8
%9 = alloca i8
store i8* %0, i8** %4
store i8 %1, i8* %5
store i8 %2, i8* %6
%10 = load i8, i8* %5
%11 = zext i8 %10 to i32
%12 = load i8, i8* %6
%13 = zext i8 %12 to i32
%14 = xor i32 %11, %13
%15 = trunc i32 %14 to i8
store i8 %15, i8* %8
%16 = load i8*, i8** %4
%17 = load i8, i8* %16
%18 = zext i8 %17 to i32
%19 = load i8, i8* %5
%20 = zext i8 %19 to i32
%21 = xor i32 %18, %20
%22 = trunc i32 %21 to i8
store i8 %22, i8* %9
%23 = load i8, i8* %8
%24 = zext i8 %23 to i32
%25 = load i8, i8* %9
%26 = zext i8 %25 to i32
%27 = or i32 %24, %26
%28 = trunc i32 %27 to i8
store i8 %28, i8* %8
%29 = load i8, i8* %5
%30 = zext i8 %29 to i32
%31 = load i8, i8* %8
%32 = zext i8 %31 to i32
%33 = xor i32 %30, %32
%34 = trunc i32 %33 to i8
store i8 %34, i8* %7
%35 = load i8, i8* %7
%36 = zext i8 %35 to i32
%37 = load i8, i8* %5
%38 = zext i8 %37 to i32
%39 = xor i32 %38, -1
%40 = and i32 %36, %39
%41 = load i8, i8* %6
%42 = zext i8 %41 to i32
%43 = xor i32 %42, -1
%44 = and i32 %40, %43
%45 = load i8*, i8** %4
%46 = load i8, i8* %45
%47 = zext i8 %46 to i32
%48 = load i8, i8* %5
%49 = zext i8 %48 to i32
%50 = and i32 %47, %49
%51 = or i32 %44, %50
%52 = load i8*, i8** %4
%53 = load i8, i8* %52
%54 = zext i8 %53 to i32
%55 = load i8, i8* %6
%56 = zext i8 %55 to i32
%57 = and i32 %54, %56
%58 = or i32 %51, %57
%59 = trunc i32 %58 to i8
%60 = load i8*, i8** %4
store i8 %59, i8* %60
ret void
}

LLVM IR (-O2):
define void @rop3_178_1_1(i8* nocapture %0, i8 zeroext %1, i8 zeroext %2) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ put_values(double *, int, double);
void put_zeros(double *arr, int n) { put_values(arr, n, 0.0); }


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

x86 assembly (clang, -O2):
<put_zeros>:
xorps  %xmm0,%xmm0
jmp    1030 <put_values@plt>

LLVM IR (-O0):
define void @put_zeros(double* %0, i32 %1) {
%3 = alloca double*
%4 = alloca i32
store double* %0, double** %3
store i32 %1, i32* %4
%5 = load double*, double** %3
%6 = load i32, i32* %4
%7 = call i32 @put_values(double* %5, i32 %6, double 0.000000e+00)
ret void
}

LLVM IR (-O2):
define void @put_zeros(double* %0, i32 %1) {
%3 = tail call i32 @put_values(double* %0, i32 %1, double 0.000000e+00)
ret void
}
/* Variables and functions */
int __VERIFIER_nondet_int();
int main() {
  int x, b;
  x = __VERIFIER_nondet_int();
  b = __VERIFIER_nondet_int();
  while (b != 0) {
    b = __VERIFIER_nondet_int();
    x = x - 1;
    if (x >= 0) {
      b = 1;
    } else {
      b = 0;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <__VERIFIER_nondet_int@plt>
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1030 <__VERIFIER_nondet_int@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1172 <main+0x62>
mov    $0x0,%al
call   1030 <__VERIFIER_nondet_int@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jl     1166 <main+0x56>
movl   $0x1,-0xc(%rbp)
jmp    116d <main+0x5d>
movl   $0x0,-0xc(%rbp)
jmp    1133 <main+0x23>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1030 <__VERIFIER_nondet_int@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1030 <__VERIFIER_nondet_int@plt>
test   %eax,%eax
je     113e <main+0x2e>
add    $0x1,%ebx
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <__VERIFIER_nondet_int@plt>
add    $0xffffffff,%ebx
test   %ebx,%ebx
jg     1130 <main+0x20>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @__VERIFIER_nondet_int()
%2 = tail call i32 (...) @__VERIFIER_nondet_int()
%3 = icmp eq i32 %2, 0
br i1 %3, label %9, label %4
4: ; preds = %0, %4
%5 = phi i32 [ %7, %4 ], [ %1, %0 ]
%6 = tail call i32 (...) @__VERIFIER_nondet_int()
%7 = add nsw i32 %5, -1
%8 = icmp slt i32 %5, 1
br i1 %8, label %9, label %4
9: ; preds = %4, %0
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ puts(char *);
int main(int argc, char *argv[]) {
  puts("Hello, World!");
  int i = 0;
  for (i = 0; i < 5; i++) {
    printf("%i\n", i);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xec3(%rip),%rdi
call   1030 <puts@plt>
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x5,-0x14(%rbp)
jge    1177 <main+0x57>
mov    -0x14(%rbp),%esi
lea    0xeaa(%rip),%rdi
call   1040 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1150 <main+0x30>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
lea    0xeda(%rip),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [14 x i8] c"Hello, World!\00"
@.str.1 = [4 x i8] c"%i\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 0)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 1)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 2)
%7 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 3)
%8 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 4)
ret i32 0
}
int foo(void) { return -1; }


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

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

LLVM IR (-O0):
define i32 @foo() {
ret i32 -1
}

LLVM IR (-O2):
define i32 @foo() {
ret i32 -1
}
extern unsigned int setUnion(unsigned int set1, unsigned int set2) {
  unsigned int result;
  result = set1 | set2;
  return result;
}


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

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

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

LLVM IR (-O2):
define i32 @setUnion(i32 %0, i32 %1) {
%3 = or i32 %1, %0
ret i32 %3
}
void do_nothing(void *p) { return; }


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

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

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

LLVM IR (-O2):
define void @do_nothing(i8* nocapture %0) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ EVP_CIPHER_CTX;

/* Variables and functions */
int EVP_DecryptFinal_ex(int /*<<< orphan*/ *, unsigned char *, int *);
int EVP_DecryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl) {
  int ret;
  ret = EVP_DecryptFinal_ex(ctx, out, outl);
  return ret;
}


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

x86 assembly (clang, -O2):
<EVP_DecryptFinal>:
jmp    1030 <EVP_DecryptFinal_ex@plt>

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

LLVM IR (-O2):
define i32 @EVP_DecryptFinal(i32* %0, i8* %1, i32* %2) {
%4 = tail call i32 @EVP_DecryptFinal_ex(i32* %0, i8* %1, i32* %2)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *,
                           char const *, unsigned long);
int /*<<< orphan*/ stderr;
void testfail(const char *file, unsigned long line, const char *expression) {
  fprintf(stderr, "TEST FAILED: %s: file %s, line %ld\n", expression, file,
          line);
  exit(1);
}


x86 assembly (clang, -O0):
<testfail>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    0x2ea5(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rdx
mov    -0x8(%rbp),%rcx
mov    -0x10(%rbp),%r8
lea    0xeb0(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<testfail>:
push   %rax
mov    %rsi,%r8
mov    %rdi,%rcx
mov    0x2eb2(%rip),%rax
mov    (%rax),%edi
lea    0xec9(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [36 x i8] c"TEST FAILED: %s: file %s, line %ld\0A\00"
define void @testfail(i8* %0, i64 %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i8*
store i8* %0, i8** %4
store i64 %1, i64* %5
store i8* %2, i8** %6
%7 = load i32, i32* @stderr
%8 = load i8*, i8** %6
%9 = load i8*, i8** %4
%10 = load i64, i64* %5
%11 = call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i8* %8, i8* %9, i64 %10)
%12 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [36 x i8] c"TEST FAILED: %s: file %s, line %ld\0A\00"
define void @testfail(i8* %0, i64 %1, i8* %2) {
%4 = load i32, i32* @stderr
%5 = tail call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i8* %2, i8* %0, i64 %1)
%6 = tail call i32 @exit(i32 1)
unreachable
}
/* Type definitions */
typedef unsigned long uint64_t;

/* Variables and functions */
int pte_type(unsigned long *);
unsigned long *xtables_create_table();
int /*<<< orphan*/ xtables_set_table(unsigned long *, unsigned long *);
uint64_t *xtables_get_level_table(uint64_t *pte) {
  uint64_t *table = (uint64_t *)(*pte & ((1UL << 33) - (1 << 12)));
  if (pte_type(pte) != (3 << 0)) {
    table = xtables_create_table();
    xtables_set_table(pte, table);
  }
  return table;
}


x86 assembly (clang, -O0):
<xtables_get_level_table>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rcx
movabs $0x1fffff000,%rax
and    (%rcx),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <pte_type@plt>
cmp    $0x3,%eax
je     117b <xtables_get_level_table+0x4b>
mov    $0x0,%al
call   1040 <xtables_create_table@plt>
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <xtables_set_table@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xtables_get_level_table>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
movabs $0x1fffff000,%rbx
and    (%rdi),%rbx
call   1050 <pte_type@plt>
cmp    $0x3,%eax
je     1163 <xtables_get_level_table+0x33>
xor    %eax,%eax
call   1040 <xtables_create_table@plt>
mov    %rax,%rbx
mov    %r14,%rdi
mov    %rax,%rsi
call   1030 <xtables_set_table@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i64* @xtables_get_level_table(i64* %0) {
%2 = alloca i64*
%3 = alloca i64*
store i64* %0, i64** %2
%4 = load i64*, i64** %2
%5 = load i64, i64* %4
%6 = and i64 %5, 8589930496
%7 = inttoptr i64 %6 to i64*
store i64* %7, i64** %3
%8 = load i64*, i64** %2
%9 = call i32 @pte_type(i64* %8)
%10 = icmp ne i32 %9, 3
br i1 %10, label %11, label %16
11: ; preds = %1
%12 = call i64* (...) @xtables_create_table()
store i64* %12, i64** %3
%13 = load i64*, i64** %2
%14 = load i64*, i64** %3
%15 = call i32 @xtables_set_table(i64* %13, i64* %14)
br label %16
16: ; preds = %11, %1
%17 = load i64*, i64** %3
ret i64* %17
}

LLVM IR (-O2):
define i64* @xtables_get_level_table(i64* %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 8589930496
%4 = inttoptr i64 %3 to i64*
%5 = tail call i32 @pte_type(i64* %0)
%6 = icmp eq i32 %5, 3
br i1 %6, label %10, label %7
7: ; preds = %1
%8 = tail call i64* (...) @xtables_create_table()
%9 = tail call i32 @xtables_set_table(i64* %0, i64* %8)
br label %10
10: ; preds = %7, %1
%11 = phi i64* [ %8, %7 ], [ %4, %1 ]
ret i64* %11
}
/* Variables and functions */
int /*<<< orphan*/ accel_run();
int /*<<< orphan*/ accel_sleep();
int /*<<< orphan*/ power_off_periph();
int /*<<< orphan*/ power_on_periph();
int /*<<< orphan*/ uc_sleep();
void sleep() {
  accel_sleep();
  power_off_periph();
  uc_sleep();
  power_on_periph();
  accel_run();
}


x86 assembly (clang, -O0):
<sleep>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1070 <accel_sleep@plt>
mov    $0x0,%al
call   1050 <power_off_periph@plt>
mov    $0x0,%al
call   1030 <uc_sleep@plt>
mov    $0x0,%al
call   1060 <power_on_periph@plt>
mov    $0x0,%al
call   1040 <accel_run@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<sleep>:
push   %rax
xor    %eax,%eax
call   1070 <accel_sleep@plt>
xor    %eax,%eax
call   1050 <power_off_periph@plt>
xor    %eax,%eax
call   1030 <uc_sleep@plt>
xor    %eax,%eax
call   1060 <power_on_periph@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <accel_run@plt>

LLVM IR (-O0):
define void @sleep() {
%1 = call i32 (...) @accel_sleep()
%2 = call i32 (...) @power_off_periph()
%3 = call i32 (...) @uc_sleep()
%4 = call i32 (...) @power_on_periph()
%5 = call i32 (...) @accel_run()
ret void
}

LLVM IR (-O2):
define void @sleep() {
%1 = tail call i32 (...) @accel_sleep()
%2 = tail call i32 (...) @power_off_periph()
%3 = tail call i32 (...) @uc_sleep()
%4 = tail call i32 (...) @power_on_periph()
%5 = tail call i32 (...) @accel_run()
ret void
}
unsigned char constant_time_eq_8(unsigned a, unsigned b) {
  unsigned c = a ^ b;
  c--;
  return ((unsigned char)(((unsigned)((int)(c) >> (sizeof(int) * 8 - 1)))));
}


x86 assembly (clang, -O0):
<constant_time_eq_8>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
xor    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
sar    $0x1f,%eax
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<constant_time_eq_8>:
xor    %esi,%edi
lea    -0x1(%rdi),%eax
sar    $0x1f,%eax
ret

LLVM IR (-O0):
define zeroext i8 @constant_time_eq_8(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* %4
%8 = xor i32 %6, %7
store i32 %8, i32* %5
%9 = load i32, i32* %5
%10 = add i32 %9, -1
store i32 %10, i32* %5
%11 = load i32, i32* %5
%12 = ashr i32 %11, 31
%13 = trunc i32 %12 to i8
ret i8 %13
}

LLVM IR (-O2):
define zeroext i8 @constant_time_eq_8(i32 %0, i32 %1) {
%3 = xor i32 %1, %0
%4 = add i32 %3, -1
%5 = ashr i32 %4, 31
%6 = trunc i32 %5 to i8
ret i8 %6
}
int clamp(int x, int lo, int hi) { return (x < lo) ? lo : ((x > hi) ? hi : x); }


x86 assembly (clang, -O0):
<clamp>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1124 <clamp+0x24>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    1147 <clamp+0x47>
mov    -0x4(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    113b <clamp+0x3b>
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    1141 <clamp+0x41>
mov    -0x4(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<clamp>:
mov    %edx,%eax
cmp    %edx,%edi
cmovle %edi,%eax
cmp    %esi,%edi
cmovl  %esi,%eax
ret

LLVM IR (-O0):
define i32 @clamp(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 = icmp slt i32 %7, %8
br i1 %9, label %10, label %12
10: ; preds = %3
%11 = load i32, i32* %5
br label %22
12: ; preds = %3
%13 = load i32, i32* %4
%14 = load i32, i32* %6
%15 = icmp sgt i32 %13, %14
br i1 %15, label %16, label %18
16: ; preds = %12
%17 = load i32, i32* %6
br label %20
18: ; preds = %12
%19 = load i32, i32* %4
br label %20
20: ; preds = %18, %16
%21 = phi i32 [ %17, %16 ], [ %19, %18 ]
br label %22
22: ; preds = %20, %10
%23 = phi i32 [ %11, %10 ], [ %21, %20 ]
ret i32 %23
}

LLVM IR (-O2):
define i32 @clamp(i32 %0, i32 %1, i32 %2) {
%4 = icmp slt i32 %0, %1
%5 = icmp sgt i32 %0, %2
%6 = select i1 %5, i32 %2, i32 %0
%7 = select i1 %4, i32 %1, i32 %6
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int maxfactor_checker(int m, int n) {
  assert(m > 1);
  assert(n > 0);
  return ((m % n) == 0) ? n : maxfactor_checker(m, n - 1);
}


x86 assembly (clang, -O0):
<maxfactor_checker>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x1,-0x4(%rbp)
setg   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
cmpl   $0x0,-0x8(%rbp)
setg   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
cmp    $0x0,%edx
jne    116b <maxfactor_checker+0x4b>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    117c <maxfactor_checker+0x5c>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
sub    $0x1,%esi
call   1040 <maxfactor_checker@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<maxfactor_checker>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%ebx
mov    %edi,%r14d
xor    %ebp,%ebp
cmp    $0x2,%edi
setge  %bpl
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %ebp,%edi
call   1030 <assert@plt>
xor    %edi,%edi
test   %ebx,%ebx
setg   %dil
call   1030 <assert@plt>
mov    %r14d,%eax
cltd
idiv   %ebx
add    $0xffffffff,%ebx
test   %edx,%edx
jne    1130 <maxfactor_checker+0x20>
add    $0x1,%ebx
mov    %ebx,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @maxfactor_checker(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 = icmp sgt i32 %5, 1
%7 = zext i1 %6 to i32
%8 = call i32 @assert(i32 %7)
%9 = load i32, i32* %4
%10 = icmp sgt i32 %9, 0
%11 = zext i1 %10 to i32
%12 = call i32 @assert(i32 %11)
%13 = load i32, i32* %3
%14 = load i32, i32* %4
%15 = srem i32 %13, %14
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %19
17: ; preds = %2
%18 = load i32, i32* %4
br label %24
19: ; preds = %2
%20 = load i32, i32* %3
%21 = load i32, i32* %4
%22 = sub nsw i32 %21, 1
%23 = call i32 @maxfactor_checker(i32 %20, i32 %22)
br label %24
24: ; preds = %19, %17
%25 = phi i32 [ %18, %17 ], [ %23, %19 ]
ret i32 %25
}

LLVM IR (-O2):
define i32 @maxfactor_checker(i32 %0, i32 %1) {
%3 = icmp sgt i32 %0, 1
%4 = zext i1 %3 to i32
br label %5
5: ; preds = %5, %2
%6 = phi i32 [ %1, %2 ], [ %13, %5 ]
%7 = tail call i32 @assert(i32 %4)
%8 = icmp sgt i32 %6, 0
%9 = zext i1 %8 to i32
%10 = tail call i32 @assert(i32 %9)
%11 = srem i32 %0, %6
%12 = icmp eq i32 %11, 0
%13 = add nsw i32 %6, -1
br i1 %12, label %14, label %5
14: ; preds = %5
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ bbm_write(void *, int, int);
int fc8150_deinit(void *hDevice) {
  bbm_write(hDevice, 0x0001, 0x00);
  return 0;
}


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

x86 assembly (clang, -O2):
<fc8150_deinit>:
push   %rax
mov    $0x1,%esi
xor    %edx,%edx
call   1030 <bbm_write@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @fc8150_deinit(i8* %0) {
%2 = tail call i32 @bbm_write(i8* %0, i32 1, i32 0)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ SYS_tgkill;
scalar_t__ _real_syscall(int /*<<< orphan*/, int, int, int);
__attribute__((visibility("hidden"))) int _real_tgkill(int tgid, int tid,
                                                       int sig) {
  return (int)_real_syscall(SYS_tgkill, tgid, tid, sig);
}


x86 assembly (clang, -O0):
<_real_tgkill>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    0x2ec0(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    -0xc(%rbp),%ecx
call   1030 <_real_syscall@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_real_tgkill>:
mov    %edx,%ecx
mov    %esi,%edx
mov    %edi,%esi
mov    0x2ecb(%rip),%rax
mov    (%rax),%edi
jmp    1030 <_real_syscall@plt>

LLVM IR (-O0):
@SYS_tgkill = global i32 0
define hidden i32 @_real_tgkill(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* @SYS_tgkill
%8 = load i32, i32* %4
%9 = load i32, i32* %5
%10 = load i32, i32* %6
%11 = call i64 @_real_syscall(i32 %7, i32 %8, i32 %9, i32 %10)
%12 = trunc i64 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
@SYS_tgkill = global i32 0
define hidden i32 @_real_tgkill(i32 %0, i32 %1, i32 %2) {
%4 = load i32, i32* @SYS_tgkill
%5 = tail call i64 @_real_syscall(i32 %4, i32 %0, i32 %1, i32 %2)
%6 = trunc i64 %5 to i32
ret i32 %6
}
int getColor(unsigned long cmap, char *color_name) { return 1; }


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

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

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

LLVM IR (-O2):
define i32 @getColor(i64 %0, i8* nocapture readnone %1) {
ret i32 1
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  int /*<<< orphan*/ *display;
};
typedef TYPE_1__ XMapRequestEvent;
typedef int /*<<< orphan*/ Display;

/* Variables and functions */
void set_XMapRequestEvent_display(void *_p, void *_v) {
  ((XMapRequestEvent *)_p)->display = (Display *)_v;
}


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

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

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

LLVM IR (-O2):
define void @set_XMapRequestEvent_display(i8* nocapture writeonly %0, i8* %1) {
%3 = bitcast i8* %0 to i8**
store i8* %1, i8** %3
ret void
}
void extern_undeclared(void) {}


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

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

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

LLVM IR (-O2):
define void @extern_undeclared() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ OnFwdSyncEx(unsigned char, char, short, unsigned char);
void OnRevSyncEx(unsigned char Outputs, char Speed, short Turn,
                 unsigned char reset) {
  OnFwdSyncEx(Outputs, Speed * -1, Turn, reset);
}


x86 assembly (clang, -O0):
<OnRevSyncEx>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %cl,%al
mov    %dx,%cx
mov    %sil,%dl
mov    %dil,%sil
mov    %sil,-0x1(%rbp)
mov    %dl,-0x2(%rbp)
mov    %cx,-0x4(%rbp)
mov    %al,-0x5(%rbp)
mov    -0x1(%rbp),%dl
movsbl -0x2(%rbp),%eax
imul   $0xffffffff,%eax,%eax
mov    %al,%cl
mov    -0x4(%rbp),%ax
movzbl %dl,%edi
movsbl %cl,%esi
movswl %ax,%edx
movzbl -0x5(%rbp),%ecx
call   1030 <OnFwdSyncEx@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<OnRevSyncEx>:
neg    %sil
movsbl %sil,%esi
jmp    1030 <OnFwdSyncEx@plt>

LLVM IR (-O0):
define void @OnRevSyncEx(i8 zeroext %0, i8 signext %1, i16 signext %2, i8 zeroext %3) {
%5 = alloca i8
%6 = alloca i8
%7 = alloca i16
%8 = alloca i8
store i8 %0, i8* %5
store i8 %1, i8* %6
store i16 %2, i16* %7
store i8 %3, i8* %8
%9 = load i8, i8* %5
%10 = load i8, i8* %6
%11 = sext i8 %10 to i32
%12 = mul nsw i32 %11, -1
%13 = trunc i32 %12 to i8
%14 = load i16, i16* %7
%15 = load i8, i8* %8
%16 = call i32 @OnFwdSyncEx(i8 zeroext %9, i8 signext %13, i16 signext %14, i8 zeroext %15)
ret void
}

LLVM IR (-O2):
define void @OnRevSyncEx(i8 zeroext %0, i8 signext %1, i16 signext %2, i8 zeroext %3) {
%5 = sub i8 0, %1
%6 = tail call i32 @OnFwdSyncEx(i8 zeroext %0, i8 signext %5, i16 signext %2, i8 zeroext %3)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int getc(int /*<<< orphan*/ *);
int rpmlget16(FILE *fp) {
  int r;
  r = getc(fp);
  r = r << 8 | getc(fp);
  return r;
}


x86 assembly (clang, -O0):
<rpmlget16>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <getc@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
shl    $0x8,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <getc@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
or     %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rpmlget16>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1030 <getc@plt>
mov    %eax,%ebp
shl    $0x8,%ebp
mov    %rbx,%rdi
call   1030 <getc@plt>
or     %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @rpmlget16(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
%4 = load i32*, i32** %2
%5 = call i32 @getc(i32* %4)
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = shl i32 %6, 8
%8 = load i32*, i32** %2
%9 = call i32 @getc(i32* %8)
%10 = or i32 %7, %9
store i32 %10, i32* %3
%11 = load i32, i32* %3
ret i32 %11
}

LLVM IR (-O2):
define i32 @rpmlget16(i32* nocapture %0) {
%2 = tail call i32 @getc(i32* %0)
%3 = shl i32 %2, 8
%4 = tail call i32 @getc(i32* %0)
%5 = or i32 %3, %4
ret i32 %5
}
int a() { return 5; }


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

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

LLVM IR (-O0):
define i32 @a() {
ret i32 5
}

LLVM IR (-O2):
define i32 @a() {
ret i32 5
}
int isSpace(int c) {
  switch (c) {
  case ' ':
  case '\r':
  case '\n':
  case '\t':
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<isSpace>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
add    $0xfffffff7,%eax
sub    $0x2,%eax
jb     1140 <isSpace+0x40>
jmp    111e <isSpace+0x1e>
mov    -0xc(%rbp),%eax
sub    $0xd,%eax
je     1140 <isSpace+0x40>
jmp    112f <isSpace+0x2f>
mov    -0xc(%rbp),%eax
sub    $0x20,%eax
jne    114c <isSpace+0x4c>
jmp    1140 <isSpace+0x40>
movl   $0x1,-0x4(%rbp)
jmp    1153 <isSpace+0x53>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isSpace>:
cmp    $0x20,%edi
ja     111d <isSpace+0x1d>
mov    $0x1,%eax
mov    %edi,%ecx
movabs $0x100002600,%rdx
bt     %rcx,%rdx
jae    111d <isSpace+0x1d>
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @isSpace(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %6 [
i32 32, label %5
i32 13, label %5
i32 10, label %5
i32 9, label %5
]
5: ; preds = %1, %1, %1, %1
store i32 1, i32* %2
br label %7
6: ; preds = %1
store i32 0, i32* %2
br label %7
7: ; preds = %6, %5
%8 = load i32, i32* %2
ret i32 %8
}

LLVM IR (-O2):
define i32 @isSpace(i32 %0) {
switch i32 %0, label %2 [
i32 32, label %3
i32 13, label %3
i32 10, label %3
i32 9, label %3
]
2: ; preds = %1
br label %3
3: ; preds = %1, %1, %1, %1, %2
%4 = phi i32 [ 0, %2 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ]
ret i32 %4
}
/* Type definitions */
struct timespec {
  scalar_t__ tv_nsec;
  scalar_t__ tv_sec;
};

/* Variables and functions */
int /*<<< orphan*/ CLOCK_REALTIME;
int /*<<< orphan*/ clock_gettime(int /*<<< orphan*/, struct timespec *);
double GetWallTime(void) {
  struct timespec tv;
  clock_gettime(CLOCK_REALTIME, &tv);
  return (double)tv.tv_sec + 1e-9 * (double)tv.tv_nsec;
}


x86 assembly (clang, -O0):
<GetWallTime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2ec1(%rip),%rax
mov    (%rax),%edi
lea    -0x10(%rbp),%rsi
call   1030 <clock_gettime@plt>
cvtsi2sdq -0x8(%rbp),%xmm1
cvtsi2sdq -0x10(%rbp),%xmm0
movsd  0xec2(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetWallTime>:
sub    $0x18,%rsp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
lea    0x8(%rsp),%rsi
call   1030 <clock_gettime@plt>
cvtsi2sdq 0x10(%rsp),%xmm1
cvtsi2sdq 0x8(%rsp),%xmm0
mulsd  0xec3(%rip),%xmm0
addsd  %xmm1,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timespec = type { i64, i64 }
@CLOCK_REALTIME = global i32 0
define double @GetWallTime() {
%1 = alloca %struct.timespec
%2 = load i32, i32* @CLOCK_REALTIME
%3 = call i32 @clock_gettime(i32 %2, %struct.timespec* %1)
%4 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i32 0, i32 1
%5 = load i64, i64* %4
%6 = sitofp i64 %5 to double
%7 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i32 0, i32 0
%8 = load i64, i64* %7
%9 = sitofp i64 %8 to double
%10 = call double @llvm.fmuladd.f64(double 1.000000e-09, double %9, double %6)
ret double %10
}

LLVM IR (-O2):
%struct.timespec = type { i64, i64 }
@CLOCK_REALTIME = global i32 0
define double @GetWallTime() {
%1 = alloca %struct.timespec
%2 = bitcast %struct.timespec* %1 to i8*
%3 = load i32, i32* @CLOCK_REALTIME
%4 = call i32 @clock_gettime(i32 %3, %struct.timespec* %1)
%5 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i64 0, i32 1
%6 = load i64, i64* %5
%7 = sitofp i64 %6 to double
%8 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i64 0, i32 0
%9 = load i64, i64* %8
%10 = sitofp i64 %9 to double
%11 = call double @llvm.fmuladd.f64(double %10, double 1.000000e-09, double %7)
ret double %11
}