xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ LOG_DAEMON;
int LOG_NOWAIT;
int LOG_PID;
int /*<<< orphan*/ openlog(char *, int, int /*<<< orphan*/);
void log_backend_syslog_open(void) {
  openlog("tox-bootstrapd", LOG_NOWAIT | LOG_PID, LOG_DAEMON);
}


x86 assembly (clang, -O0):
<log_backend_syslog_open>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%esi
mov    0x2eb4(%rip),%rax
or     (%rax),%esi
mov    0x2ebb(%rip),%rax
mov    (%rax),%edx
lea    0xeca(%rip),%rdi
call   1030 <openlog@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<log_backend_syslog_open>:
mov    0x2eb9(%rip),%rax
mov    0x2eba(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
mov    0x2ebf(%rip),%rax
mov    (%rax),%edx
lea    0xece(%rip),%rdi
jmp    1030 <openlog@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"tox-bootstrapd\00"
@LOG_NOWAIT = global i32 0
@LOG_PID = global i32 0
@LOG_DAEMON = global i32 0
define void @log_backend_syslog_open() {
%1 = load i32, i32* @LOG_NOWAIT
%2 = load i32, i32* @LOG_PID
%3 = or i32 %1, %2
%4 = load i32, i32* @LOG_DAEMON
%5 = call i32 @openlog(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %3, i32 %4)
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"tox-bootstrapd\00"
@LOG_NOWAIT = global i32 0
@LOG_PID = global i32 0
@LOG_DAEMON = global i32 0
define void @log_backend_syslog_open() {
%1 = load i32, i32* @LOG_NOWAIT
%2 = load i32, i32* @LOG_PID
%3 = or i32 %2, %1
%4 = load i32, i32* @LOG_DAEMON
%5 = tail call i32 @openlog(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %3, i32 %4)
ret void
}
void jump_PC(int *PC, unsigned int new_address) { *PC = 32 + new_address; }


x86 assembly (clang, -O0):
<jump_PC>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
add    $0x20,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<jump_PC>:
add    $0x20,%esi
mov    %esi,(%rdi)
ret

LLVM IR (-O0):
define void @jump_PC(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = add i32 32, %5
%7 = load i32*, i32** %3
store i32 %6, i32* %7
ret void
}

LLVM IR (-O2):
define void @jump_PC(i32* nocapture writeonly %0, i32 %1) {
%3 = add i32 %1, 32
store i32 %3, i32* %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ mtspr(int, unsigned long);
unsigned long int clear_ttcr() {
  unsigned long int ttcr = 0;
  (mtspr(((10 << (11)) + 1), ttcr));
  return ttcr;
}


x86 assembly (clang, -O0):
<clear_ttcr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
mov    $0x5001,%edi
call   1030 <mtspr@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clear_ttcr>:
push   %rax
mov    $0x5001,%edi
xor    %esi,%esi
call   1030 <mtspr@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i64 @clear_ttcr() {
%1 = alloca i64
store i64 0, i64* %1
%2 = load i64, i64* %1
%3 = call i32 @mtspr(i32 20481, i64 %2)
%4 = load i64, i64* %1
ret i64 %4
}

LLVM IR (-O2):
define i64 @clear_ttcr() {
%1 = tail call i32 @mtspr(i32 20481, i64 0)
ret i64 0
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_mutex_t;

/* Variables and functions */
int pthread_mutex_lock(int /*<<< orphan*/ *);
int ST_lock(pthread_mutex_t *l) { return pthread_mutex_lock(l); }


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

x86 assembly (clang, -O2):
<ST_lock>:
jmp    1030 <pthread_mutex_lock@plt>

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

LLVM IR (-O2):
define i32 @ST_lock(i32* %0) {
%2 = tail call i32 @pthread_mutex_lock(i32* %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ puts(char const *);
void invoke(const char *name) { puts(name); }


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

x86 assembly (clang, -O2):
<invoke>:
jmp    1030 <puts@plt>

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

LLVM IR (-O2):
define void @invoke(i8* nocapture %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) %0)
ret void
}
void gui_term_set_eat_newline_glitch(int value) { (void)value; }


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

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

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

LLVM IR (-O2):
define void @gui_term_set_eat_newline_glitch(i32 %0) {
ret void
}
char randomColor(int i) {
  if (i % 3 == 0)
    return 'b';
  if (i % 3 == 1)
    return 'g';
  if (i % 3 == 2)
    return 'r';
  return 'g';
}


x86 assembly (clang, -O0):
<randomColor>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1124 <randomColor+0x24>
movb   $0x62,-0x1(%rbp)
jmp    1162 <randomColor+0x62>
mov    -0x8(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
cmp    $0x1,%edx
jne    1141 <randomColor+0x41>
movb   $0x67,-0x1(%rbp)
jmp    1162 <randomColor+0x62>
mov    -0x8(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
cmp    $0x2,%edx
jne    115e <randomColor+0x5e>
movb   $0x72,-0x1(%rbp)
jmp    1162 <randomColor+0x62>
movb   $0x67,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<randomColor>:
movslq %edi,%rax
imul   $0x55555556,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x20,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,2),%ecx
sub    %ecx,%eax
lea    0x0(,%rax,8),%ecx
mov    $0x726762,%edx
shr    %cl,%edx
cmp    $0x3,%eax
mov    $0x67,%eax
cmovb  %edx,%eax
ret

LLVM IR (-O0):
define signext i8 @randomColor(i32 %0) {
%2 = alloca i8
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = srem i32 %4, 3
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %1
store i8 98, i8* %2
br label %19
8: ; preds = %1
%9 = load i32, i32* %3
%10 = srem i32 %9, 3
%11 = icmp eq i32 %10, 1
br i1 %11, label %12, label %13
12: ; preds = %8
store i8 103, i8* %2
br label %19
13: ; preds = %8
%14 = load i32, i32* %3
%15 = srem i32 %14, 3
%16 = icmp eq i32 %15, 2
br i1 %16, label %17, label %18
17: ; preds = %13
store i8 114, i8* %2
br label %19
18: ; preds = %13
store i8 103, i8* %2
br label %19
19: ; preds = %18, %17, %12, %7
%20 = load i8, i8* %2
ret i8 %20
}

LLVM IR (-O2):
define signext i8 @randomColor(i32 %0) {
%2 = srem i32 %0, 3
%3 = icmp ult i32 %2, 3
%4 = trunc i32 %2 to i24
%5 = shl i24 %4, 3
%6 = lshr i24 7497570, %5
%7 = trunc i24 %6 to i8
%8 = select i1 %3, i8 %7, i8 103
ret i8 %8
}
/* Type definitions */
struct option {
  int dummy;
};
struct _getopt_data {
  int dummy;
};

/* Variables and functions */
int _getopt_internal_r(int, char **, char const *, struct option const *, int *,
                       int, struct _getopt_data *, int /*<<< orphan*/);
int _getopt_long_only_r(int argc, char **argv, const char *options,
                        const struct option *long_options, int *opt_index,
                        struct _getopt_data *d) {
  return _getopt_internal_r(argc, argv, options, long_options, opt_index, 1, d,
                            0);
}


x86 assembly (clang, -O0):
<_getopt_long_only_r>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r8
mov    -0x30(%rbp),%rax
mov    $0x1,%r9d
xor    %r10d,%r10d
mov    %rax,(%rsp)
movl   $0x0,0x8(%rsp)
call   1030 <_getopt_internal_r@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_getopt_long_only_r>:
push   %rax
mov    %r9,%rax
mov    $0x1,%r9d
push   $0x0
push   %rax
call   1030 <_getopt_internal_r@plt>
add    $0x10,%rsp
pop    %rcx
ret

LLVM IR (-O0):
%struct.option = type { i32 }
%struct._getopt_data = type { i32 }
define i32 @_getopt_long_only_r(i32 %0, i8** %1, i8* %2, %struct.option* %3, i32* %4, %struct._getopt_data* %5) {
%7 = alloca i32
%8 = alloca i8**
%9 = alloca i8*
%10 = alloca %struct.option*
%11 = alloca i32*
%12 = alloca %struct._getopt_data*
store i32 %0, i32* %7
store i8** %1, i8*** %8
store i8* %2, i8** %9
store %struct.option* %3, %struct.option** %10
store i32* %4, i32** %11
store %struct._getopt_data* %5, %struct._getopt_data** %12
%13 = load i32, i32* %7
%14 = load i8**, i8*** %8
%15 = load i8*, i8** %9
%16 = load %struct.option*, %struct.option** %10
%17 = load i32*, i32** %11
%18 = load %struct._getopt_data*, %struct._getopt_data** %12
%19 = call i32 @_getopt_internal_r(i32 %13, i8** %14, i8* %15, %struct.option* %16, i32* %17, i32 1, %struct._getopt_data* %18, i32 0)
ret i32 %19
}

LLVM IR (-O2):
%struct.option = type { i32 }
%struct._getopt_data = type { i32 }
define i32 @_getopt_long_only_r(i32 %0, i8** %1, i8* %2, %struct.option* %3, i32* %4, %struct._getopt_data* %5) {
%7 = tail call i32 @_getopt_internal_r(i32 %0, i8** %1, i8* %2, %struct.option* %3, i32* %4, i32 1, %struct._getopt_data* %5, i32 0)
ret i32 %7
}
void numa_on_and_available() {}


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

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

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

LLVM IR (-O2):
define void @numa_on_and_available() {
ret void
}
/* Variables and functions */
int power(int, int);
int sum_pow(int n, int exp_n) {
  if (exp_n == 0)
    return 0;
  return power(n, exp_n) + sum_pow(n, exp_n - 1);
}


x86 assembly (clang, -O0):
<sum_pow>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    1144 <sum_pow+0x24>
movl   $0x0,-0x4(%rbp)
jmp    116a <sum_pow+0x4a>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1040 <power@plt>
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
sub    $0x1,%esi
call   1030 <sum_pow@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sum_pow>:
push   %rbp
push   %r14
push   %rbx
test   %esi,%esi
je     1133 <sum_pow+0x23>
mov    %esi,%ebx
mov    %edi,%r14d
xor    %ebp,%ebp
nop
mov    %r14d,%edi
mov    %ebx,%esi
call   1030 <power@plt>
add    %eax,%ebp
add    $0xffffffff,%ebx
jne    1120 <sum_pow+0x10>
jmp    1135 <sum_pow+0x25>
xor    %ebp,%ebp
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @sum_pow(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 = icmp eq i32 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %2
store i32 0, i32* %3
br label %18
9: ; preds = %2
%10 = load i32, i32* %4
%11 = load i32, i32* %5
%12 = call i32 @power(i32 %10, i32 %11)
%13 = load i32, i32* %4
%14 = load i32, i32* %5
%15 = sub nsw i32 %14, 1
%16 = call i32 @sum_pow(i32 %13, i32 %15)
%17 = add nsw i32 %12, %16
store i32 %17, i32* %3
br label %18
18: ; preds = %9, %8
%19 = load i32, i32* %3
ret i32 %19
}

LLVM IR (-O2):
define i32 @sum_pow(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %11, label %4
4: ; preds = %2, %4
%5 = phi i32 [ %8, %4 ], [ %1, %2 ]
%6 = phi i32 [ %9, %4 ], [ 0, %2 ]
%7 = tail call i32 @power(i32 %0, i32 %5)
%8 = add nsw i32 %5, -1
%9 = add nsw i32 %7, %6
%10 = icmp eq i32 %8, 0
br i1 %10, label %11, label %4
11: ; preds = %4, %2
%12 = phi i32 [ 0, %2 ], [ %9, %4 ]
ret i32 %12
}
/* Variables and functions */
size_t mangle_deserialize_get_size(size_t a_size) {
  size_t blks = (a_size / 4);
  return ((blks - 1) * 3);
}


x86 assembly (clang, -O0):
<mangle_deserialize_get_size>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
shr    $0x2,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
sub    $0x1,%rax
imul   $0x3,%rax,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mangle_deserialize_get_size>:
shr    $0x2,%rdi
lea    (%rdi,%rdi,2),%rax
add    $0xfffffffffffffffd,%rax
ret

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

LLVM IR (-O2):
define i64 @mangle_deserialize_get_size(i64 %0) {
%2 = lshr i64 %0, 2
%3 = mul nuw i64 %2, 3
%4 = add i64 %3, -3
ret i64 %4
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
void help(void) {
  printf("Usage: libreforge [OPTION...]\n\n");
  printf("Options:\n");
  printf("  -h, --help                 print this help text\n");
  printf("  -V, --version              print version information\n");
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<help>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
lea    0xee9(%rip),%rdi
call   1030 <printf@plt>
lea    0xee7(%rip),%rdi
call   1030 <printf@plt>
lea    0xf0e(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e85(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<help>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
lea    0xeeb(%rip),%rdi
call   1030 <puts@plt>
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
lea    0xf0e(%rip),%rdi
call   1030 <puts@plt>
mov    0x2e88(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [32 x i8] c"Usage: libreforge [OPTION...]\0A\0A\00"
@.str.1 = [10 x i8] c"Options:\0A\00"
@.str.2 = [51 x i8] c" -h, --help print this help text\0A\00"
@.str.3 = [56 x i8] c" -V, --version print version information\0A\00"
@EXIT_SUCCESS = global i32 0
define void @help() {
%1 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.2, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.3, i64 0, i64 0))
%5 = load i32, i32* @EXIT_SUCCESS
%6 = call i32 @exit(i32 %5)
unreachable
}

LLVM IR (-O2):
@EXIT_SUCCESS = global i32 0
@str = [31 x i8] c"Usage: libreforge [OPTION...]\0A\00"
@str.4 = [9 x i8] c"Options:\00"
@str.5 = [50 x i8] c" -h, --help print this help text\00"
@str.6 = [55 x i8] c" -V, --version print version information\00"
define void @help() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.4, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @str.5, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @str.6, i64 0, i64 0))
%5 = load i32, i32* @EXIT_SUCCESS
%6 = tail call i32 @exit(i32 %5)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main(void) {
  int aNumber;
  printf("Please enter a number: ");
  scanf("%d", &aNumber);
  printf("You enter %d", aNumber);
  getchar();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xece(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x8(%rbp),%esi
lea    0xeb1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xedc(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%esi
lea    0xebd(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [24 x i8] c"Please enter a number: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [13 x i8] c"You enter %d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 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 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %5)
%7 = call i32 (...) @getchar()
ret i32 0
}

LLVM IR (-O2):
@.str = [24 x i8] c"Please enter a number: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [13 x i8] c"You enter %d\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 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 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %5)
%7 = call i32 (...) @getchar()
ret i32 0
}
void event_playonrep(s) char *s;
{ emit_string_sprintf(" [%s", s); }


x86 assembly (clang, -O0):
<event_playonrep>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xed9(%rip),%rdi
mov    $0x0,%al
call   1030 <emit_string_sprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<event_playonrep>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
xor    %eax,%eax
jmp    1030 <emit_string_sprintf@plt>

LLVM IR (-O0):
@.str = [5 x i8] c" [%s\00"
define void @event_playonrep(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @emit_string_sprintf to i32 (i8*, i8*, ...)*)(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %3)
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c" [%s\00"
define void @event_playonrep(i8* %0) {
%2 = tail call i32 (i8*, i8*, ...) bitcast (i32 (...)* @emit_string_sprintf to i32 (i8*, i8*, ...)*)(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
void foo() {
  unsigned k;
  while (--k > 0)
    ;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x4(%rbp)
cmp    $0x0,%eax
jbe    111b <foo+0x1b>
jmp    1104 <foo+0x4>
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @foo() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ set_io_bit(int, int);
void TOSH_MAKE_RADIO_RESET_OUTPUT() { set_io_bit(-3, 2); }


x86 assembly (clang, -O0):
<TOSH_MAKE_RADIO_RESET_OUTPUT>:
push   %rbp
mov    %rsp,%rbp
mov    $0xfffffffd,%edi
mov    $0x2,%esi
call   1030 <set_io_bit@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<TOSH_MAKE_RADIO_RESET_OUTPUT>:
mov    $0xfffffffd,%edi
mov    $0x2,%esi
jmp    1030 <set_io_bit@plt>

LLVM IR (-O0):
define void @TOSH_MAKE_RADIO_RESET_OUTPUT() {
%1 = call i32 @set_io_bit(i32 -3, i32 2)
ret void
}

LLVM IR (-O2):
define void @TOSH_MAKE_RADIO_RESET_OUTPUT() {
%1 = tail call i32 @set_io_bit(i32 -3, i32 2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
void *realloc(void *, size_t);
int /*<<< orphan*/ stderr;
void *xrealloc(void *in, size_t size) {
  void *out;
  out = realloc(in, size);
  if (!out) {
    fprintf(stderr, "Out of memory\n");
    exit(1);
  }
  return out;
}


x86 assembly (clang, -O0):
<xrealloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <realloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    117b <xrealloc+0x4b>
mov    0x2e7d(%rip),%rax
mov    (%rax),%edi
lea    0xe94(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xrealloc>:
push   %rax
call   1040 <realloc@plt>
test   %rax,%rax
je     113d <xrealloc+0xd>
pop    %rcx
ret
mov    0x2e9c(%rip),%rax
mov    (%rax),%edi
lea    0xeb3(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [15 x i8] c"Out of memory\0A\00"
define i8* @xrealloc(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i8*
store i8* %0, i8** %3
store i64 %1, i64* %4
%6 = load i8*, i8** %3
%7 = load i64, i64* %4
%8 = call i8* @realloc(i8* %6, i64 %7)
store i8* %8, i8** %5
%9 = load i8*, i8** %5
%10 = icmp ne i8* %9, null
br i1 %10, label %15, label %11
11: ; preds = %2
%12 = load i32, i32* @stderr
%13 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%14 = call i32 @exit(i32 1)
unreachable
15: ; preds = %2
%16 = load i8*, i8** %5
ret i8* %16
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [15 x i8] c"Out of memory\0A\00"
define noalias i8* @xrealloc(i8* nocapture %0, i64 %1) {
%3 = tail call i8* @realloc(i8* %0, i64 %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %9
5: ; preds = %2
%6 = load i32, i32* @stderr
%7 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%8 = tail call i32 @exit(i32 1)
unreachable
9: ; preds = %2
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(void) {
  printf("cl_d3d11.h standalone test PASSED.\n");
  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 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [36 x i8] c"cl_d3d11.h standalone test PASSED.\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [35 x i8] c"cl_d3d11.h standalone test PASSED.\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str, i64 0, i64 0))
ret i32 0
}
int dxl_allows(char *typ, char *ps, char *s, int n) { return 0; }


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

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

LLVM IR (-O0):
define i32 @dxl_allows(i8* %0, i8* %1, i8* %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i32 %3, i32* %8
ret i32 0
}

LLVM IR (-O2):
define i32 @dxl_allows(i8* nocapture readnone %0, i8* nocapture readnone %1, i8* nocapture readnone %2, i32 %3) {
ret i32 0
}
int GetOutputLength(unsigned int lInputLong) {
  unsigned int lVal = lInputLong % 8;
  if (lVal != 0)
    return lInputLong + 8 - lVal;
  else
    return lInputLong;
}


x86 assembly (clang, -O0):
<GetOutputLength>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
and    $0x7,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     112b <GetOutputLength+0x2b>
mov    -0x8(%rbp),%eax
add    $0x8,%eax
sub    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1131 <GetOutputLength+0x31>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetOutputLength>:
lea    0x8(%rdi),%eax
and    $0xfffffff8,%eax
test   $0x7,%dil
cmove  %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @GetOutputLength(i32 %0) {
%2 = and i32 %0, 7
%3 = icmp eq i32 %2, 0
%4 = add i32 %0, 8
%5 = and i32 %4, -8
%6 = select i1 %3, i32 %0, i32 %5
ret i32 %6
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_rwlock_t;

/* Variables and functions */
scalar_t__ test_locking_reader(int /*<<< orphan*/ *);
scalar_t__ test_locking_writer(int /*<<< orphan*/ *);
int main(void) {
  pthread_rwlock_t rwlock;
  int result = 1;
  if (test_locking_reader(&rwlock) == 0 && test_locking_writer(&rwlock) == 0)
    result = 0;
  return result;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0xc(%rbp)
lea    -0x8(%rbp),%rdi
call   1030 <test_locking_reader@plt>
cmp    $0x0,%rax
jne    1163 <main+0x43>
lea    -0x8(%rbp),%rdi
call   1040 <test_locking_writer@plt>
cmp    $0x0,%rax
jne    1163 <main+0x43>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0x4(%rsp),%rdi
call   1030 <test_locking_reader@plt>
mov    %rax,%rcx
mov    $0x1,%eax
test   %rcx,%rcx
je     113a <main+0x1a>
pop    %rcx
ret
lea    0x4(%rsp),%rdi
call   1040 <test_locking_writer@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
setne  %al
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i64 @test_locking_reader(i32* %1)
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %9
5: ; preds = %0
%6 = call i64 @test_locking_writer(i32* %1)
%7 = icmp ne i64 %6, 0
%8 = zext i1 %7 to i32
br label %9
9: ; preds = %5, %0
%10 = phi i32 [ 1, %0 ], [ %8, %5 ]
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void usage() { printf("\nusage: touch (/path/to/NEW/FILE)\n\n"); }


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

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

LLVM IR (-O0):
@.str = [36 x i8] c"\0Ausage: touch (/path/to/NEW/FILE)\0A\0A\00"
define void @usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [35 x i8] c"\0Ausage: touch (/path/to/NEW/FILE)\0A\00"
define void @usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ _unsupported();
void _Unwind_RaiseException() { _unsupported(); }


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

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

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

LLVM IR (-O2):
define void @_Unwind_RaiseException() {
%1 = tail call i32 (...) @_unsupported()
ret void
}
/* Type definitions */
typedef unsigned long volatile uint32_t;

/* Variables and functions */
uint32_t AUXADCGetFifoStatus(void) {
  return (*((volatile unsigned long *)(0x400C9000 + 0x00000014)));
}


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

x86 assembly (clang, -O2):
<AUXADCGetFifoStatus>:
mov    0x400c9014,%rax
40
ret

LLVM IR (-O0):
define i64 @AUXADCGetFifoStatus() {
%1 = load volatile i64, i64* inttoptr (i64 1074565140 to i64*)
ret i64 %1
}

LLVM IR (-O2):
define i64 @AUXADCGetFifoStatus() {
%1 = load volatile i64, i64* inttoptr (i64 1074565140 to i64*)
ret i64 %1
}
int main(void) {
  printf("sizeof(short) = %zu\n", sizeof(short));
  printf("sizeof(int) = %zu\n", sizeof(int));
  printf("sizeof(float[10]) = %zu\n", sizeof(float[10]));
  printf("sizeof(struct{char c; int n;}) = %zu\n", sizeof(struct {
           char c;
           int n;
         }));
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeea(%rip),%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeea(%rip),%rdi
mov    $0x28,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xef0(%rip),%rdi
mov    $0x8,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [21 x i8] c"sizeof(short) = %zu\0A\00"
@.str.1 = [19 x i8] c"sizeof(int) = %zu\0A\00"
@.str.2 = [25 x i8] c"sizeof(float[10]) = %zu\0A\00"
@.str.3 = [38 x i8] c"sizeof(struct{char c; int n;}) = %zu\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i64 2)
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i64 4)
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i64 40)
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.3, i64 0, i64 0), i64 8)
ret i32 0
}

LLVM IR (-O2):
@.str = [21 x i8] c"sizeof(short) = %zu\0A\00"
@.str.1 = [19 x i8] c"sizeof(int) = %zu\0A\00"
@.str.2 = [25 x i8] c"sizeof(float[10]) = %zu\0A\00"
@.str.3 = [38 x i8] c"sizeof(struct{char c; int n;}) = %zu\0A\00"
define i32 @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i64 2)
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i64 4)
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i64 40)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.3, i64 0, i64 0), i64 8)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
double get_seconds_gettimeofday();
double gettimeofday_resolution() {
  double t0, t1;
  t0 = get_seconds_gettimeofday();
  while ((t1 = get_seconds_gettimeofday()) == t0)
    ;
  assert(t1 > t0);
  return t1 - t0;
}


x86 assembly (clang, -O0):
<gettimeofday_resolution>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <get_seconds_gettimeofday@plt>
movsd  %xmm0,-0x8(%rbp)
mov    $0x0,%al
call   1030 <get_seconds_gettimeofday@plt>
movsd  %xmm0,-0x10(%rbp)
ucomisd -0x8(%rbp),%xmm0
jne    1156 <gettimeofday_resolution+0x36>
jp     1156 <gettimeofday_resolution+0x36>
jmp    1134 <gettimeofday_resolution+0x14>
movsd  -0x10(%rbp),%xmm0
ucomisd -0x8(%rbp),%xmm0
seta   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
movsd  -0x10(%rbp),%xmm0
subsd  -0x8(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gettimeofday_resolution>:
sub    $0x18,%rsp
xor    %eax,%eax
call   1030 <get_seconds_gettimeofday@plt>
movsd  %xmm0,0x8(%rsp)
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <get_seconds_gettimeofday@plt>
ucomisd 0x8(%rsp),%xmm0
jne    1151 <gettimeofday_resolution+0x31>
jnp    1140 <gettimeofday_resolution+0x20>
seta   %al
movzbl %al,%edi
movsd  %xmm0,0x10(%rsp)
call   1040 <assert@plt>
movsd  0x10(%rsp),%xmm0
subsd  0x8(%rsp),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @gettimeofday_resolution() {
%1 = alloca double
%2 = alloca double
%3 = call double (...) @get_seconds_gettimeofday()
store double %3, double* %1
br label %4
4: ; preds = %8, %0
%5 = call double (...) @get_seconds_gettimeofday()
store double %5, double* %2
%6 = load double, double* %1
%7 = fcmp oeq double %5, %6
br i1 %7, label %8, label %9
8: ; preds = %4
br label %4
9: ; preds = %4
%10 = load double, double* %2
%11 = load double, double* %1
%12 = fcmp ogt double %10, %11
%13 = zext i1 %12 to i32
%14 = call i32 @assert(i32 %13)
%15 = load double, double* %2
%16 = load double, double* %1
%17 = fsub double %15, %16
ret double %17
}

LLVM IR (-O2):
define double @gettimeofday_resolution() {
%1 = tail call double (...) @get_seconds_gettimeofday()
br label %2
2: ; preds = %2, %0
%3 = tail call double (...) @get_seconds_gettimeofday()
%4 = fcmp oeq double %3, %1
br i1 %4, label %2, label %5
5: ; preds = %2
%6 = fcmp ogt double %3, %1
%7 = zext i1 %6 to i32
%8 = tail call i32 @assert(i32 %7)
%9 = fsub double %3, %1
ret double %9
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int _spi_transfer(int, int, int /*<<< orphan*/, int /*<<< orphan*/ *, size_t);
int spi_write_regs(int fd, uint8_t addr, const uint8_t *data, size_t len) {
  return _spi_transfer(fd, true, addr, (uint8_t *)data, len);
}


x86 assembly (clang, -O0):
<spi_write_regs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%edx
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%r8
mov    $0x1,%esi
call   1030 <_spi_transfer@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<spi_write_regs>:
mov    %rcx,%r8
mov    %rdx,%rcx
mov    %esi,%edx
mov    $0x1,%esi
jmp    1030 <_spi_transfer@plt>

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

LLVM IR (-O2):
define i32 @spi_write_regs(i32 %0, i32 %1, i32* %2, i64 %3) {
%5 = tail call i32 @_spi_transfer(i32 %0, i32 1, i32 %1, i32* %2, i64 %3)
ret i32 %5
}
/* Variables and functions */
int pathconN_nm10_f0(double const **, double **, int *, double *, int);
int pathconN_nm10(const double **arg, double **res, int *iw, double *w,
                  int mem) {
  return pathconN_nm10_f0(arg, res, iw, w, mem);
}


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

x86 assembly (clang, -O2):
<pathconN_nm10>:
jmp    1030 <pathconN_nm10_f0@plt>

LLVM IR (-O0):
define i32 @pathconN_nm10(double** %0, double** %1, i32* %2, double* %3, i32 %4) {
%6 = alloca double**
%7 = alloca double**
%8 = alloca i32*
%9 = alloca double*
%10 = alloca i32
store double** %0, double*** %6
store double** %1, double*** %7
store i32* %2, i32** %8
store double* %3, double** %9
store i32 %4, i32* %10
%11 = load double**, double*** %6
%12 = load double**, double*** %7
%13 = load i32*, i32** %8
%14 = load double*, double** %9
%15 = load i32, i32* %10
%16 = call i32 @pathconN_nm10_f0(double** %11, double** %12, i32* %13, double* %14, i32 %15)
ret i32 %16
}

LLVM IR (-O2):
define i32 @pathconN_nm10(double** %0, double** %1, i32* %2, double* %3, i32 %4) {
%6 = tail call i32 @pathconN_nm10_f0(double** %0, double** %1, i32* %2, double* %3, i32 %4)
ret i32 %6
}
__attribute__((always_)) void SCB_EnableDCache(void) {}


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

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

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

LLVM IR (-O2):
define void @SCB_EnableDCache() {
ret void
}
double piemathSubtract(double a, double b) { return a - b; }


x86 assembly (clang, -O0):
<piemathSubtract>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<piemathSubtract>:
subsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @piemathSubtract(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = load double, double* %4
%7 = fsub double %5, %6
ret double %7
}

LLVM IR (-O2):
define double @piemathSubtract(double %0, double %1) {
%3 = fsub double %0, %1
ret double %3
}
/* Variables and functions */
int remote_vsend(int, char *, char *);
int remote_sig_gui_msg(char *text) { return remote_vsend(2, "gui msg ", text); }


x86 assembly (clang, -O0):
<remote_sig_gui_msg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdx
mov    $0x2,%edi
lea    0xed4(%rip),%rsi
call   1030 <remote_vsend@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<remote_sig_gui_msg>:
mov    %rdi,%rdx
lea    0xee6(%rip),%rsi
mov    $0x2,%edi
jmp    1030 <remote_vsend@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"gui msg \00"
define i32 @remote_sig_gui_msg(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @remote_vsend(i32 2, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %3)
ret i32 %4
}

LLVM IR (-O2):
@.str = [9 x i8] c"gui msg \00"
define i32 @remote_sig_gui_msg(i8* %0) {
%2 = tail call i32 @remote_vsend(i32 2, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %0)
ret i32 %2
}
unsigned xrop3_98_1_0(unsigned char s, unsigned char t) {
  unsigned D = 0x00ff;
  unsigned S = ((unsigned)s << 8) | s;
  unsigned T = ((unsigned)t << 8) | t;
  unsigned stk1;
  unsigned stk2;
  unsigned stk3;
  stk3 = T | D;
  stk2 = S & stk3;
  stk1 = D ^ stk2;
  return (stk1 & (~S)) | (D & S);
}


x86 assembly (clang, -O0):
<xrop3_98_1_0>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movl   $0xff,-0x8(%rbp)
movzbl -0x1(%rbp),%eax
shl    $0x8,%eax
movzbl -0x1(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0xc(%rbp)
movzbl -0x2(%rbp),%eax
shl    $0x8,%eax
movzbl -0x2(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
or     -0x8(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0xc(%rbp),%eax
and    -0x1c(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%eax
xor    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0xc(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    -0x8(%rbp),%ecx
and    -0xc(%rbp),%ecx
or     %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @xrop3_98_1_0(i8 zeroext %0, i8 zeroext %1) {
%3 = alloca i8
%4 = alloca i8
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i8 %0, i8* %3
store i8 %1, i8* %4
store i32 255, i32* %5
%11 = load i8, i8* %3
%12 = zext i8 %11 to i32
%13 = shl i32 %12, 8
%14 = load i8, i8* %3
%15 = zext i8 %14 to i32
%16 = or i32 %13, %15
store i32 %16, i32* %6
%17 = load i8, i8* %4
%18 = zext i8 %17 to i32
%19 = shl i32 %18, 8
%20 = load i8, i8* %4
%21 = zext i8 %20 to i32
%22 = or i32 %19, %21
store i32 %22, i32* %7
%23 = load i32, i32* %7
%24 = load i32, i32* %5
%25 = or i32 %23, %24
store i32 %25, i32* %10
%26 = load i32, i32* %6
%27 = load i32, i32* %10
%28 = and i32 %26, %27
store i32 %28, i32* %9
%29 = load i32, i32* %5
%30 = load i32, i32* %9
%31 = xor i32 %29, %30
store i32 %31, i32* %8
%32 = load i32, i32* %8
%33 = load i32, i32* %6
%34 = xor i32 %33, -1
%35 = and i32 %32, %34
%36 = load i32, i32* %5
%37 = load i32, i32* %6
%38 = and i32 %36, %37
%39 = or i32 %35, %38
ret i32 %39
}

LLVM IR (-O2):
define i32 @xrop3_98_1_0(i8 zeroext %0, i8 zeroext %1) {
ret i32 255
}
int fun(char *a) {
  int sum = 0, tmp = 1;
  for (; *a; a++) {
    if (*a != ' ') {
      if (tmp == 1) {
        sum++;
        tmp = 0;
      }
    } else
      tmp = 1;
  }
  return sum;
}


x86 assembly (clang, -O0):
<fun>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x1,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     116f <fun+0x6f>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
je     1152 <fun+0x52>
cmpl   $0x1,-0x10(%rbp)
jne    114d <fun+0x4d>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
jmp    1159 <fun+0x59>
movl   $0x1,-0x10(%rbp)
jmp    115e <fun+0x5e>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1116 <fun+0x16>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fun>:
mov    $0x1,%ecx
xor    %eax,%eax
jmp    1119 <fun+0x19>
nopl   0x0(%rax)
mov    $0x1,%ecx
add    $0x1,%rdi
movzbl (%rdi),%edx
cmp    $0x20,%dl
je     1110 <fun+0x10>
test   %dl,%dl
je     1137 <fun+0x37>
xor    %edx,%edx
cmp    $0x1,%ecx
sete   %dl
add    %edx,%eax
xor    %ecx,%ecx
add    $0x1,%rdi
jmp    1119 <fun+0x19>
ret

LLVM IR (-O0):
define i32 @fun(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
store i32 1, i32* %4
br label %5
5: ; preds = %23, %1
%6 = load i8*, i8** %2
%7 = load i8, i8* %6
%8 = icmp ne i8 %7, 0
br i1 %8, label %9, label %26
9: ; preds = %5
%10 = load i8*, i8** %2
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = icmp ne i32 %12, 32
br i1 %13, label %14, label %21
14: ; preds = %9
%15 = load i32, i32* %4
%16 = icmp eq i32 %15, 1
br i1 %16, label %17, label %20
17: ; preds = %14
%18 = load i32, i32* %3
%19 = add nsw i32 %18, 1
store i32 %19, i32* %3
store i32 0, i32* %4
br label %20
20: ; preds = %17, %14
br label %22
21: ; preds = %9
store i32 1, i32* %4
br label %22
22: ; preds = %21, %20
br label %23
23: ; preds = %22
%24 = load i8*, i8** %2
%25 = getelementptr inbounds i8, i8* %24, i32 1
store i8* %25, i8** %2
br label %5
26: ; preds = %5
%27 = load i32, i32* %3
ret i32 %27
}

LLVM IR (-O2):
define i32 @fun(i8* nocapture %0) {
br label %2
2: ; preds = %11, %1
%3 = phi i8* [ %0, %1 ], [ %14, %11 ]
%4 = phi i32 [ 0, %1 ], [ %12, %11 ]
%5 = phi i32 [ 1, %1 ], [ %13, %11 ]
%6 = load i8, i8* %3
switch i8 %6, label %7 [
i8 0, label %15
i8 32, label %11
]
7: ; preds = %2
%8 = icmp eq i32 %5, 1
%9 = zext i1 %8 to i32
%10 = add nsw i32 %4, %9
br label %11
11: ; preds = %7, %2
%12 = phi i32 [ %10, %7 ], [ %4, %2 ]
%13 = phi i32 [ 0, %7 ], [ 1, %2 ]
%14 = getelementptr inbounds i8, i8* %3, i64 1
br label %2
15: ; preds = %2
ret i32 %4
}
__attribute__((weak)) void __dummy(void *x) {}


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

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

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

LLVM IR (-O2):
define weak void @__dummy(i8* %0) {
ret void
}
int max2int(int num1, int num2) {
  int result;
  if (num1 > num2)
    result = num1;
  else
    result = num2;
  return result;
}


x86 assembly (clang, -O0):
<max2int>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    1121 <max2int+0x21>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1127 <max2int+0x27>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<max2int>:
mov    %esi,%eax
cmp    %esi,%edi
cmovg  %edi,%eax
ret

LLVM IR (-O0):
define i32 @max2int(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 = icmp sgt i32 %6, %7
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = load i32, i32* %3
store i32 %10, i32* %5
br label %13
11: ; preds = %2
%12 = load i32, i32* %4
store i32 %12, i32* %5
br label %13
13: ; preds = %11, %9
%14 = load i32, i32* %5
ret i32 %14
}

LLVM IR (-O2):
define i32 @max2int(i32 %0, i32 %1) {
%3 = icmp sgt i32 %0, %1
%4 = select i1 %3, i32 %0, i32 %1
ret i32 %4
}
/* Type definitions */
struct timespec {
  scalar_t__ tv_nsec;
  scalar_t__ tv_sec;
};

/* Variables and functions */
double ts_sec(struct timespec a) {
  return ((double)a.tv_sec + (double)a.tv_nsec / 1000000000UL);
}


x86 assembly (clang, -O0):
<ts_sec>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x8(%rbp)
cvtsi2sdq -0x8(%rbp),%xmm0
cvtsi2sdq -0x10(%rbp),%xmm1
movsd  0xee0(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<ts_sec>:
cvtsi2sd %rsi,%xmm1
cvtsi2sd %rdi,%xmm0
divsd  0xeee(%rip),%xmm0
addsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
%struct.timespec = type { i64, i64 }
define double @ts_sec(i64 %0, i64 %1) {
%3 = alloca %struct.timespec
%4 = bitcast %struct.timespec* %3 to { i64, i64 }*
%5 = getelementptr inbounds { i64, i64 }, { i64, i64 }* %4, i32 0, i32 0
store i64 %0, i64* %5
%6 = getelementptr inbounds { i64, i64 }, { i64, i64 }* %4, i32 0, i32 1
store i64 %1, i64* %6
%7 = getelementptr inbounds %struct.timespec, %struct.timespec* %3, i32 0, i32 1
%8 = load i64, i64* %7
%9 = sitofp i64 %8 to double
%10 = getelementptr inbounds %struct.timespec, %struct.timespec* %3, i32 0, i32 0
%11 = load i64, i64* %10
%12 = sitofp i64 %11 to double
%13 = fdiv double %12, 1.000000e+09
%14 = fadd double %9, %13
ret double %14
}

LLVM IR (-O2):
define double @ts_sec(i64 %0, i64 %1) {
%3 = sitofp i64 %1 to double
%4 = sitofp i64 %0 to double
%5 = fdiv double %4, 1.000000e+09
%6 = fadd double %5, %3
ret double %6
}
/* Type definitions */
struct catmc_atomic_uintptr_t {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct catmc_atomic_uintptr_t *);
void catmc_atomic_uintptr_t_destroy(struct catmc_atomic_uintptr_t *wrapper) {
  free(wrapper);
}


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

x86 assembly (clang, -O2):
<catmc_atomic_uintptr_t_destroy>:
jmp    1030 <free@plt>

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

LLVM IR (-O2):
%struct.catmc_atomic_uintptr_t = type { i32 }
define void @catmc_atomic_uintptr_t_destroy(%struct.catmc_atomic_uintptr_t* nocapture %0) {
%2 = tail call i32 @free(%struct.catmc_atomic_uintptr_t* %0)
ret void
}