xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ bcm2835_init();
int /*<<< orphan*/ printTempAndHumidity();
int main() {
  if (!bcm2835_init())
    return 1;
  printTempAndHumidity();
  return 1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <bcm2835_init@plt>
cmp    $0x0,%eax
jne    114b <main+0x2b>
movl   $0x1,-0x4(%rbp)
jmp    1159 <main+0x39>
mov    $0x0,%al
call   1040 <printTempAndHumidity@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <bcm2835_init@plt>
test   %eax,%eax
je     1133 <main+0x13>
xor    %eax,%eax
call   1040 <printTempAndHumidity@plt>
mov    $0x1,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @bcm2835_init()
%2 = icmp eq i32 %1, 0
br i1 %2, label %5, label %3
3: ; preds = %0
%4 = tail call i32 (...) @printTempAndHumidity()
br label %5
5: ; preds = %0, %3
ret i32 1
}
char toLower(char a) { return (a - 'A' + 'a'); }


x86 assembly (clang, -O0):
<toLower>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
sub    $0x41,%eax
add    $0x61,%eax
movsbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<toLower>:
lea    0x20(%rdi),%eax
ret

LLVM IR (-O0):
define signext i8 @toLower(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = sub nsw i32 %4, 65
%6 = add nsw i32 %5, 97
%7 = trunc i32 %6 to i8
ret i8 %7
}

LLVM IR (-O2):
define signext i8 @toLower(i8 signext %0) {
%2 = add i8 %0, 32
ret i8 %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void myphell(void) {
  printf("hello, world !!!!\n");
  return;
}


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

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

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

LLVM IR (-O2):
@str = [18 x i8] c"hello, world !!!!\00"
define void @myphell() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int int32_t;

/* Variables and functions */
int /*<<< orphan*/ fread_unlocked(int **, int, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int, int, int);
int /*<<< orphan*/ stdin;
void transform_objectid(void) {
  int32_t val[3];
  fread_unlocked(&val, 4, 3, stdin);
  printf("\"%x%x%x\"", val[2], val[1], val[0]);
}


x86 assembly (clang, -O0):
<transform_objectid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0xc(%rbp),%rdi
mov    0x2eb5(%rip),%rax
mov    (%rax),%ecx
mov    $0x4,%esi
mov    $0x3,%edx
call   1030 <fread_unlocked@plt>
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    -0xc(%rbp),%ecx
lea    0xeac(%rip),%rdi
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<transform_objectid>:
sub    $0x18,%rsp
mov    0x2ebd(%rip),%rax
mov    (%rax),%ecx
lea    0xc(%rsp),%rdi
mov    $0x4,%esi
mov    $0x3,%edx
call   1030 <fread_unlocked@plt>
mov    0x14(%rsp),%esi
mov    0xc(%rsp),%ecx
mov    0x10(%rsp),%edx
lea    0xeac(%rip),%rdi
call   1040 <printf@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
@stdin = global i32 0
@.str = [9 x i8] c"\22%x%x%x\22\00"
define void @transform_objectid() {
%1 = alloca [3 x i32]
%2 = bitcast [3 x i32]* %1 to i32**
%3 = load i32, i32* @stdin
%4 = call i32 @fread_unlocked(i32** %2, i32 4, i32 3, i32 %3)
%5 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 2
%6 = load i32, i32* %5
%7 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 1
%8 = load i32, i32* %7
%9 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 0
%10 = load i32, i32* %9
%11 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %6, i32 %8, i32 %10)
ret void
}

LLVM IR (-O2):
@stdin = global i32 0
@.str = [9 x i8] c"\22%x%x%x\22\00"
define void @transform_objectid() {
%1 = alloca [3 x i32]
%2 = bitcast [3 x i32]* %1 to i8*
%3 = bitcast [3 x i32]* %1 to i32**
%4 = load i32, i32* @stdin
%5 = call i32 @fread_unlocked(i32** %3, i32 4, i32 3, i32 %4)
%6 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 2
%7 = load i32, i32* %6
%8 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 1
%9 = load i32, i32* %8
%10 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 0
%11 = load i32, i32* %10
%12 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %7, i32 %9, i32 %11)
ret void
}
/* Type definitions */
struct cec_msg {
  int len;
  int /*<<< orphan*/ *msg;
};
typedef int /*<<< orphan*/ __u8;

/* Variables and functions */
int /*<<< orphan*/ CEC_MSG_MENU_STATUS;
void cec_msg_menu_status(struct cec_msg *msg, __u8 menu_state) {
  msg->len = 3;
  msg->msg[1] = CEC_MSG_MENU_STATUS;
  msg->msg[2] = menu_state;
}


x86 assembly (clang, -O0):
<cec_msg_menu_status>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movl   $0x3,(%rax)
mov    0x2ec4(%rip),%rax
mov    (%rax),%ecx
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rax
mov    %ecx,0x4(%rax)
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rax
mov    %ecx,0x8(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<cec_msg_menu_status>:
movl   $0x3,(%rdi)
mov    0x2ed3(%rip),%rax
mov    (%rax),%eax
mov    0x8(%rdi),%rcx
mov    %eax,0x4(%rcx)
mov    %esi,0x8(%rcx)
ret

LLVM IR (-O0):
%struct.cec_msg = type { i32, i32* }
@CEC_MSG_MENU_STATUS = global i32 0
define void @cec_msg_menu_status(%struct.cec_msg* %0, i32 %1) {
%3 = alloca %struct.cec_msg*
%4 = alloca i32
store %struct.cec_msg* %0, %struct.cec_msg** %3
store i32 %1, i32* %4
%5 = load %struct.cec_msg*, %struct.cec_msg** %3
%6 = getelementptr inbounds %struct.cec_msg, %struct.cec_msg* %5, i32 0, i32 0
store i32 3, i32* %6
%7 = load i32, i32* @CEC_MSG_MENU_STATUS
%8 = load %struct.cec_msg*, %struct.cec_msg** %3
%9 = getelementptr inbounds %struct.cec_msg, %struct.cec_msg* %8, i32 0, i32 1
%10 = load i32*, i32** %9
%11 = getelementptr inbounds i32, i32* %10, i64 1
store i32 %7, i32* %11
%12 = load i32, i32* %4
%13 = load %struct.cec_msg*, %struct.cec_msg** %3
%14 = getelementptr inbounds %struct.cec_msg, %struct.cec_msg* %13, i32 0, i32 1
%15 = load i32*, i32** %14
%16 = getelementptr inbounds i32, i32* %15, i64 2
store i32 %12, i32* %16
ret void
}

LLVM IR (-O2):
%struct.cec_msg = type { i32, i32* }
@CEC_MSG_MENU_STATUS = global i32 0
define void @cec_msg_menu_status(%struct.cec_msg* nocapture %0, i32 %1) {
%3 = getelementptr inbounds %struct.cec_msg, %struct.cec_msg* %0, i64 0, i32 0
store i32 3, i32* %3
%4 = load i32, i32* @CEC_MSG_MENU_STATUS
%5 = getelementptr inbounds %struct.cec_msg, %struct.cec_msg* %0, i64 0, i32 1
%6 = load i32*, i32** %5
%7 = getelementptr inbounds i32, i32* %6, i64 1
store i32 %4, i32* %7
%8 = getelementptr inbounds i32, i32* %6, i64 2
store i32 %1, i32* %8
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ fmt;

/* Variables and functions */
scalar_t__ rb_scan_args_lead_p(char const *);
int rb_scan_args_opt_p(const char *fmt) {
  return (rb_scan_args_lead_p(fmt) && ((unsigned char)((fmt[1]) - '0') < 10));
}


x86 assembly (clang, -O0):
<rb_scan_args_opt_p>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <rb_scan_args_lead_p@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x9(%rbp)
je     114e <rb_scan_args_opt_p+0x3e>
mov    -0x8(%rbp),%rax
movsbl 0x1(%rax),%eax
sub    $0x30,%eax
movzbl %al,%eax
cmp    $0xa,%eax
setl   %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rb_scan_args_opt_p>:
push   %rbx
mov    %rdi,%rbx
call   1030 <rb_scan_args_lead_p@plt>
test   %rax,%rax
je     112e <rb_scan_args_opt_p+0x1e>
mov    0x1(%rbx),%cl
add    $0xd0,%cl
xor    %eax,%eax
cmp    $0xa,%cl
setb   %al
pop    %rbx
ret
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @rb_scan_args_opt_p(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i64 @rb_scan_args_lead_p(i8* %3)
%5 = icmp ne i64 %4, 0
br i1 %5, label %6, label %15
6: ; preds = %1
%7 = load i8*, i8** %2
%8 = getelementptr inbounds i8, i8* %7, i64 1
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
%11 = sub nsw i32 %10, 48
%12 = trunc i32 %11 to i8
%13 = zext i8 %12 to i32
%14 = icmp slt i32 %13, 10
br label %15
15: ; preds = %6, %1
%16 = phi i1 [ false, %1 ], [ %14, %6 ]
%17 = zext i1 %16 to i32
ret i32 %17
}

LLVM IR (-O2):
define i32 @rb_scan_args_opt_p(i8* %0) {
%2 = tail call i64 @rb_scan_args_lead_p(i8* %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %10, label %4
4: ; preds = %1
%5 = getelementptr inbounds i8, i8* %0, i64 1
%6 = load i8, i8* %5
%7 = add i8 %6, -48
%8 = icmp ult i8 %7, 10
%9 = zext i1 %8 to i32
br label %10
10: ; preds = %4, %1
%11 = phi i32 [ 0, %1 ], [ %9, %4 ]
ret i32 %11
}
void SetOpenMPNested(const int value) { (void)value; }


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

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

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

LLVM IR (-O2):
define void @SetOpenMPNested(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ io_outportb(int, int);
void io_cursor_disable() {
  io_outportb(0x3D4, 0x0A);
  io_outportb(0x3D5, 0x20);
}


x86 assembly (clang, -O0):
<io_cursor_disable>:
push   %rbp
mov    %rsp,%rbp
mov    $0x3d4,%edi
mov    $0xa,%esi
call   1030 <io_outportb@plt>
mov    $0x3d5,%edi
mov    $0x20,%esi
call   1030 <io_outportb@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<io_cursor_disable>:
push   %rax
mov    $0x3d4,%edi
mov    $0xa,%esi
call   1030 <io_outportb@plt>
mov    $0x3d5,%edi
mov    $0x20,%esi
pop    %rax
jmp    1030 <io_outportb@plt>

LLVM IR (-O0):
define void @io_cursor_disable() {
%1 = call i32 @io_outportb(i32 980, i32 10)
%2 = call i32 @io_outportb(i32 981, i32 32)
ret void
}

LLVM IR (-O2):
define void @io_cursor_disable() {
%1 = tail call i32 @io_outportb(i32 980, i32 10)
%2 = tail call i32 @io_outportb(i32 981, i32 32)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ game_init();
int /*<<< orphan*/ game_start();
int /*<<< orphan*/ gl_init();
int /*<<< orphan*/ glutMainLoop();
int /*<<< orphan*/ window_init(int, char **);
int main(int argc, char *argv[]) {
  window_init(argc, argv);
  gl_init();
  game_init();
  game_start();
  glutMainLoop();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1060 <window_init@plt>
mov    $0x0,%al
call   1070 <gl_init@plt>
mov    $0x0,%al
call   1050 <game_init@plt>
mov    $0x0,%al
call   1030 <game_start@plt>
mov    $0x0,%al
call   1040 <glutMainLoop@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
call   1060 <window_init@plt>
xor    %eax,%eax
call   1070 <gl_init@plt>
xor    %eax,%eax
call   1050 <game_init@plt>
xor    %eax,%eax
call   1030 <game_start@plt>
xor    %eax,%eax
call   1040 <glutMainLoop@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = load i8**, i8*** %5
%8 = call i32 @window_init(i32 %6, i8** %7)
%9 = call i32 (...) @gl_init()
%10 = call i32 (...) @game_init()
%11 = call i32 (...) @game_start()
%12 = call i32 (...) @glutMainLoop()
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @window_init(i32 %0, i8** %1)
%4 = tail call i32 (...) @gl_init()
%5 = tail call i32 (...) @game_init()
%6 = tail call i32 (...) @game_start()
%7 = tail call i32 (...) @glutMainLoop()
ret i32 0
}
void mainboard_interrupt_handlers(int intXX, void *intXX_func) {}


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

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

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

LLVM IR (-O2):
define void @mainboard_interrupt_handlers(i32 %0, i8* nocapture %1) {
ret void
}
int test_imm_47uint8_mem(unsigned char *val) {
  return ((*val) & (0x47 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_47uint8_mem(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8, i8* %3
%5 = zext i8 %4 to i32
%6 = and i32 %5, 71
%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_47uint8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, 71
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
int bnezInstruction(int i) { return (i != 0) ? 1 : 0; }


x86 assembly (clang, -O0):
<bnezInstruction>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @bnezInstruction(i32 %0) {
%2 = icmp ne i32 %0, 0
%3 = zext i1 %2 to i32
ret i32 %3
}
int test_imm_65int64_lowword_reg(long long val) {
  return ((val) & (0x65 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_65int64_lowword_reg(i64 %0) {
%2 = and i64 %0, 101
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ armRaiseInstant(int /*<<< orphan*/);
void armFlatInstant() { armRaiseInstant(0); }


x86 assembly (clang, -O0):
<armFlatInstant>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1030 <armRaiseInstant@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<armFlatInstant>:
xor    %edi,%edi
jmp    1030 <armRaiseInstant@plt>

LLVM IR (-O0):
define void @armFlatInstant() {
%1 = call i32 @armRaiseInstant(i32 0)
ret void
}

LLVM IR (-O2):
define void @armFlatInstant() {
%1 = tail call i32 @armRaiseInstant(i32 0)
ret void
}
int CountMonth(long date) {
  int m = 0;
  date = date % 10000;
  date = (date - date % 100) / 100;
  m = (int)date;
  return (m);
}


x86 assembly (clang, -O0):
<CountMonth>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    $0x2710,%ecx
cqto
idiv   %rcx
mov    %rdx,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    $0x64,%ecx
cqto
idiv   %rcx
mov    -0x18(%rbp),%rax
sub    %rdx,%rax
mov    $0x64,%ecx
cqto
idiv   %rcx
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<CountMonth>:
movabs $0x346dc5d63886594b,%rcx
c5 6d 34
mov    %rdi,%rax
imul   %rcx
mov    %rdx,%rax
shr    $0x3f,%rax
shr    $0xb,%edx
add    %eax,%edx
imul   $0x2710,%edx,%eax
sub    %eax,%edi
movswl %di,%eax
imul   $0x147b,%eax,%eax
mov    %eax,%ecx
shr    $0x1f,%ecx
sar    $0x13,%eax
add    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @CountMonth(i64 %0) {
%2 = alloca i64
%3 = alloca i32
store i64 %0, i64* %2
store i32 0, i32* %3
%4 = load i64, i64* %2
%5 = srem i64 %4, 10000
store i64 %5, i64* %2
%6 = load i64, i64* %2
%7 = load i64, i64* %2
%8 = srem i64 %7, 100
%9 = sub nsw i64 %6, %8
%10 = sdiv i64 %9, 100
store i64 %10, i64* %2
%11 = load i64, i64* %2
%12 = trunc i64 %11 to i32
store i32 %12, i32* %3
%13 = load i32, i32* %3
ret i32 %13
}

LLVM IR (-O2):
define i32 @CountMonth(i64 %0) {
%2 = srem i64 %0, 10000
%3 = trunc i64 %2 to i16
%4 = sdiv i16 %3, 100
%5 = sext i16 %4 to i32
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ StopSound();
void ClearSound() { StopSound(); }


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

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

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

LLVM IR (-O2):
define void @ClearSound() {
%1 = tail call i32 (...) @StopSound()
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ BIO;

/* Variables and functions */
int BIO_write(int /*<<< orphan*/ *, char const *, int);
int strlen(char const *);
int ssl_puts(BIO *bp, const char *str) {
  int n, ret;
  n = strlen(str);
  ret = BIO_write(bp, str, n);
  return (ret);
}


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

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

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

LLVM IR (-O2):
define i32 @ssl_puts(i32* %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %1)
%4 = tail call i32 @BIO_write(i32* %0, i8* %1, i32 %3)
ret i32 %4
}
int fun(int n) {
  if (n < 0)
    return -n;
  return n;
}


x86 assembly (clang, -O0):
<fun>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    111e <fun+0x1e>
xor    %eax,%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1124 <fun+0x24>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @fun(i32 %0) {
%2 = tail call i32 @llvm.abs.i32(i32 %0, i1 true)
ret i32 %2
}
/* Variables and functions */
char *strchr(char *, char);
char *skip_dot(char *name) {
  char *p;
  p = strchr(name, '.');
  if (p)
    return p + 1;
  return name;
}


x86 assembly (clang, -O0):
<skip_dot>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x2e,%esi
call   1030 <strchr@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     114a <skip_dot+0x3a>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1152 <skip_dot+0x42>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<skip_dot>:
push   %rbx
mov    %rdi,%rbx
mov    $0x2e,%esi
call   1030 <strchr@plt>
lea    0x1(%rax),%rcx
test   %rax,%rax
cmove  %rbx,%rcx
mov    %rcx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @skip_dot(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i8* @strchr(i8* %5, i8 signext 46)
store i8* %6, i8** %4
%7 = load i8*, i8** %4
%8 = icmp ne i8* %7, null
br i1 %8, label %9, label %12
9: ; preds = %1
%10 = load i8*, i8** %4
%11 = getelementptr inbounds i8, i8* %10, i64 1
store i8* %11, i8** %2
br label %14
12: ; preds = %1
%13 = load i8*, i8** %3
store i8* %13, i8** %2
br label %14
14: ; preds = %12, %9
%15 = load i8*, i8** %2
ret i8* %15
}

LLVM IR (-O2):
define i8* @skip_dot(i8* %0) {
%2 = tail call i8* @strchr(i8* dereferenceable(1) %0, i8 signext 46)
%3 = icmp eq i8* %2, null
%4 = getelementptr inbounds i8, i8* %2, i64 1
%5 = select i1 %3, i8* %0, i8* %4
ret i8* %5
}
/* Variables and functions */
int /*<<< orphan*/ unlink(char *);
int main() {
  unlink("/etc/ld.so.preload");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [19 x i8] c"/etc/ld.so.preload\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @unlink(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [19 x i8] c"/etc/ld.so.preload\00"
define i32 @main() {
%1 = tail call i32 @unlink(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ addbyte(int);
void MMX_ANDN(int dst_reg, int src_reg) {
  addbyte(0x66);
  addbyte(0x0f);
  addbyte(0xdf);
  addbyte(0xc0 | (dst_reg << 3) | src_reg);
}


x86 assembly (clang, -O0):
<MMX_ANDN>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    $0x66,%edi
call   1030 <addbyte@plt>
mov    $0xf,%edi
call   1030 <addbyte@plt>
mov    $0xdf,%edi
call   1030 <addbyte@plt>
mov    -0x4(%rbp),%edi
shl    $0x3,%edi
or     $0xc0,%edi
or     -0x8(%rbp),%edi
call   1030 <addbyte@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<MMX_ANDN>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
mov    $0x66,%edi
call   1030 <addbyte@plt>
mov    $0xf,%edi
call   1030 <addbyte@plt>
mov    $0xdf,%edi
call   1030 <addbyte@plt>
shl    $0x3,%ebp
or     %ebx,%ebp
or     $0xc0,%ebp
mov    %ebp,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <addbyte@plt>

LLVM IR (-O0):
define void @MMX_ANDN(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = call i32 @addbyte(i32 102)
%6 = call i32 @addbyte(i32 15)
%7 = call i32 @addbyte(i32 223)
%8 = load i32, i32* %3
%9 = shl i32 %8, 3
%10 = or i32 192, %9
%11 = load i32, i32* %4
%12 = or i32 %10, %11
%13 = call i32 @addbyte(i32 %12)
ret void
}

LLVM IR (-O2):
define void @MMX_ANDN(i32 %0, i32 %1) {
%3 = tail call i32 @addbyte(i32 102)
%4 = tail call i32 @addbyte(i32 15)
%5 = tail call i32 @addbyte(i32 223)
%6 = shl i32 %0, 3
%7 = or i32 %6, %1
%8 = or i32 %7, 192
%9 = tail call i32 @addbyte(i32 %8)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ pid_t;

/* Variables and functions */
int kill(int /*<<< orphan*/, int);
int /*<<< orphan*/ unix_error(char *);
void Kill(pid_t pid, int signum) {
  int rc;
  if ((rc = kill(pid, signum)) < 0)
    unix_error("Kill error");
}


x86 assembly (clang, -O0):
<Kill>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <kill@plt>
mov    %eax,-0xc(%rbp)
cmp    $0x0,%eax
jge    1151 <Kill+0x31>
lea    0xeb4(%rip),%rdi
call   1040 <unix_error@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Kill>:
push   %rax
call   1030 <kill@plt>
test   %eax,%eax
js     112c <Kill+0xc>
pop    %rax
ret
lea    0xecd(%rip),%rdi
pop    %rax
jmp    1040 <unix_error@plt>

LLVM IR (-O0):
@.str = [11 x i8] c"Kill error\00"
define void @Kill(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 = call i32 @kill(i32 %6, i32 %7)
store i32 %8, i32* %5
%9 = icmp slt i32 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = call i32 @unix_error(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
br label %12
12: ; preds = %10, %2
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"Kill error\00"
define void @Kill(i32 %0, i32 %1) {
%3 = tail call i32 @kill(i32 %0, i32 %1)
%4 = icmp slt i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @unix_error(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %5, %2
ret void
}
/* Type definitions */
struct stat {
  int /*<<< orphan*/ st_mode;
};

/* Variables and functions */
int /*<<< orphan*/ EBADF;
int /*<<< orphan*/ S_IFCHR;
int _stub(int /*<<< orphan*/);
scalar_t__ isatty(int);
int _fstat(int fd, struct stat *st) {
  if (isatty(fd)) {
    st->st_mode = S_IFCHR;
    return 0;
  }
  return _stub(EBADF);
}


x86 assembly (clang, -O0):
<_fstat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <isatty@plt>
cmp    $0x0,%rax
je     115c <_fstat+0x3c>
mov    0x2e98(%rip),%rax
mov    (%rax),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
movl   $0x0,-0x4(%rbp)
jmp    116d <_fstat+0x4d>
mov    0x2e75(%rip),%rax
mov    (%rax),%edi
call   1040 <_stub@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_fstat>:
push   %rbx
mov    %rsi,%rbx
call   1030 <isatty@plt>
test   %rax,%rax
je     113d <_fstat+0x1d>
mov    0x2eab(%rip),%rax
mov    (%rax),%eax
mov    %eax,(%rbx)
xor    %eax,%eax
pop    %rbx
ret
mov    0x2e94(%rip),%rax
mov    (%rax),%edi
pop    %rbx
jmp    1040 <_stub@plt>

LLVM IR (-O0):
%struct.stat = type { i32 }
@S_IFCHR = global i32 0
@EBADF = global i32 0
define i32 @_fstat(i32 %0, %struct.stat* %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca %struct.stat*
store i32 %0, i32* %4
store %struct.stat* %1, %struct.stat** %5
%6 = load i32, i32* %4
%7 = call i64 @isatty(i32 %6)
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %13
9: ; preds = %2
%10 = load i32, i32* @S_IFCHR
%11 = load %struct.stat*, %struct.stat** %5
%12 = getelementptr inbounds %struct.stat, %struct.stat* %11, i32 0, i32 0
store i32 %10, i32* %12
store i32 0, i32* %3
br label %16
13: ; preds = %2
%14 = load i32, i32* @EBADF
%15 = call i32 @_stub(i32 %14)
store i32 %15, i32* %3
br label %16
16: ; preds = %13, %9
%17 = load i32, i32* %3
ret i32 %17
}

LLVM IR (-O2):
%struct.stat = type { i32 }
@S_IFCHR = global i32 0
@EBADF = global i32 0
define i32 @_fstat(i32 %0, %struct.stat* nocapture writeonly %1) {
%3 = tail call i64 @isatty(i32 %0)
%4 = icmp eq i64 %3, 0
br i1 %4, label %8, label %5
5: ; preds = %2
%6 = load i32, i32* @S_IFCHR
%7 = getelementptr inbounds %struct.stat, %struct.stat* %1, i64 0, i32 0
store i32 %6, i32* %7
br label %11
8: ; preds = %2
%9 = load i32, i32* @EBADF
%10 = tail call i32 @_stub(i32 %9)
br label %11
11: ; preds = %8, %5
%12 = phi i32 [ 0, %5 ], [ %10, %8 ]
ret i32 %12
}
/* Variables and functions */
double cos(double);
double log(double);
double rand_uniform();
double rand_uniopen();
double sqrt(double);
double rand_gaussian(void) {
  double a, b;
  a = rand_uniform();
  b = rand_uniopen();
  return cos(2.0 * 3.14159265358979323846 * a) * sqrt(-2.0 * log(b));
}


x86 assembly (clang, -O0):
<rand_gaussian>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    $0x0,%al
call   1060 <rand_uniform@plt>
movsd  %xmm0,-0x8(%rbp)
mov    $0x0,%al
call   1030 <rand_uniopen@plt>
movsd  %xmm0,-0x10(%rbp)
movsd  0xe90(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
call   1040 <cos@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1050 <log@plt>
movaps %xmm0,%xmm1
movsd  0xe64(%rip),%xmm0
mulsd  %xmm1,%xmm0
call   1070 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
mulsd  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rand_gaussian>:
sub    $0x18,%rsp
xor    %eax,%eax
call   1060 <rand_uniform@plt>
movsd  %xmm0,0x8(%rsp)
xor    %eax,%eax
call   1030 <rand_uniopen@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
mulsd  0xe84(%rip),%xmm0
call   1040 <cos@plt>
movsd  %xmm0,0x8(%rsp)
movsd  0x10(%rsp),%xmm0
call   1050 <log@plt>
mulsd  0xe6e(%rip),%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     11aa <rand_gaussian+0x5a>
sqrtsd %xmm0,%xmm0
jmp    11af <rand_gaussian+0x5f>
call   1070 <sqrt@plt>
movsd  0x8(%rsp),%xmm1
mulsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @rand_gaussian() {
%1 = alloca double
%2 = alloca double
%3 = call double (...) @rand_uniform()
store double %3, double* %1
%4 = call double (...) @rand_uniopen()
store double %4, double* %2
%5 = load double, double* %1
%6 = fmul double 0x401921FB54442D18, %5
%7 = call double @cos(double %6)
%8 = load double, double* %2
%9 = call double @log(double %8)
%10 = fmul double -2.000000e+00, %9
%11 = call double @sqrt(double %10)
%12 = fmul double %7, %11
ret double %12
}

LLVM IR (-O2):
define double @rand_gaussian() {
%1 = tail call double (...) @rand_uniform()
%2 = tail call double (...) @rand_uniopen()
%3 = fmul double %1, 0x401921FB54442D18
%4 = tail call double @cos(double %3)
%5 = tail call double @log(double %2)
%6 = fmul double %5, -2.000000e+00
%7 = tail call double @sqrt(double %6)
%8 = fmul double %4, %7
ret double %8
}
/* Variables and functions */
void dummy(void) {}


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

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

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

LLVM IR (-O2):
define void @dummy() {
ret void
}
void Pattern7(struct PatternGen_Params *P, struct PatternGen_Settings *S,
              struct PatternGen_Random *R,
              struct PatternGen_PatternFuncSpecific *PS, int I,
              struct PatternGen_Tick *Output) {}


x86 assembly (clang, -O0):
<Pattern7>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    %r9,-0x30(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.PatternGen_Params = type opaque
%struct.PatternGen_Settings = type opaque
%struct.PatternGen_Random = type opaque
%struct.PatternGen_PatternFuncSpecific = type opaque
%struct.PatternGen_Tick = type opaque
define void @Pattern7(%struct.PatternGen_Params* %0, %struct.PatternGen_Settings* %1, %struct.PatternGen_Random* %2, %struct.PatternGen_PatternFuncSpecific* %3, i32 %4, %struct.PatternGen_Tick* %5) {
%7 = alloca %struct.PatternGen_Params*
%8 = alloca %struct.PatternGen_Settings*
%9 = alloca %struct.PatternGen_Random*
%10 = alloca %struct.PatternGen_PatternFuncSpecific*
%11 = alloca i32
%12 = alloca %struct.PatternGen_Tick*
store %struct.PatternGen_Params* %0, %struct.PatternGen_Params** %7
store %struct.PatternGen_Settings* %1, %struct.PatternGen_Settings** %8
store %struct.PatternGen_Random* %2, %struct.PatternGen_Random** %9
store %struct.PatternGen_PatternFuncSpecific* %3, %struct.PatternGen_PatternFuncSpecific** %10
store i32 %4, i32* %11
store %struct.PatternGen_Tick* %5, %struct.PatternGen_Tick** %12
ret void
}

LLVM IR (-O2):
%struct.PatternGen_Params = type opaque
%struct.PatternGen_Settings = type opaque
%struct.PatternGen_Random = type opaque
%struct.PatternGen_PatternFuncSpecific = type opaque
%struct.PatternGen_Tick = type opaque
define void @Pattern7(%struct.PatternGen_Params* nocapture %0, %struct.PatternGen_Settings* nocapture %1, %struct.PatternGen_Random* nocapture %2, %struct.PatternGen_PatternFuncSpecific* nocapture %3, i32 %4, %struct.PatternGen_Tick* nocapture %5) {
ret void
}
int sim_open(struct lm_interface_state *s) { return 0; }


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

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

LLVM IR (-O0):
%struct.lm_interface_state = type opaque
define i32 @sim_open(%struct.lm_interface_state* %0) {
%2 = alloca %struct.lm_interface_state*
store %struct.lm_interface_state* %0, %struct.lm_interface_state** %2
ret i32 0
}

LLVM IR (-O2):
%struct.lm_interface_state = type opaque
define i32 @sim_open(%struct.lm_interface_state* nocapture readnone %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int, int);
testBitXor() { printf("%d ^ %d = %d\n", 10, 7, 10 ^ 7); }


x86 assembly (clang, -O0):
<testBitXor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rdi
mov    $0xa,%esi
mov    $0x7,%edx
mov    $0xd,%ecx
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testBitXor>:
lea    0xee9(%rip),%rdi
mov    $0xa,%esi
mov    $0x7,%edx
mov    $0xd,%ecx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"%d ^ %d = %d\0A\00"
define i32 @testBitXor() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 10, i32 7, i32 13)
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
@.str = [14 x i8] c"%d ^ %d = %d\0A\00"
define i32 @testBitXor() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 10, i32 7, i32 13)
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ RSL_CanSetPosition(void *, int);
void OnCodecWrapper_CanSetPosition(int canSetPosition, void *codecSpecific,
                                   void *streamTag) {
  RSL_CanSetPosition(streamTag, canSetPosition);
}


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

x86 assembly (clang, -O2):
<OnCodecWrapper_CanSetPosition>:
mov    %edi,%esi
mov    %rdx,%rdi
jmp    1030 <RSL_CanSetPosition@plt>

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

LLVM IR (-O2):
define void @OnCodecWrapper_CanSetPosition(i32 %0, i8* nocapture readnone %1, i8* %2) {
%4 = tail call i32 @RSL_CanSetPosition(i8* %2, i32 %0)
ret void
}
int mus_audio_open_output(int dev, int srate, int chans, int format, int size) {
  return (-1);
}


x86 assembly (clang, -O0):
<mus_audio_open_output>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8d,-0x14(%rbp)
mov    $0xffffffff,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @mus_audio_open_output(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 %0, i32* %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i32 %4, i32* %10
ret i32 -1
}

LLVM IR (-O2):
define i32 @mus_audio_open_output(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4) {
ret i32 -1
}
int test_imm_1Fint64_highword_mem(long long *val) {
  return ((*val >> 32) & (0x1F << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_1Fint64_highword_mem(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64, i64* %3
%5 = ashr i64 %4, 32
%6 = and i64 %5, 31
%7 = icmp ne i64 %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_1Fint64_highword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 133143986176
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
float sqrtf(float const);
float dist(int i, int j, int y, int x, float a) {
  const float di = (i - y);
  const float dj = (j - x);
  return sqrtf(di * di + dj * dj * a * a);
}


x86 assembly (clang, -O0):
<dist>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
movss  %xmm0,-0x14(%rbp)
mov    -0x4(%rbp),%eax
sub    -0xc(%rbp),%eax
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x18(%rbp)
mov    -0x8(%rbp),%eax
sub    -0x10(%rbp),%eax
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x18(%rbp),%xmm0
movss  -0x18(%rbp),%xmm2
movss  -0x1c(%rbp),%xmm1
mulss  -0x1c(%rbp),%xmm1
mulss  -0x14(%rbp),%xmm1
mulss  -0x14(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
call   1030 <sqrtf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dist>:
movaps %xmm0,%xmm1
sub    %edx,%edi
xorps  %xmm0,%xmm0
cvtsi2ss %edi,%xmm0
sub    %ecx,%esi
cvtsi2ss %esi,%xmm2
mulss  %xmm2,%xmm2
mulss  %xmm1,%xmm2
mulss  %xmm1,%xmm2
mulss  %xmm0,%xmm0
addss  %xmm2,%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jb     1143 <dist+0x33>
sqrtss %xmm0,%xmm0
ret
jmp    1030 <sqrtf@plt>

LLVM IR (-O0):
define float @dist(i32 %0, i32 %1, i32 %2, i32 %3, float %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca float
%11 = alloca float
%12 = alloca float
store i32 %0, i32* %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store float %4, float* %10
%13 = load i32, i32* %6
%14 = load i32, i32* %8
%15 = sub nsw i32 %13, %14
%16 = sitofp i32 %15 to float
store float %16, float* %11
%17 = load i32, i32* %7
%18 = load i32, i32* %9
%19 = sub nsw i32 %17, %18
%20 = sitofp i32 %19 to float
store float %20, float* %12
%21 = load float, float* %11
%22 = load float, float* %11
%23 = load float, float* %12
%24 = load float, float* %12
%25 = fmul float %23, %24
%26 = load float, float* %10
%27 = fmul float %25, %26
%28 = load float, float* %10
%29 = fmul float %27, %28
%30 = call float @llvm.fmuladd.f32(float %21, float %22, float %29)
%31 = call float @sqrtf(float %30)
ret float %31
}

LLVM IR (-O2):
define float @dist(i32 %0, i32 %1, i32 %2, i32 %3, float %4) {
%6 = sub nsw i32 %0, %2
%7 = sitofp i32 %6 to float
%8 = sub nsw i32 %1, %3
%9 = sitofp i32 %8 to float
%10 = fmul float %9, %9
%11 = fmul float %10, %4
%12 = fmul float %11, %4
%13 = tail call float @llvm.fmuladd.f32(float %7, float %7, float %12)
%14 = tail call float @sqrtf(float %13)
ret float %14
}
/* Variables and functions */
int INT_MIN;
signed int ov_ineg(signed int a, int *ov) {
  if (a == INT_MIN) {
    *ov = 1;
    return INT_MIN;
  }
  return -a;
}


x86 assembly (clang, -O0):
<ov_ineg>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    0x2ed3(%rip),%rcx
cmp    (%rcx),%eax
jne    1138 <ov_ineg+0x38>
mov    -0x10(%rbp),%rax
movl   $0x1,(%rax)
mov    0x2eba(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1140 <ov_ineg+0x40>
xor    %eax,%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ov_ineg>:
mov    0x2ee1(%rip),%rcx
cmp    %edi,(%rcx)
jne    1114 <ov_ineg+0x14>
movl   $0x1,(%rsi)
mov    (%rcx),%eax
ret
mov    %edi,%eax
neg    %eax
ret

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

LLVM IR (-O2):
@INT_MIN = global i32 0
define i32 @ov_ineg(i32 %0, i32* nocapture writeonly %1) {
%3 = load i32, i32* @INT_MIN
%4 = icmp eq i32 %3, %0
br i1 %4, label %5, label %7
5: ; preds = %2
store i32 1, i32* %1
%6 = load i32, i32* @INT_MIN
br label %9
7: ; preds = %2
%8 = sub nsw i32 0, %0
br label %9
9: ; preds = %7, %5
%10 = phi i32 [ %6, %5 ], [ %8, %7 ]
ret i32 %10
}
void ff_hevc_put_hevc_uni_qpel_v64_8_sse4() {}


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

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

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

LLVM IR (-O2):
define void @ff_hevc_put_hevc_uni_qpel_v64_8_sse4() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void test() { printf("hishihihih"); }


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

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

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

LLVM IR (-O2):
@.str = [11 x i8] c"hishihihih\00"
define void @test() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
char *libintl_dngettext(char const *, char const *, char const *,
                        unsigned long);
char *dngettext(const char *domainname, const char *msgid1, const char *msgid2,
                unsigned long int n) {
  return libintl_dngettext(domainname, msgid1, msgid2, n);
}


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

x86 assembly (clang, -O2):
<dngettext>:
jmp    1030 <libintl_dngettext@plt>

LLVM IR (-O0):
define i8* @dngettext(i8* %0, i8* %1, i8* %2, i64 %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i64
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i64 %3, i64* %8
%9 = load i8*, i8** %5
%10 = load i8*, i8** %6
%11 = load i8*, i8** %7
%12 = load i64, i64* %8
%13 = call i8* @libintl_dngettext(i8* %9, i8* %10, i8* %11, i64 %12)
ret i8* %13
}

LLVM IR (-O2):
define i8* @dngettext(i8* %0, i8* %1, i8* %2, i64 %3) {
%5 = tail call i8* @libintl_dngettext(i8* %0, i8* %1, i8* %2, i64 %3)
ret i8* %5
}
int intViewRestore(struct LSD_SceneNodeInst const *inst, void *instData) {
  return 0;
}


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

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

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

LLVM IR (-O2):
%struct.LSD_SceneNodeInst = type opaque
define i32 @intViewRestore(%struct.LSD_SceneNodeInst* nocapture readnone %0, i8* nocapture readnone %1) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main(void) {
  int valor1 = 0;
  printf("informe um valor para saber se é par(P) ou impar(I)\n");
  scanf("%d", &valor1);
  printf("%c \n", ((valor1 % 2) == 0) ? 'P' : 'I');
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
lea    0xec3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeeb(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    $0x49,%esi
mov    $0x50,%eax
cmp    $0x0,%edx
cmove  %eax,%esi
lea    0xec3(%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
movl   $0x0,0x4(%rsp)
lea    0xec8(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb4(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
testb  $0x1,0x4(%rsp)
mov    $0x50,%eax
mov    $0x49,%esi
cmove  %eax,%esi
lea    0xe94(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [54 x i8] c"informe um valor para saber se \C3\A9 par(P) ou impar(I)\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [5 x i8] c"%c \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 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, 2
%7 = icmp eq i32 %6, 0
%8 = zext i1 %7 to i64
%9 = select i1 %7, i32 80, i32 73
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %9)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [5 x i8] c"%c \0A\00"
@str = [53 x i8] c"informe um valor para saber se \C3\A9 par(P) ou impar(I)\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 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, 1
%7 = icmp eq i32 %6, 0
%8 = select i1 %7, i32 80, i32 73
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %8)
ret i32 0
}