xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ free(char *);
char *remove_consective_blank(char *);
char *replaceSpace(char const *);
char *trim(char *);
char *normalize(const char *input) {
  char *replaced = replaceSpace(input);
  char *trimmed = trim(replaced);
  char *normalized = remove_consective_blank(trimmed);
  free(replaced);
  free(trimmed);
  return normalized;
}


x86 assembly (clang, -O0):
<normalize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <replaceSpace@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <trim@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1060 <remove_consective_blank@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<normalize>:
push   %r15
push   %r14
push   %rbx
call   1050 <replaceSpace@plt>
mov    %rax,%r14
mov    %rax,%rdi
call   1040 <trim@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1060 <remove_consective_blank@plt>
mov    %rax,%r15
mov    %r14,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r15,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @normalize(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %2
%6 = load i8*, i8** %2
%7 = call i8* @replaceSpace(i8* %6)
store i8* %7, i8** %3
%8 = load i8*, i8** %3
%9 = call i8* @trim(i8* %8)
store i8* %9, i8** %4
%10 = load i8*, i8** %4
%11 = call i8* @remove_consective_blank(i8* %10)
store i8* %11, i8** %5
%12 = load i8*, i8** %3
%13 = call i32 @free(i8* %12)
%14 = load i8*, i8** %4
%15 = call i32 @free(i8* %14)
%16 = load i8*, i8** %5
ret i8* %16
}

LLVM IR (-O2):
define i8* @normalize(i8* %0) {
%2 = tail call i8* @replaceSpace(i8* %0)
%3 = tail call i8* @trim(i8* %2)
%4 = tail call i8* @remove_consective_blank(i8* %3)
%5 = tail call i32 @free(i8* %2)
%6 = tail call i32 @free(i8* %3)
ret i8* %4
}
uart_polled_write(char d) {
  while (!((*((volatile char *)(0xFFFC1000 + 0x1C))) & (0x40)))
    continue;
  (*((volatile char *)(0xFFFC1000 + 0x10))) = d;
}


x86 assembly (clang, -O0):
<uart_polled_write>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
mov    $0xfffc101c,%eax
mov    (%rax),%al
movsbl %al,%eax
and    $0x40,%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    112c <uart_polled_write+0x2c>
jmp    1131 <uart_polled_write+0x31>
jmp    110a <uart_polled_write+0xa>
mov    -0x5(%rbp),%cl
mov    $0xfffc1010,%eax
mov    %cl,(%rax)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<uart_polled_write>:
mov    $0xfffc1010,%eax
cs nopw 0x0(%rax,%rax,1)
nop
testb  $0x40,0xc(%rax)
je     1110 <uart_polled_write+0x10>
mov    %dil,(%rax)
ret

LLVM IR (-O0):
define i32 @uart_polled_write(i8 signext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
br label %4
4: ; preds = %10, %1
%5 = load volatile i8, i8* inttoptr (i64 4294709276 to i8*)
%6 = sext i8 %5 to i32
%7 = and i32 %6, 64
%8 = icmp ne i32 %7, 0
%9 = xor i1 %8, true
br i1 %9, label %10, label %11
10: ; preds = %4
br label %4
11: ; preds = %4
%12 = load i8, i8* %3
store volatile i8 %12, i8* inttoptr (i64 4294709264 to i8*)
%13 = load i32, i32* %2
ret i32 %13
}

LLVM IR (-O2):
define i32 @uart_polled_write(i8 signext %0) {
br label %2
2: ; preds = %2, %1
%3 = load volatile i8, i8* inttoptr (i64 4294709276 to i8*)
%4 = and i8 %3, 64
%5 = icmp eq i8 %4, 0
br i1 %5, label %2, label %6
6: ; preds = %2
store volatile i8 %0, i8* inttoptr (i64 4294709264 to i8*)
ret i32 undef
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
uint32_t shuffle2(uint32_t N, uint32_t B) { return (N >> B) & 1; }


x86 assembly (clang, -O0):
<shuffle2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
sar    %cl,%eax
and    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<shuffle2>:
mov    %esi,%ecx
mov    %edi,%eax
shr    %cl,%eax
and    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @shuffle2(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = ashr i32 %5, %6
%8 = and i32 %7, 1
ret i32 %8
}

LLVM IR (-O2):
define i32 @shuffle2(i32 %0, i32 %1) {
%3 = lshr i32 %0, %1
%4 = and i32 %3, 1
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() {
  int i;
  for (i = 0; i < 10; i++) {
    printf("Hello World!\n");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    114a <main+0x3a>
lea    0xec9(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1126 <main+0x16>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@str = [13 x i8] c"Hello World!\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
ret i32 0
}
int pthread_setcancelstate(int state, int *oldstate) { return -1; }


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

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

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

LLVM IR (-O2):
define i32 @pthread_setcancelstate(i32 %0, i32* nocapture readnone %1) {
ret i32 -1
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
int write(int, char *, int);
void writeToDevice(int fd, int reg, int val) {
  char buf[2];
  buf[0] = reg;
  buf[1] = val;
  if (write(fd, buf, 2) != 2) {
    fprintf(stderr, "Can't write to ADXL345\n");
  }
}


x86 assembly (clang, -O0):
<writeToDevice>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    %al,-0xe(%rbp)
mov    -0xc(%rbp),%eax
mov    %al,-0xd(%rbp)
mov    -0x4(%rbp),%edi
lea    -0xe(%rbp),%rsi
mov    $0x2,%edx
call   1030 <write@plt>
cmp    $0x2,%eax
je     116c <writeToDevice+0x4c>
mov    0x2e82(%rip),%rax
mov    (%rax),%edi
lea    0xe99(%rip),%rsi
call   1040 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<writeToDevice>:
push   %rax
mov    %sil,0x6(%rsp)
mov    %dl,0x7(%rsp)
lea    0x6(%rsp),%rsi
mov    $0x2,%edx
call   1030 <write@plt>
cmp    $0x2,%eax
jne    1140 <writeToDevice+0x20>
pop    %rax
ret
mov    0x2e99(%rip),%rax
mov    (%rax),%edi
lea    0xeb0(%rip),%rsi
pop    %rax
jmp    1040 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [24 x i8] c"Can't write to ADXL345\0A\00"
define void @writeToDevice(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca [2 x i8]
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i32, i32* %5
%9 = trunc i32 %8 to i8
%10 = getelementptr inbounds [2 x i8], [2 x i8]* %7, i64 0, i64 0
store i8 %9, i8* %10
%11 = load i32, i32* %6
%12 = trunc i32 %11 to i8
%13 = getelementptr inbounds [2 x i8], [2 x i8]* %7, i64 0, i64 1
store i8 %12, i8* %13
%14 = load i32, i32* %4
%15 = getelementptr inbounds [2 x i8], [2 x i8]* %7, i64 0, i64 0
%16 = call i32 @write(i32 %14, i8* %15, i32 2)
%17 = icmp ne i32 %16, 2
br i1 %17, label %18, label %21
18: ; preds = %3
%19 = load i32, i32* @stderr
%20 = call i32 @fprintf(i32 %19, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
br label %21
21: ; preds = %18, %3
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [24 x i8] c"Can't write to ADXL345\0A\00"
define void @writeToDevice(i32 %0, i32 %1, i32 %2) {
%4 = alloca [2 x i8]
%5 = getelementptr inbounds [2 x i8], [2 x i8]* %4, i64 0, i64 0
%6 = trunc i32 %1 to i8
store i8 %6, i8* %5
%7 = trunc i32 %2 to i8
%8 = getelementptr inbounds [2 x i8], [2 x i8]* %4, i64 0, i64 1
store i8 %7, i8* %8
%9 = call i32 @write(i32 %0, i8* %5, i32 2)
%10 = icmp eq i32 %9, 2
br i1 %10, label %14, label %11
11: ; preds = %3
%12 = load i32, i32* @stderr
%13 = tail call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
br label %14
14: ; preds = %11, %3
ret void
}
int test_imm_E9int16_mem(short *val) {
  return ((*val) & (0xE9 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_E9int16_mem(i16* %0) {
%2 = alloca i16*
store i16* %0, i16** %2
%3 = load i16*, i16** %2
%4 = load i16, i16* %3
%5 = sext i16 %4 to i32
%6 = and i32 %5, 233
%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_E9int16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, 233
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Type definitions */
struct epoll_event {
  int dummy;
};

/* Variables and functions */
int syscall(int, int, int, int, struct epoll_event *);
int my_epoll_ctl(int epfd, int op, int fd, struct epoll_event *event) {
  return syscall(255, epfd, op, fd, event);
}


x86 assembly (clang, -O0):
<my_epoll_ctl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %rcx,-0x18(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    -0xc(%rbp),%ecx
mov    -0x18(%rbp),%r8
mov    $0xff,%edi
call   1030 <syscall@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_epoll_ctl>:
mov    %rcx,%r8
mov    %edx,%ecx
mov    %esi,%edx
mov    %edi,%esi
mov    $0xff,%edi
jmp    1030 <syscall@plt>

LLVM IR (-O0):
%struct.epoll_event = type { i32 }
define i32 @my_epoll_ctl(i32 %0, i32 %1, i32 %2, %struct.epoll_event* %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca %struct.epoll_event*
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store %struct.epoll_event* %3, %struct.epoll_event** %8
%9 = load i32, i32* %5
%10 = load i32, i32* %6
%11 = load i32, i32* %7
%12 = load %struct.epoll_event*, %struct.epoll_event** %8
%13 = call i32 @syscall(i32 255, i32 %9, i32 %10, i32 %11, %struct.epoll_event* %12)
ret i32 %13
}

LLVM IR (-O2):
%struct.epoll_event = type { i32 }
define i32 @my_epoll_ctl(i32 %0, i32 %1, i32 %2, %struct.epoll_event* %3) {
%5 = tail call i32 @syscall(i32 255, i32 %0, i32 %1, i32 %2, %struct.epoll_event* %3)
ret i32 %5
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  unsigned long window;
};
typedef TYPE_1__ XAnyEvent;

/* Variables and functions */
void set_XAnyEvent_window(void *_p, unsigned long _v) {
  ((XAnyEvent *)_p)->window = (unsigned long)_v;
}


x86 assembly (clang, -O0):
<set_XAnyEvent_window>:
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_XAnyEvent_window>:
mov    %rsi,(%rdi)
ret

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

LLVM IR (-O2):
define void @set_XAnyEvent_window(i8* nocapture writeonly %0, i64 %1) {
%3 = bitcast i8* %0 to i64*
store i64 %1, i64* %3
ret void
}
/* Type definitions */
typedef int ssize_t;

/* Variables and functions */
int /*<<< orphan*/ basic_test(int);
int /*<<< orphan*/ cleanup_test();
int /*<<< orphan*/ init_test();
int log_write_start(int);
void write_one_sector_start(void) {
  ssize_t n;
  init_test();
  n = log_write_start(512);
  basic_test(n == 512);
  cleanup_test();
}


x86 assembly (clang, -O0):
<write_one_sector_start>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1060 <init_test@plt>
mov    $0x200,%edi
call   1050 <log_write_start@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0x200,-0x4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <basic_test@plt>
mov    $0x0,%al
call   1040 <cleanup_test@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_one_sector_start>:
push   %rax
xor    %eax,%eax
call   1060 <init_test@plt>
mov    $0x200,%edi
call   1050 <log_write_start@plt>
xor    %edi,%edi
cmp    $0x200,%eax
sete   %dil
call   1030 <basic_test@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <cleanup_test@plt>

LLVM IR (-O0):
define void @write_one_sector_start() {
%1 = alloca i32
%2 = call i32 (...) @init_test()
%3 = call i32 @log_write_start(i32 512)
store i32 %3, i32* %1
%4 = load i32, i32* %1
%5 = icmp eq i32 %4, 512
%6 = zext i1 %5 to i32
%7 = call i32 @basic_test(i32 %6)
%8 = call i32 (...) @cleanup_test()
ret void
}

LLVM IR (-O2):
define void @write_one_sector_start() {
%1 = tail call i32 (...) @init_test()
%2 = tail call i32 @log_write_start(i32 512)
%3 = icmp eq i32 %2, 512
%4 = zext i1 %3 to i32
%5 = tail call i32 @basic_test(i32 %4)
%6 = tail call i32 (...) @cleanup_test()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ scan(char *, int /*<<< orphan*/);
int /*<<< orphan*/ strlen(char *);
main() { scan("0", strlen("0")); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <strlen@plt>
mov    %eax,%esi
lea    0xec7(%rip),%rdi
call   1040 <scan@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xed8(%rip),%rbx
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <scan@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [2 x i8] c"0\00"
define i32 @main() {
%1 = call i32 @strlen(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @scan(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}

LLVM IR (-O2):
@.str = [2 x i8] c"0\00"
define i32 @main() {
%1 = tail call i32 @strlen(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @scan(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}
/* Type definitions */
typedef int uint8_t;
typedef int uint32_t;
typedef scalar_t__ uint16_t;

/* Variables and functions */
uint16_t scale_fade(uint8_t step, uint16_t value) {
  return (uint16_t)((((uint32_t)value) * step) / (100 - 1));
}


x86 assembly (clang, -O0):
<scale_fade>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
imul   -0x4(%rbp),%eax
mov    $0x63,%ecx
cltd
idiv   %ecx
cltq
pop    %rbp
ret

x86 assembly (clang, -O2):
<scale_fade>:
imul   %edi,%esi
movslq %esi,%rax
imul   $0xffffffffa57eb503,%rax,%rcx
shr    $0x20,%rcx
add    %ecx,%eax
mov    %eax,%ecx
shr    $0x1f,%ecx
sar    $0x6,%eax
add    %ecx,%eax
cltq
ret

LLVM IR (-O0):
define i64 @scale_fade(i32 %0, i64 %1) {
%3 = alloca i32
%4 = alloca i64
store i32 %0, i32* %3
store i64 %1, i64* %4
%5 = load i64, i64* %4
%6 = trunc i64 %5 to i32
%7 = load i32, i32* %3
%8 = mul nsw i32 %6, %7
%9 = sdiv i32 %8, 99
%10 = sext i32 %9 to i64
ret i64 %10
}

LLVM IR (-O2):
define i64 @scale_fade(i32 %0, i64 %1) {
%3 = trunc i64 %1 to i32
%4 = mul nsw i32 %3, %0
%5 = sdiv i32 %4, 99
%6 = sext i32 %5 to i64
ret i64 %6
}
int av_isspace(int c) {
  return c == ' ' || c == '\f' || c == '\n' || c == '\r' || c == '\t' ||
         c == '\v';
}


x86 assembly (clang, -O0):
<av_isspace>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    $0x1,%al
cmpl   $0x20,-0x4(%rbp)
mov    %al,-0x5(%rbp)
je     115c <av_isspace+0x5c>
mov    $0x1,%al
cmpl   $0xc,-0x4(%rbp)
mov    %al,-0x5(%rbp)
je     115c <av_isspace+0x5c>
mov    $0x1,%al
cmpl   $0xa,-0x4(%rbp)
mov    %al,-0x5(%rbp)
je     115c <av_isspace+0x5c>
mov    $0x1,%al
cmpl   $0xd,-0x4(%rbp)
mov    %al,-0x5(%rbp)
je     115c <av_isspace+0x5c>
mov    $0x1,%al
cmpl   $0x9,-0x4(%rbp)
mov    %al,-0x5(%rbp)
je     115c <av_isspace+0x5c>
cmpl   $0xb,-0x4(%rbp)
sete   %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @av_isspace(i32 %0) {
switch i32 %0, label %2 [
i32 32, label %5
i32 13, label %5
i32 12, label %5
i32 10, label %5
i32 9, label %5
]
2: ; preds = %1
%3 = icmp eq i32 %0, 11
%4 = zext i1 %3 to i32
br label %5
5: ; preds = %1, %1, %1, %1, %1, %2
%6 = phi i32 [ 1, %1 ], [ %4, %2 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ]
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ isspace(char);
int strlen(char *);
void rtrim(char *str) {
  char *s;
  s = str + strlen(str);
  while (--s >= str) {
    if (!isspace(*s))
      break;
    *s = 0;
  }
}


x86 assembly (clang, -O0):
<rtrim>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x10(%rbp)
cmp    -0x8(%rbp),%rax
jb     1189 <rtrim+0x69>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1040 <isspace@plt>
cmp    $0x0,%eax
jne    117d <rtrim+0x5d>
jmp    1189 <rtrim+0x69>
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
jmp    114d <rtrim+0x2d>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rtrim>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1030 <strlen@plt>
cltq
lea    (%r14,%rax,1),%rbx
add    $0xffffffffffffffff,%rbx
cmp    %r14,%rbx
jb     1158 <rtrim+0x38>
nopl   0x0(%rax,%rax,1)
movsbl (%rbx),%edi
call   1040 <isspace@plt>
test   %eax,%eax
je     1158 <rtrim+0x38>
movb   $0x0,(%rbx)
add    $0xffffffffffffffff,%rbx
cmp    %r14,%rbx
jae    1140 <rtrim+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define void @rtrim(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = sext i32 %2 to i64
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = getelementptr inbounds i8, i8* %4, i64 -1
%6 = icmp ult i8* %5, %0
br i1 %6, label %15, label %7
7: ; preds = %1, %12
%8 = phi i8* [ %13, %12 ], [ %5, %1 ]
%9 = load i8, i8* %8
%10 = tail call i32 @isspace(i8 signext %9)
%11 = icmp eq i32 %10, 0
br i1 %11, label %15, label %12
12: ; preds = %7
store i8 0, i8* %8
%13 = getelementptr inbounds i8, i8* %8, i64 -1
%14 = icmp ult i8* %13, %0
br i1 %14, label %15, label %7
15: ; preds = %12, %7, %1
ret void
}
int _Locale_mb_cur_max(struct _Locale_ctype *__DUMMY_PAR) { return 0; }


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

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

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

LLVM IR (-O2):
%struct._Locale_ctype = type opaque
define i32 @_Locale_mb_cur_max(%struct._Locale_ctype* nocapture readnone %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ store_nul_ws_ptr_(int *, double *);
void nullify_ws_(int *ws) {
  double *nul_ptr;
  nul_ptr = (double *)NULL;
  store_nul_ws_ptr_(ws, nul_ptr);
  return;
}


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

x86 assembly (clang, -O2):
<nullify_ws_>:
xor    %esi,%esi
jmp    1030 <store_nul_ws_ptr_@plt>

LLVM IR (-O0):
define void @nullify_ws_(i32* %0) {
%2 = alloca i32*
%3 = alloca double*
store i32* %0, i32** %2
store double* null, double** %3
%4 = load i32*, i32** %2
%5 = load double*, double** %3
%6 = call i32 @store_nul_ws_ptr_(i32* %4, double* %5)
ret void
}

LLVM IR (-O2):
define void @nullify_ws_(i32* %0) {
%2 = tail call i32 @store_nul_ws_ptr_(i32* %0, double* null)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ set_ptr_param_array(int *);
void set_ptr_param_array_get_ptr_ok() {
  int x = 0;
  int *p = 0;
  if (!set_ptr_param_array(&x))
    *p = 42;
}


x86 assembly (clang, -O0):
<set_ptr_param_array_get_ptr_ok>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
lea    -0x4(%rbp),%rdi
call   1030 <set_ptr_param_array@plt>
cmp    $0x0,%eax
jne    1143 <set_ptr_param_array_get_ptr_ok+0x33>
mov    -0x10(%rbp),%rax
movl   $0x2a,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_ptr_param_array_get_ptr_ok>:
push   %rax
movl   $0x0,0x4(%rsp)
lea    0x4(%rsp),%rdi
call   1030 <set_ptr_param_array@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @set_ptr_param_array_get_ptr_ok() {
%1 = alloca i32
%2 = alloca i32*
store i32 0, i32* %1
store i32* null, i32** %2
%3 = call i32 @set_ptr_param_array(i32* %1)
%4 = icmp ne i32 %3, 0
br i1 %4, label %7, label %5
5: ; preds = %0
%6 = load i32*, i32** %2
store i32 42, i32* %6
br label %7
7: ; preds = %5, %0
ret void
}

LLVM IR (-O2):
define void @set_ptr_param_array_get_ptr_ok() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%3 = call i32 @set_ptr_param_array(i32* %1)
%4 = icmp ne i32 %3, 0
ret void
}
/* Variables and functions */
long evalfrom();
scalar_t__ test(char *);
long evalfields() {
  long val;
  val = evalfrom();
  for (val = evalfrom(); test("from");) {
    if (evalfrom() != 0)
      val = 1;
  }
  return (val);
}


x86 assembly (clang, -O0):
<evalfields>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <evalfrom@plt>
mov    %rax,-0x8(%rbp)
mov    $0x0,%al
call   1030 <evalfrom@plt>
mov    %rax,-0x8(%rbp)
lea    0xebb(%rip),%rdi
call   1040 <test@plt>
cmp    $0x0,%rax
je     1172 <evalfields+0x52>
mov    $0x0,%al
call   1030 <evalfrom@plt>
cmp    $0x0,%rax
je     116d <evalfields+0x4d>
movq   $0x1,-0x8(%rbp)
jmp    113e <evalfields+0x1e>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<evalfields>:
push   %r15
push   %r14
push   %rbx
xor    %eax,%eax
call   1030 <evalfrom@plt>
xor    %eax,%eax
call   1030 <evalfrom@plt>
mov    %rax,%rbx
lea    0xec3(%rip),%rdi
call   1040 <test@plt>
test   %rax,%rax
je     117b <evalfields+0x5b>
mov    $0x1,%r15d
lea    0xeac(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xor    %eax,%eax
call   1030 <evalfrom@plt>
test   %rax,%rax
cmovne %r15,%rbx
mov    %r14,%rdi
call   1040 <test@plt>
test   %rax,%rax
jne    1160 <evalfields+0x40>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [5 x i8] c"from\00"
define i64 @evalfields() {
%1 = alloca i64
%2 = call i64 (...) @evalfrom()
store i64 %2, i64* %1
%3 = call i64 (...) @evalfrom()
store i64 %3, i64* %1
br label %4
4: ; preds = %11, %0
%5 = call i64 @test(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%6 = icmp ne i64 %5, 0
br i1 %6, label %7, label %12
7: ; preds = %4
%8 = call i64 (...) @evalfrom()
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %7
store i64 1, i64* %1
br label %11
11: ; preds = %10, %7
br label %4
12: ; preds = %4
%13 = load i64, i64* %1
ret i64 %13
}

LLVM IR (-O2):
@.str = [5 x i8] c"from\00"
define i64 @evalfields() {
%1 = tail call i64 (...) @evalfrom()
%2 = tail call i64 (...) @evalfrom()
%3 = tail call i64 @test(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i64 %3, 0
br i1 %4, label %12, label %5
5: ; preds = %0, %5
%6 = phi i64 [ %9, %5 ], [ %2, %0 ]
%7 = tail call i64 (...) @evalfrom()
%8 = icmp eq i64 %7, 0
%9 = select i1 %8, i64 %6, i64 1
%10 = tail call i64 @test(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %5
12: ; preds = %5, %0
%13 = phi i64 [ %2, %0 ], [ %9, %5 ]
ret i64 %13
}
/* Type definitions */
typedef int /*<<< orphan*/ v;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ system(char *);
int main() {
  int v[3] = {2, 1, 0};
  printf("%i\n", v[3]);
  printf("%i\n\n", sizeof(v));
  system("pause");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xec8(%rip),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%esi
lea    0xebf(%rip),%rdi
call   1040 <printf@plt>
lea    0xeb7(%rip),%rdi
mov    $0xc,%esi
call   1040 <printf@plt>
lea    0xeab(%rip),%rdi
call   1030 <system@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
call   1040 <printf@plt>
lea    0xed0(%rip),%rdi
mov    $0xc,%esi
call   1040 <printf@plt>
lea    0xec4(%rip),%rdi
call   1030 <system@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@__const.main.v = [3 x i32] [i32 2, i32 1, i32 0]
@.str = [4 x i8] c"%i\0A\00"
@.str.1 = [5 x i8] c"%i\0A\0A\00"
@.str.2 = [6 x i8] c"pause\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [3 x i32]
store i32 0, i32* %1
%3 = bitcast [3 x i32]* %2 to i8*
%4 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 3
%5 = load i32, i32* %4
%6 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 12)
%8 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%i\0A\00"
@.str.1 = [5 x i8] c"%i\0A\0A\00"
@.str.2 = [6 x i8] c"pause\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 poison)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 12)
%3 = tail call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ rot13(char *);
int main(void) {
  char s[] = "hello world";
  rot13(s);
  printf("Encrypted string: %s\n", s);
  rot13(s);
  printf("Original string: %s\n", s);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0xed1(%rip),%rax
mov    %rax,-0xc(%rbp)
mov    0xecf(%rip),%eax
mov    %eax,-0x4(%rbp)
lea    -0xc(%rbp),%rdi
call   1030 <rot13@plt>
lea    -0xc(%rbp),%rsi
lea    0xebc(%rip),%rdi
call   1040 <printf@plt>
lea    -0xc(%rbp),%rdi
call   1030 <rot13@plt>
lea    -0xc(%rbp),%rsi
lea    0xeb9(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movabs $0x6f77206f6c6c6568,%rax
20 77 6f
mov    %rax,(%rsp)
movl   $0x646c72,0x8(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1030 <rot13@plt>
lea    0xebf(%rip),%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1030 <rot13@plt>
lea    0xebe(%rip),%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.s = [12 x i8] c"hello world\00"
@.str = [22 x i8] c"Encrypted string: %s\0A\00"
@.str.1 = [21 x i8] c"Original string: %s\0A\00"
define i32 @main() {
%1 = alloca [12 x i8]
%2 = bitcast [12 x i8]* %1 to i8*
%3 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 0
%4 = call i32 @rot13(i8* %3)
%5 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 0
%6 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 0
%8 = call i32 @rot13(i8* %7)
%9 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 0
%10 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i8* %9)
ret i32 0
}

LLVM IR (-O2):
@__const.main.s = [12 x i8] c"hello world\00"
@.str = [22 x i8] c"Encrypted string: %s\0A\00"
@.str.1 = [21 x i8] c"Original string: %s\0A\00"
define i32 @main() {
%1 = alloca [12 x i8]
%2 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 0
%3 = call i32 @rot13(i8* %2)
%4 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %2)
%5 = call i32 @rot13(i8* %2)
%6 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i8* %2)
ret i32 0
}
int toCelsius(int fahr) { return 5 * (fahr - 32) / 9; }


x86 assembly (clang, -O0):
<toCelsius>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sub    $0x20,%eax
imul   $0x5,%eax,%eax
mov    $0x9,%ecx
cltd
idiv   %ecx
pop    %rbp
ret

x86 assembly (clang, -O2):
<toCelsius>:
lea    (%rdi,%rdi,4),%eax
add    $0xffffff60,%eax
cltq
imul   $0x38e38e39,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x21,%rax
add    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @toCelsius(i32 %0) {
%2 = mul i32 %0, 5
%3 = add i32 %2, -160
%4 = sdiv i32 %3, 9
ret i32 %4
}
int main() {
  __complex__ float a, b;
  __real__ a = 9;
  __imag__ a = 42;
  b = bar(a);
  if (a != b)
    abort();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x41100000,-0x10(%rbp)
movl   $0x42280000,-0xc(%rbp)
movss  -0x10(%rbp),%xmm1
movss  -0xc(%rbp),%xmm0
movss  %xmm1,-0x20(%rbp)
movss  %xmm0,-0x1c(%rbp)
movsd  -0x20(%rbp),%xmm0
mov    $0x1,%al
call   1040 <bar@plt>
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x18(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x10(%rbp),%xmm2
movss  -0xc(%rbp),%xmm0
movss  -0x18(%rbp),%xmm3
movss  -0x14(%rbp),%xmm1
ucomiss %xmm3,%xmm2
setne  %al
setp   %cl
or     %cl,%al
ucomiss %xmm1,%xmm0
setne  %cl
setp   %dl
or     %dl,%cl
or     %cl,%al
test   $0x1,%al
jne    11a7 <main+0x87>
jmp    11ac <main+0x8c>
call   1030 <abort@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movaps 0xed8(%rip),%xmm0
mov    $0x1,%al
call   1040 <bar@plt>
call   1030 <abort@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca { float, float }
%3 = alloca { float, float }
%4 = alloca { float, float }
store i32 0, i32* %1
%5 = getelementptr inbounds { float, float }, { float, float }* %2, i32 0, i32 0
store float 9.000000e+00, float* %5
%6 = getelementptr inbounds { float, float }, { float, float }* %2, i32 0, i32 1
store float 4.200000e+01, float* %6
%7 = getelementptr inbounds { float, float }, { float, float }* %2, i32 0, i32 0
%8 = load float, float* %7
%9 = getelementptr inbounds { float, float }, { float, float }* %2, i32 0, i32 1
%10 = load float, float* %9
%11 = getelementptr inbounds { float, float }, { float, float }* %4, i32 0, i32 0
%12 = getelementptr inbounds { float, float }, { float, float }* %4, i32 0, i32 1
store float %8, float* %11
store float %10, float* %12
%13 = bitcast { float, float }* %4 to <2 x float>*
%14 = load <2 x float>, <2 x float>* %13
%15 = call i32 (<2 x float>, ...) bitcast (i32 (...)* @bar to i32 (<2 x float>, ...)*)(<2 x float> %14)
%16 = sitofp i32 %15 to float
%17 = getelementptr inbounds { float, float }, { float, float }* %3, i32 0, i32 0
%18 = getelementptr inbounds { float, float }, { float, float }* %3, i32 0, i32 1
store float %16, float* %17
store float 0.000000e+00, float* %18
%19 = getelementptr inbounds { float, float }, { float, float }* %2, i32 0, i32 0
%20 = load float, float* %19
%21 = getelementptr inbounds { float, float }, { float, float }* %2, i32 0, i32 1
%22 = load float, float* %21
%23 = getelementptr inbounds { float, float }, { float, float }* %3, i32 0, i32 0
%24 = load float, float* %23
%25 = getelementptr inbounds { float, float }, { float, float }* %3, i32 0, i32 1
%26 = load float, float* %25
%27 = fcmp une float %20, %24
%28 = fcmp une float %22, %26
%29 = or i1 %27, %28
br i1 %29, label %30, label %31
30: ; preds = %0
unreachable
31: ; preds = %0
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (<2 x float>, ...) bitcast (i32 (...)* @bar to i32 (<2 x float>, ...)*)(<2 x float> <float 9.000000e+00, float 4.200000e+01>)
tail call void @abort()
unreachable
}
/* Variables and functions */
scalar_t__ shim_enosys(int /*<<< orphan*/, int);
int shim_userfaultfd(int flags) { return (int)shim_enosys(0, flags); }


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

x86 assembly (clang, -O2):
<shim_userfaultfd>:
mov    %edi,%esi
xor    %edi,%edi
jmp    1030 <shim_enosys@plt>

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

LLVM IR (-O2):
define i32 @shim_userfaultfd(i32 %0) {
%2 = tail call i64 @shim_enosys(i32 0, i32 %0)
%3 = trunc i64 %2 to i32
ret i32 %3
}
/* Type definitions */
struct stat {
  int /*<<< orphan*/ st_mode;
};

/* Variables and functions */
scalar_t__ S_ISREG(int /*<<< orphan*/);
int child_stat(char const *, char const *, struct stat *);
int has_child_file(const char *base, const char *child) {
  int result = 0;
  int status;
  struct stat sb;
  status = child_stat(base, child, &sb);
  if ((status >= 0) && S_ISREG(sb.st_mode)) {
    result = 1;
  }
  return result;
}


x86 assembly (clang, -O0):
<has_child_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    -0x20(%rbp),%rdx
call   1040 <child_stat@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jl     116e <has_child_file+0x4e>
mov    -0x20(%rbp),%edi
call   1030 <S_ISREG@plt>
cmp    $0x0,%rax
je     116e <has_child_file+0x4e>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<has_child_file>:
push   %rax
mov    %rsp,%rdx
call   1040 <child_stat@plt>
test   %eax,%eax
js     1142 <has_child_file+0x22>
mov    (%rsp),%edi
call   1030 <S_ISREG@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
setne  %al
pop    %rcx
ret
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
%struct.stat = type { i32 }
define i32 @has_child_file(i8* %0, i8* %1) {
%3 = alloca %struct.stat
%4 = bitcast %struct.stat* %3 to i8*
%5 = call i32 @child_stat(i8* %0, i8* %1, %struct.stat* %3)
%6 = icmp sgt i32 %5, -1
br i1 %6, label %7, label %13
7: ; preds = %2
%8 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 0
%9 = load i32, i32* %8
%10 = call i64 @S_ISREG(i32 %9)
%11 = icmp ne i64 %10, 0
%12 = zext i1 %11 to i32
br label %13
13: ; preds = %7, %2
%14 = phi i32 [ 0, %2 ], [ %12, %7 ]
ret i32 %14
}
unsigned int popcount64(unsigned long long x) {
  x = (x & 0x5555555555555555ULL) + ((x >> 1) & 0x5555555555555555ULL);
  x = (x & 0x3333333333333333ULL) + ((x >> 2) & 0x3333333333333333ULL);
  x = (x & 0x0F0F0F0F0F0F0F0FULL) + ((x >> 4) & 0x0F0F0F0F0F0F0F0FULL);
  return (x * 0x0101010101010101ULL) >> 56;
}


x86 assembly (clang, -O0):
<popcount64>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movabs $0x5555555555555555,%rax
55 55 55
and    -0x8(%rbp),%rax
mov    -0x8(%rbp),%rcx
shr    $0x1,%rcx
movabs $0x5555555555555555,%rdx
55 55 55
and    %rdx,%rcx
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
movabs $0x3333333333333333,%rax
33 33 33
and    -0x8(%rbp),%rax
mov    -0x8(%rbp),%rcx
shr    $0x2,%rcx
movabs $0x3333333333333333,%rdx
33 33 33
and    %rdx,%rcx
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
movabs $0xf0f0f0f0f0f0f0f,%rax
0f 0f 0f
and    -0x8(%rbp),%rax
mov    -0x8(%rbp),%rcx
shr    $0x4,%rcx
movabs $0xf0f0f0f0f0f0f0f,%rdx
0f 0f 0f
and    %rdx,%rcx
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
movabs $0x101010101010101,%rax
01 01 01
imul   -0x8(%rbp),%rax
shr    $0x38,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<popcount64>:
movabs $0x5555555555555555,%rcx
55 55 55
mov    %rdi,%rax
and    %rcx,%rax
shr    %rdi
and    %rdi,%rcx
add    %rax,%rcx
movabs $0x3333333333333333,%rax
33 33 33
mov    %rcx,%rdx
and    %rax,%rdx
shr    $0x2,%rcx
and    %rax,%rcx
add    %rdx,%rcx
movabs $0x707070707070707,%rax
07 07 07
mov    %rcx,%rdx
and    %rax,%rdx
shr    $0x4,%rcx
and    %rax,%rcx
add    %rdx,%rcx
movabs $0x101010101010101,%rax
01 01 01
imul   %rcx,%rax
shr    $0x38,%rax
ret

LLVM IR (-O0):
define i32 @popcount64(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = and i64 %3, 6148914691236517205
%5 = load i64, i64* %2
%6 = lshr i64 %5, 1
%7 = and i64 %6, 6148914691236517205
%8 = add i64 %4, %7
store i64 %8, i64* %2
%9 = load i64, i64* %2
%10 = and i64 %9, 3689348814741910323
%11 = load i64, i64* %2
%12 = lshr i64 %11, 2
%13 = and i64 %12, 3689348814741910323
%14 = add i64 %10, %13
store i64 %14, i64* %2
%15 = load i64, i64* %2
%16 = and i64 %15, 1085102592571150095
%17 = load i64, i64* %2
%18 = lshr i64 %17, 4
%19 = and i64 %18, 1085102592571150095
%20 = add i64 %16, %19
store i64 %20, i64* %2
%21 = load i64, i64* %2
%22 = mul i64 %21, 72340172838076673
%23 = lshr i64 %22, 56
%24 = trunc i64 %23 to i32
ret i32 %24
}

LLVM IR (-O2):
define i32 @popcount64(i64 %0) {
%2 = and i64 %0, 6148914691236517205
%3 = lshr i64 %0, 1
%4 = and i64 %3, 6148914691236517205
%5 = add nuw i64 %4, %2
%6 = and i64 %5, 3689348814741910323
%7 = lshr i64 %5, 2
%8 = and i64 %7, 3689348814741910323
%9 = add nuw nsw i64 %8, %6
%10 = and i64 %9, 506381209866536711
%11 = lshr i64 %9, 4
%12 = and i64 %11, 506381209866536711
%13 = add nuw nsw i64 %12, %10
%14 = mul i64 %13, 72340172838076673
%15 = lshr i64 %14, 56
%16 = trunc i64 %15 to i32
ret i32 %16
}
void log_debug1(const char *msg __attribute__((unused)), ...) {}


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

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

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

LLVM IR (-O2):
define void @log_debug1(i8* nocapture %0, ...) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ cng_put_pixel(int, int);
int Affiche7(int x, int y) { cng_put_pixel(y, -x); }


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

x86 assembly (clang, -O2):
<Affiche7>:
mov    %edi,%eax
neg    %eax
mov    %esi,%edi
mov    %eax,%esi
jmp    1030 <cng_put_pixel@plt>

LLVM IR (-O0):
define i32 @Affiche7(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%6 = load i32, i32* %5
%7 = load i32, i32* %4
%8 = sub nsw i32 0, %7
%9 = call i32 @cng_put_pixel(i32 %6, i32 %8)
%10 = load i32, i32* %3
ret i32 %10
}

LLVM IR (-O2):
define i32 @Affiche7(i32 %0, i32 %1) {
%3 = sub nsw i32 0, %0
%4 = tail call i32 @cng_put_pixel(i32 %1, i32 %3)
ret i32 undef
}
/* Variables and functions */
int foo(int, int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  printf("%d\n", foo(20, 13));
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 @foo(i32 20, i32 13)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}
unsigned long copy_ptea_attributes(unsigned long x) {
  return ((x >> 28) & 0xe) | (x & 0x1);
}


x86 assembly (clang, -O0):
<copy_ptea_attributes>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
shr    $0x1c,%rax
and    $0xe,%rax
mov    -0x8(%rbp),%rcx
and    $0x1,%rcx
or     %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<copy_ptea_attributes>:
mov    %rdi,%rax
shr    $0x1c,%rax
and    $0xe,%eax
and    $0x1,%edi
or     %rdi,%rax
ret

LLVM IR (-O0):
define i64 @copy_ptea_attributes(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = lshr i64 %3, 28
%5 = and i64 %4, 14
%6 = load i64, i64* %2
%7 = and i64 %6, 1
%8 = or i64 %5, %7
ret i64 %8
}

LLVM IR (-O2):
define i64 @copy_ptea_attributes(i64 %0) {
%2 = lshr i64 %0, 28
%3 = and i64 %2, 14
%4 = and i64 %0, 1
%5 = or i64 %3, %4
ret i64 %5
}
void initialiseStatesAndConstants(double *states, double *variables) {
  variables[0] = 1.0;
  states[0] = 1.0;
  states[1] = 1.0;
}


x86 assembly (clang, -O0):
<initialiseStatesAndConstants>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsd  0xee8(%rip),%xmm0
movsd  %xmm0,(%rax)
mov    -0x8(%rbp),%rax
movsd  0xed8(%rip),%xmm0
movsd  %xmm0,(%rax)
mov    -0x8(%rbp),%rax
movsd  0xec8(%rip),%xmm0
movsd  %xmm0,0x8(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<initialiseStatesAndConstants>:
movabs $0x3ff0000000000000,%rax
mov    %rax,(%rsi)
movaps 0xeec(%rip),%xmm0
movups %xmm0,(%rdi)
ret

LLVM IR (-O0):
define void @initialiseStatesAndConstants(double* %0, double* %1) {
%3 = alloca double*
%4 = alloca double*
store double* %0, double** %3
store double* %1, double** %4
%5 = load double*, double** %4
%6 = getelementptr inbounds double, double* %5, i64 0
store double 1.000000e+00, double* %6
%7 = load double*, double** %3
%8 = getelementptr inbounds double, double* %7, i64 0
store double 1.000000e+00, double* %8
%9 = load double*, double** %3
%10 = getelementptr inbounds double, double* %9, i64 1
store double 1.000000e+00, double* %10
ret void
}

LLVM IR (-O2):
define void @initialiseStatesAndConstants(double* nocapture writeonly %0, double* nocapture writeonly %1) {
store double 1.000000e+00, double* %1
%3 = bitcast double* %0 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %3
ret void
}
void DebugDeadLoop(void) {
  for (;;)
    ;
}


x86 assembly (clang, -O0):
<DebugDeadLoop>:
push   %rbp
mov    %rsp,%rbp
jmp    1109 <DebugDeadLoop+0x9>
jmp    1109 <DebugDeadLoop+0x9>

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

LLVM IR (-O0):
define void @DebugDeadLoop() {
br label %1
1: ; preds = %1, %0
br label %1
}

LLVM IR (-O2):
define void @DebugDeadLoop() {
br label %1
1: ; preds = %1, %0
br label %1
}