xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int /*<<< orphan*/ sigset_t;

/* Variables and functions */
int /*<<< orphan*/ sigemptyset(int /*<<< orphan*/ *);
int /*<<< orphan*/ sigsuspend(int /*<<< orphan*/ *);
pause() {
  sigset_t set;
  sigemptyset(&set);
  sigsuspend(&set);
}


x86 assembly (clang, -O0):
<pause>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x8(%rbp),%rdi
call   1030 <sigemptyset@plt>
lea    -0x8(%rbp),%rdi
call   1040 <sigsuspend@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pause>:
push   %rbx
sub    $0x10,%rsp
lea    0xc(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <sigemptyset@plt>
mov    %rbx,%rdi
call   1040 <sigsuspend@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @pause() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 @sigemptyset(i32* %2)
%4 = call i32 @sigsuspend(i32* %2)
%5 = load i32, i32* %1
ret i32 %5
}

LLVM IR (-O2):
define i32 @pause() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @sigemptyset(i32* %1)
%4 = call i32 @sigsuspend(i32* %1)
ret i32 undef
}
int get_gcd(int m, int n) {
  int q;
  while (n) {
    q = n;
    n = m % n;
    m = q;
  }
  return m;
}


x86 assembly (clang, -O0):
<get_gcd>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     112f <get_gcd+0x2f>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    %edx,-0x8(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    110a <get_gcd+0xa>
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_gcd>:
mov    %edi,%eax
test   %esi,%esi
je     111d <get_gcd+0x1d>
mov    %esi,%edx
nopl   0x0(%rax,%rax,1)
mov    %edx,%ecx
cltd
idiv   %ecx
mov    %ecx,%eax
test   %edx,%edx
jne    1110 <get_gcd+0x10>
mov    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @get_gcd(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %9, label %4
4: ; preds = %2, %4
%5 = phi i32 [ %6, %4 ], [ %0, %2 ]
%6 = phi i32 [ %7, %4 ], [ %1, %2 ]
%7 = srem i32 %5, %6
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %4
9: ; preds = %4, %2
%10 = phi i32 [ %0, %2 ], [ %6, %4 ]
ret i32 %10
}
void emit_type_definition_nat8(
    struct processor_explicatory_state *process_state,
    struct modern_stream *stream, void *stream_state,
    struct modern_vfile *vfile, void *vfile_state) {}


x86 assembly (clang, -O0):
<emit_type_definition_nat8>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.processor_explicatory_state = type opaque
%struct.modern_stream = type opaque
%struct.modern_vfile = type opaque
define void @emit_type_definition_nat8(%struct.processor_explicatory_state* %0, %struct.modern_stream* %1, i8* %2, %struct.modern_vfile* %3, i8* %4) {
%6 = alloca %struct.processor_explicatory_state*
%7 = alloca %struct.modern_stream*
%8 = alloca i8*
%9 = alloca %struct.modern_vfile*
%10 = alloca i8*
store %struct.processor_explicatory_state* %0, %struct.processor_explicatory_state** %6
store %struct.modern_stream* %1, %struct.modern_stream** %7
store i8* %2, i8** %8
store %struct.modern_vfile* %3, %struct.modern_vfile** %9
store i8* %4, i8** %10
ret void
}

LLVM IR (-O2):
%struct.processor_explicatory_state = type opaque
%struct.modern_stream = type opaque
%struct.modern_vfile = type opaque
define void @emit_type_definition_nat8(%struct.processor_explicatory_state* nocapture %0, %struct.modern_stream* nocapture %1, i8* nocapture %2, %struct.modern_vfile* nocapture %3, i8* nocapture %4) {
ret void
}
/* Variables and functions */
scalar_t__ abs(int);
int threshold(int value, int threshold) {
  return abs(value) > abs(threshold) ? value : 0;
}


x86 assembly (clang, -O0):
<threshold>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <abs@plt>
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <abs@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
cmp    %rcx,%rax
jle    114d <threshold+0x3d>
mov    -0x4(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    1157 <threshold+0x47>
xor    %eax,%eax
mov    %eax,-0x14(%rbp)
jmp    1157 <threshold+0x47>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<threshold>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%r14d
mov    %edi,%ebp
call   1030 <abs@plt>
mov    %rax,%rbx
mov    %r14d,%edi
call   1030 <abs@plt>
xor    %ecx,%ecx
cmp    %rax,%rbx
cmovg  %ebp,%ecx
mov    %ecx,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @threshold(i32 %0, i32 %1) {
%3 = tail call i64 @abs(i32 %0)
%4 = tail call i64 @abs(i32 %1)
%5 = icmp sgt i64 %3, %4
%6 = select i1 %5, i32 %0, i32 0
ret i32 %6
}
/* Type definitions */
typedef int /*<<< orphan*/ sigset_t;

/* Variables and functions */
int /*<<< orphan*/ memset(int /*<<< orphan*/ *, int, int);
int sigfillset(sigset_t *set) {
  memset(set, -1, sizeof *set);
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @sigfillset(i32* %0) {
%2 = tail call i32 @memset(i32* %0, i32 -1, i32 4)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ str2;

/* Variables and functions */
char *malloc(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ strcpy(char *, char *);
int main() {
  char **str1;
  char str2[] = "test str";
  char str3[] = "another str";
  printf("1\n");
  str1[0] = malloc(sizeof(str2));
  printf("2\n");
  strcpy(str1[0], str2);
  printf("3\n");
  printf("%s\n", str1[0]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeba(%rip),%rax
mov    %rax,-0x19(%rbp)
mov    0xeb8(%rip),%al
mov    %al,-0x11(%rbp)
mov    0xeaf(%rip),%rax
mov    %rax,-0x25(%rbp)
mov    0xead(%rip),%eax
mov    %eax,-0x1d(%rbp)
lea    0xea7(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x9,%edi
call   1050 <malloc@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
lea    0xe88(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    -0x19(%rbp),%rsi
call   1030 <strcpy@plt>
lea    0xe6d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe5b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@__const.main.str2 = [9 x i8] c"test str\00"
@__const.main.str3 = [12 x i8] c"another str\00"
@.str = [3 x i8] c"1\0A\00"
@.str.1 = [3 x i8] c"2\0A\00"
@.str.2 = [3 x i8] c"3\0A\00"
@.str.3 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8**
%3 = alloca [9 x i8]
%4 = alloca [12 x i8]
store i32 0, i32* %1
%5 = bitcast [9 x i8]* %3 to i8*
%6 = bitcast [12 x i8]* %4 to i8*
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%8 = call i8* @malloc(i32 9)
%9 = load i8**, i8*** %2
%10 = getelementptr inbounds i8*, i8** %9, i64 0
store i8* %8, i8** %10
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%12 = load i8**, i8*** %2
%13 = getelementptr inbounds i8*, i8** %12, i64 0
%14 = load i8*, i8** %13
%15 = getelementptr inbounds [9 x i8], [9 x i8]* %3, i64 0, i64 0
%16 = call i32 @strcpy(i8* %14, i8* %15)
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%18 = load i8**, i8*** %2
%19 = getelementptr inbounds i8*, i8** %18, i64 0
%20 = load i8*, i8** %19
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %20)
ret i32 0
}

LLVM IR (-O2):
@str = [2 x i8] c"1\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ O_RDWR;
int open(char *, int /*<<< orphan*/);
int i2c_open(char *filename) { return open(filename, O_RDWR); }


x86 assembly (clang, -O0):
<i2c_open>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2ec1(%rip),%rax
mov    (%rax),%esi
call   1030 <open@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<i2c_open>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%esi
jmp    1030 <open@plt>

LLVM IR (-O0):
@O_RDWR = global i32 0
define i32 @i2c_open(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i32, i32* @O_RDWR
%5 = call i32 @open(i8* %3, i32 %4)
ret i32 %5
}

LLVM IR (-O2):
@O_RDWR = global i32 0
define i32 @i2c_open(i8* nocapture %0) {
%2 = load i32, i32* @O_RDWR
%3 = tail call i32 @open(i8* %0, i32 %2)
ret i32 %3
}
/* Type definitions */
typedef unsigned long volatile uint32_t;

/* Variables and functions */
uint32_t AONRTCCaptureValueCh1Get(void) {
  return ((*((volatile unsigned long *)(0x40092000 + 0x00000028))));
}


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

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

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

LLVM IR (-O2):
define i64 @AONRTCCaptureValueCh1Get() {
%1 = load volatile i64, i64* inttoptr (i64 1074339880 to i64*)
ret i64 %1
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
int usage(char *us) {
  fprintf(stderr,
          "Usage: %s [-s limit_sec | -m limit_min | -h limit_hr]\n"
          "       [-silent] [-env var value] <program> <args...>\n",
          us);
  return 1;
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xed0(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<usage>:
push   %rax
mov    %rdi,%rdx
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
lea    0xedc(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [109 x i8] c"Usage: %s [-s limit_sec | -m limit_min | -h limit_hr]\0A [-silent] [-env var value] <program> <args...>\0A\00"
define i32 @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([109 x i8], [109 x i8]* @.str, i64 0, i64 0), i8* %4)
ret i32 1
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [109 x i8] c"Usage: %s [-s limit_sec | -m limit_min | -h limit_hr]\0A [-silent] [-env var value] <program> <args...>\0A\00"
define i32 @usage(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([109 x i8], [109 x i8]* @.str, i64 0, i64 0), i8* %0)
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ _SendPacket(unsigned char *, unsigned char *, unsigned int);
int SEGGER_SYSVIEW_SendPacket(unsigned char *pPacket,
                              unsigned char *pPayloadEnd, unsigned EventId) {
  ;
  _SendPacket(pPacket + 4, pPayloadEnd, EventId);
  ;
  return 0;
}


x86 assembly (clang, -O0):
<SEGGER_SYSVIEW_SendPacket>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
add    $0x4,%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <_SendPacket@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SEGGER_SYSVIEW_SendPacket>:
push   %rax
add    $0x4,%rdi
call   1030 <_SendPacket@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @SEGGER_SYSVIEW_SendPacket(i8* %0, i8* %1, i32 %2) {
%4 = getelementptr inbounds i8, i8* %0, i64 4
%5 = tail call i32 @_SendPacket(i8* %4, i8* %1, i32 %2)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ arc4random_buf(unsigned char *, unsigned int);
int cryptrand(unsigned char *buf, unsigned int len) {
  arc4random_buf(buf, len);
  return len;
}


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

x86 assembly (clang, -O2):
<cryptrand>:
push   %rbx
mov    %esi,%ebx
call   1030 <arc4random_buf@plt>
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @cryptrand(i8* %0, i32 returned %1) {
%3 = tail call i32 @arc4random_buf(i8* %0, i32 %1)
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ ROL_();
int /*<<< orphan*/ c64_memAbsoluteAddr();
void ROL_abs(void) {
  c64_memAbsoluteAddr();
  ROL_();
}


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

x86 assembly (clang, -O2):
<ROL_abs>:
push   %rax
xor    %eax,%eax
call   1040 <c64_memAbsoluteAddr@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <ROL_@plt>

LLVM IR (-O0):
define void @ROL_abs() {
%1 = call i32 (...) @c64_memAbsoluteAddr()
%2 = call i32 (...) @ROL_()
ret void
}

LLVM IR (-O2):
define void @ROL_abs() {
%1 = tail call i32 (...) @c64_memAbsoluteAddr()
%2 = tail call i32 (...) @ROL_()
ret void
}
unsigned short gp2x_video_RGB_color16(int R, int G, int B) {
  return ((((R)&0xF8) << 8) | (((G)&0xFC) << 3) | (((B)&0xF8) >> 3));
}


x86 assembly (clang, -O0):
<gp2x_video_RGB_color16>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
and    $0xf8,%eax
shl    $0x8,%eax
mov    -0x8(%rbp),%ecx
and    $0xfc,%ecx
shl    $0x3,%ecx
or     %ecx,%eax
mov    -0xc(%rbp),%ecx
and    $0xf8,%ecx
sar    $0x3,%ecx
or     %ecx,%eax
movzwl %ax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<gp2x_video_RGB_color16>:
shl    $0x8,%edi
and    $0xf800,%edi
and    $0xfc,%esi
lea    (%rdi,%rsi,8),%eax
shr    $0x3,%edx
and    $0x1f,%edx
or     %edx,%eax
ret

LLVM IR (-O0):
define zeroext i16 @gp2x_video_RGB_color16(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = and i32 %7, 248
%9 = shl i32 %8, 8
%10 = load i32, i32* %5
%11 = and i32 %10, 252
%12 = shl i32 %11, 3
%13 = or i32 %9, %12
%14 = load i32, i32* %6
%15 = and i32 %14, 248
%16 = ashr i32 %15, 3
%17 = or i32 %13, %16
%18 = trunc i32 %17 to i16
ret i16 %18
}

LLVM IR (-O2):
define zeroext i16 @gp2x_video_RGB_color16(i32 %0, i32 %1, i32 %2) {
%4 = shl i32 %0, 8
%5 = and i32 %4, 63488
%6 = shl i32 %1, 3
%7 = and i32 %6, 2016
%8 = or i32 %7, %5
%9 = lshr i32 %2, 3
%10 = and i32 %9, 31
%11 = or i32 %8, %10
%12 = trunc i32 %11 to i16
ret i16 %12
}
int sgn(double a) { return a < 0 ? -1 : a == 0 ? 0 : 1; }


x86 assembly (clang, -O0):
<sgn>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x8(%rbp),%xmm0
jbe    1124 <sgn+0x24>
mov    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    1147 <sgn+0x47>
movsd  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
mov    $0x1,%eax
xor    %ecx,%ecx
ucomisd %xmm1,%xmm0
setnp  %sil
sete   %dl
test   %sil,%dl
cmovne %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sgn>:
xorpd  %xmm1,%xmm1
movapd %xmm0,%xmm2
cmpneqsd %xmm1,%xmm2
movq   %xmm2,%rcx
and    $0x1,%ecx
ucomisd %xmm0,%xmm1
mov    $0xffffffff,%eax
cmovbe %ecx,%eax
ret

LLVM IR (-O0):
define i32 @sgn(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fcmp olt double %3, 0.000000e+00
br i1 %4, label %5, label %6
5: ; preds = %1
br label %11
6: ; preds = %1
%7 = load double, double* %2
%8 = fcmp oeq double %7, 0.000000e+00
%9 = zext i1 %8 to i64
%10 = select i1 %8, i32 0, i32 1
br label %11
11: ; preds = %6, %5
%12 = phi i32 [ -1, %5 ], [ %10, %6 ]
ret i32 %12
}

LLVM IR (-O2):
define i32 @sgn(double %0) {
%2 = fcmp olt double %0, 0.000000e+00
%3 = fcmp une double %0, 0.000000e+00
%4 = zext i1 %3 to i32
%5 = select i1 %2, i32 -1, i32 %4
ret i32 %5
}
void zera_vetor(float *media_aritmetica, int prov) {
  int j;
  for (j = 0; j < prov; j++) {
    media_aritmetica[j] = 0;
  }
}


x86 assembly (clang, -O0):
<zera_vetor>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    113c <zera_vetor+0x3c>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
xorps  %xmm0,%xmm0
movss  %xmm0,(%rax,%rcx,4)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1112 <zera_vetor+0x12>
pop    %rbp
ret

x86 assembly (clang, -O2):
<zera_vetor>:
test   %esi,%esi
jle    1126 <zera_vetor+0x16>
push   %rax
mov    %esi,%edx
shl    $0x2,%rdx
xor    %esi,%esi
call   1030 <memset@plt>
add    $0x8,%rsp
ret

LLVM IR (-O0):
define void @zera_vetor(float* %0, i32 %1) {
%3 = alloca float*
%4 = alloca i32
%5 = alloca i32
store float* %0, float** %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %6
6: ; preds = %15, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %4
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %18
10: ; preds = %6
%11 = load float*, float** %3
%12 = load i32, i32* %5
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds float, float* %11, i64 %13
store float 0.000000e+00, float* %14
br label %15
15: ; preds = %10
%16 = load i32, i32* %5
%17 = add nsw i32 %16, 1
store i32 %17, i32* %5
br label %6
18: ; preds = %6
ret void
}

LLVM IR (-O2):
define void @zera_vetor(float* nocapture writeonly %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = bitcast float* %0 to i8*
%6 = zext i32 %1 to i64
%7 = shl nuw nsw i64 %6, 2
br label %8
8: ; preds = %4, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ O_RDWR;
int /*<<< orphan*/ perror(char *);
int shm_open(char *, int /*<<< orphan*/, int);
int do_open(void) {
  int fd;
  fd = shm_open("/shm-test", O_RDWR, 0600);
  if (fd == -1) {
    perror("failed to open shared memory object: shm_open");
    return -1;
  }
  return fd;
}


x86 assembly (clang, -O0):
<do_open>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2eb9(%rip),%rax
mov    (%rax),%esi
lea    0xec8(%rip),%rdi
mov    $0x180,%edx
call   1040 <shm_open@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0xffffffff,-0x8(%rbp)
jne    1167 <do_open+0x47>
lea    0xeb4(%rip),%rdi
call   1030 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    116d <do_open+0x4d>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_open>:
push   %rbx
mov    0x2ec0(%rip),%rax
mov    (%rax),%esi
lea    0xecf(%rip),%rdi
mov    $0x180,%edx
call   1040 <shm_open@plt>
mov    %eax,%ebx
cmp    $0xffffffff,%eax
je     1146 <do_open+0x26>
mov    %ebx,%eax
pop    %rbx
ret
lea    0xebd(%rip),%rdi
call   1030 <perror@plt>
jmp    1142 <do_open+0x22>

LLVM IR (-O0):
@.str = [10 x i8] c"/shm-test\00"
@O_RDWR = global i32 0
@.str.1 = [46 x i8] c"failed to open shared memory object: shm_open\00"
define i32 @do_open() {
%1 = alloca i32
%2 = alloca i32
%3 = load i32, i32* @O_RDWR
%4 = call i32 @shm_open(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %3, i32 384)
store i32 %4, i32* %2
%5 = load i32, i32* %2
%6 = icmp eq i32 %5, -1
br i1 %6, label %7, label %9
7: ; preds = %0
%8 = call i32 @perror(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.1, i64 0, i64 0))
store i32 -1, i32* %1
br label %11
9: ; preds = %0
%10 = load i32, i32* %2
store i32 %10, i32* %1
br label %11
11: ; preds = %9, %7
%12 = load i32, i32* %1
ret i32 %12
}

LLVM IR (-O2):
@.str = [10 x i8] c"/shm-test\00"
@O_RDWR = global i32 0
@.str.1 = [46 x i8] c"failed to open shared memory object: shm_open\00"
define i32 @do_open() {
%1 = load i32, i32* @O_RDWR
%2 = tail call i32 @shm_open(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %1, i32 384)
%3 = icmp eq i32 %2, -1
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = tail call i32 @perror(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.1, i64 0, i64 0))
br label %6
6: ; preds = %0, %4
ret i32 %2
}
void XkbAllocControls() {}


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

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

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

LLVM IR (-O2):
define void @XkbAllocControls() {
ret void
}
int isnoprintf(const char *s, ...) { return (0); }


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

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

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

LLVM IR (-O2):
define i32 @isnoprintf(i8* nocapture readnone %0, ...) {
ret i32 0
}
int logicswrap(void) { return 1; }


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

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

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

LLVM IR (-O2):
define i32 @logicswrap() {
ret i32 1
}
void curl_multi_add_handle() {}


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

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

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

LLVM IR (-O2):
define void @curl_multi_add_handle() {
ret void
}
int readFile(const char *filename, const char *chTable) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @readFile(i8* nocapture readnone %0, i8* nocapture readnone %1) {
ret i32 0
}
void support_card_init(void) {}


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

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

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

LLVM IR (-O2):
define void @support_card_init() {
ret void
}
/* Variables and functions */
int __infer_nondet_int();
int isblank(int x) { return __infer_nondet_int(); }


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

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

LLVM IR (-O0):
define i32 @isblank(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (...) @__infer_nondet_int()
ret i32 %3
}

LLVM IR (-O2):
define i32 @isblank(i32 %0) {
%2 = tail call i32 (...) @__infer_nondet_int()
ret i32 %2
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ IntDisable(int);
int /*<<< orphan*/ IntUnregister(int);
void LCDIntUnregister(uint32_t ui32Base) {
  ;
  IntDisable(113);
  IntUnregister(113);
}


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

x86 assembly (clang, -O2):
<LCDIntUnregister>:
push   %rax
mov    $0x71,%edi
call   1030 <IntDisable@plt>
mov    $0x71,%edi
pop    %rax
jmp    1040 <IntUnregister@plt>

LLVM IR (-O0):
define void @LCDIntUnregister(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @IntDisable(i32 113)
%4 = call i32 @IntUnregister(i32 113)
ret void
}

LLVM IR (-O2):
define void @LCDIntUnregister(i32 %0) {
%2 = tail call i32 @IntDisable(i32 113)
%3 = tail call i32 @IntUnregister(i32 113)
ret void
}
int bitset_contains(unsigned int set, unsigned int element) {
  if (set & (1U << element))
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<bitset_contains>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    -0xc(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
je     1130 <bitset_contains+0x30>
movl   $0x1,-0x4(%rbp)
jmp    1137 <bitset_contains+0x37>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @bitset_contains(i32 %0, i32 %1) {
%3 = lshr i32 %0, %1
%4 = and i32 %3, 1
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ to_point(int, int /*<<< orphan*/);
int /*<<< orphan*/ turn_player(int /*<<< orphan*/);
int turn_left() {
  turn_player(to_point(-1, 0));
  return 1;
}


x86 assembly (clang, -O0):
<turn_left>:
push   %rbp
mov    %rsp,%rbp
mov    $0xffffffff,%edi
xor    %esi,%esi
call   1040 <to_point@plt>
mov    %eax,%edi
call   1030 <turn_player@plt>
mov    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<turn_left>:
push   %rax
mov    $0xffffffff,%edi
xor    %esi,%esi
call   1040 <to_point@plt>
mov    %eax,%edi
call   1030 <turn_player@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @turn_left() {
%1 = call i32 @to_point(i32 -1, i32 0)
%2 = call i32 @turn_player(i32 %1)
ret i32 1
}

LLVM IR (-O2):
define i32 @turn_left() {
%1 = tail call i32 @to_point(i32 -1, i32 0)
%2 = tail call i32 @turn_player(i32 %1)
ret i32 1
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_key_t;

/* Variables and functions */
int pthread_setspecific(pthread_key_t key, const void *data) { return (0); }


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

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

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

LLVM IR (-O2):
define i32 @pthread_setspecific(i32 %0, i8* nocapture readnone %1) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ command_parser();
void start_shell(void) { command_parser(); }


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

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

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

LLVM IR (-O2):
define void @start_shell() {
%1 = tail call i32 (...) @command_parser()
ret void
}
int dummyfn0(void) { return 1; }


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

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

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

LLVM IR (-O2):
define i32 @dummyfn0() {
ret i32 1
}
int sete(int A, int B) {
  int soma;
  soma = A;
  while (A != B) {
    if (A < B) {
      soma = soma + (A + 1);
      A++;
    }
    if (A > B) {
      soma = soma + (B + 1);
      A--;
    }
  }
  return soma;
}


x86 assembly (clang, -O0):
<sete>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
je     1167 <sete+0x67>
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    113f <sete+0x3f>
mov    -0xc(%rbp),%eax
mov    -0x4(%rbp),%ecx
add    $0x1,%ecx
add    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    1162 <sete+0x62>
mov    -0xc(%rbp),%eax
mov    -0x8(%rbp),%ecx
add    $0x1,%ecx
add    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x4(%rbp)
jmp    1110 <sete+0x10>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sete>:
mov    %edi,%eax
cmp    %esi,%edi
je     1136 <sete+0x36>
lea    0x1(%rsi),%r9d
xor    %r8d,%r8d
mov    %eax,%edi
nop
lea    0x1(%rdi),%edx
cmp    %esi,%edi
cmovl  %edx,%edi
cmovge %r8d,%edx
add    %eax,%edx
xor    %ecx,%ecx
cmp    %esi,%edi
mov    $0x0,%eax
cmovg  %r9d,%eax
setg   %cl
sub    %ecx,%edi
add    %edx,%eax
cmp    %esi,%edi
jne    1110 <sete+0x10>
ret

LLVM IR (-O0):
define i32 @sete(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
store i32 %6, i32* %5
br label %7
7: ; preds = %33, %2
%8 = load i32, i32* %3
%9 = load i32, i32* %4
%10 = icmp ne i32 %8, %9
br i1 %10, label %11, label %34
11: ; preds = %7
%12 = load i32, i32* %3
%13 = load i32, i32* %4
%14 = icmp slt i32 %12, %13
br i1 %14, label %15, label %22
15: ; preds = %11
%16 = load i32, i32* %5
%17 = load i32, i32* %3
%18 = add nsw i32 %17, 1
%19 = add nsw i32 %16, %18
store i32 %19, i32* %5
%20 = load i32, i32* %3
%21 = add nsw i32 %20, 1
store i32 %21, i32* %3
br label %22
22: ; preds = %15, %11
%23 = load i32, i32* %3
%24 = load i32, i32* %4
%25 = icmp sgt i32 %23, %24
br i1 %25, label %26, label %33
26: ; preds = %22
%27 = load i32, i32* %5
%28 = load i32, i32* %4
%29 = add nsw i32 %28, 1
%30 = add nsw i32 %27, %29
store i32 %30, i32* %5
%31 = load i32, i32* %3
%32 = add nsw i32 %31, -1
store i32 %32, i32* %3
br label %33
33: ; preds = %26, %22
br label %7
34: ; preds = %7
%35 = load i32, i32* %5
ret i32 %35
}

LLVM IR (-O2):
define i32 @sete(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, %1
br i1 %3, label %20, label %4
4: ; preds = %2
%5 = add nsw i32 %1, 1
br label %6
6: ; preds = %4, %6
%7 = phi i32 [ %0, %4 ], [ %18, %6 ]
%8 = phi i32 [ %0, %4 ], [ %16, %6 ]
%9 = icmp slt i32 %8, %1
%10 = add nsw i32 %8, 1
%11 = select i1 %9, i32 %10, i32 %8
%12 = select i1 %9, i32 %10, i32 0
%13 = add nsw i32 %12, %7
%14 = icmp sgt i32 %11, %1
%15 = sext i1 %14 to i32
%16 = add nsw i32 %11, %15
%17 = select i1 %14, i32 %5, i32 0
%18 = add nsw i32 %13, %17
%19 = icmp eq i32 %16, %1
br i1 %19, label %20, label %6
20: ; preds = %6, %2
%21 = phi i32 [ %0, %2 ], [ %18, %6 ]
ret i32 %21
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void colorRed() { printf("%s", "\x1B[31m"); }


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

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

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [6 x i8] c"\1B[31m\00"
define void @colorRed() {
%1 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [6 x i8] c"\1B[31m\00"
define void @colorRed() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
ret void
}
unsigned char macc(unsigned char x, unsigned char y, unsigned char z) {
  return x * y + z;
}


x86 assembly (clang, -O0):
<macc>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %sil,%cl
mov    %dil,%dl
mov    %dl,-0x1(%rbp)
mov    %cl,-0x2(%rbp)
mov    %al,-0x3(%rbp)
movzbl -0x1(%rbp),%eax
movzbl -0x2(%rbp),%ecx
imul   %ecx,%eax
movzbl -0x3(%rbp),%ecx
add    %ecx,%eax
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<macc>:
mov    %esi,%eax
mul    %dil
add    %dl,%al
ret

LLVM IR (-O0):
define zeroext i8 @macc(i8 zeroext %0, i8 zeroext %1, i8 zeroext %2) {
%4 = alloca i8
%5 = alloca i8
%6 = alloca i8
store i8 %0, i8* %4
store i8 %1, i8* %5
store i8 %2, i8* %6
%7 = load i8, i8* %4
%8 = zext i8 %7 to i32
%9 = load i8, i8* %5
%10 = zext i8 %9 to i32
%11 = mul nsw i32 %8, %10
%12 = load i8, i8* %6
%13 = zext i8 %12 to i32
%14 = add nsw i32 %11, %13
%15 = trunc i32 %14 to i8
ret i8 %15
}

LLVM IR (-O2):
define zeroext i8 @macc(i8 zeroext %0, i8 zeroext %1, i8 zeroext %2) {
%4 = mul i8 %1, %0
%5 = add i8 %4, %2
ret i8 %5
}
/* Type definitions */
union bpf_attr {
  int map_fd;
  void *next_key;
  void *key;
};
typedef int /*<<< orphan*/ attr;

/* Variables and functions */
int /*<<< orphan*/ BPF_MAP_GET_NEXT_KEY;
void *ptr_to_u64(void *);
int syscall(int, int /*<<< orphan*/, union bpf_attr *, int);
int bpf_get_next_key(int fd, void *key, void *next_key) {
  union bpf_attr attr;
  attr.map_fd = fd;
  attr.key = ptr_to_u64(key);
  attr.next_key = ptr_to_u64(next_key);
  return syscall(321, BPF_MAP_GET_NEXT_KEY, &attr, sizeof(attr));
}


x86 assembly (clang, -O0):
<bpf_get_next_key>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <ptr_to_u64@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <ptr_to_u64@plt>
mov    %rax,-0x20(%rbp)
mov    0x2e8e(%rip),%rax
mov    (%rax),%esi
mov    $0x141,%edi
lea    -0x20(%rbp),%rdx
mov    $0x8,%ecx
call   1040 <syscall@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bpf_get_next_key>:
push   %rbx
sub    $0x10,%rsp
mov    %rdx,%rbx
mov    %rsi,%rdi
call   1030 <ptr_to_u64@plt>
mov    %rbx,%rdi
call   1030 <ptr_to_u64@plt>
mov    %rax,0x8(%rsp)
mov    0x2ea4(%rip),%rax
mov    (%rax),%esi
lea    0x8(%rsp),%rdx
mov    $0x141,%edi
mov    $0x8,%ecx
call   1040 <syscall@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%union.bpf_attr = type { i8* }
@BPF_MAP_GET_NEXT_KEY = global i32 0
define i32 @bpf_get_next_key(i32 %0, i8* %1, i8* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca %union.bpf_attr
store i32 %0, i32* %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%8 = load i32, i32* %4
%9 = bitcast %union.bpf_attr* %7 to i32*
store i32 %8, i32* %9
%10 = load i8*, i8** %5
%11 = call i8* @ptr_to_u64(i8* %10)
%12 = bitcast %union.bpf_attr* %7 to i8**
store i8* %11, i8** %12
%13 = load i8*, i8** %6
%14 = call i8* @ptr_to_u64(i8* %13)
%15 = bitcast %union.bpf_attr* %7 to i8**
store i8* %14, i8** %15
%16 = load i32, i32* @BPF_MAP_GET_NEXT_KEY
%17 = call i32 @syscall(i32 321, i32 %16, %union.bpf_attr* %7, i32 8)
ret i32 %17
}

LLVM IR (-O2):
%union.bpf_attr = type { i8* }
@BPF_MAP_GET_NEXT_KEY = global i32 0
define i32 @bpf_get_next_key(i32 %0, i8* %1, i8* %2) {
%4 = alloca %union.bpf_attr
%5 = bitcast %union.bpf_attr* %4 to i8*
%6 = tail call i8* @ptr_to_u64(i8* %1)
%7 = getelementptr inbounds %union.bpf_attr, %union.bpf_attr* %4, i64 0, i32 0
%8 = tail call i8* @ptr_to_u64(i8* %2)
store i8* %8, i8** %7
%9 = load i32, i32* @BPF_MAP_GET_NEXT_KEY
%10 = call i32 @syscall(i32 321, i32 %9, %union.bpf_attr* %4, i32 8)
ret i32 %10
}
int test_imm_CAuint8_mem(unsigned char *val) {
  return ((*val) & (-0xCA << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_CAuint8_mem(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8, i8* %3
%5 = zext i8 %4 to i32
%6 = and i32 %5, -202
%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_CAuint8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, 54
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
void SteamAPI_ISteamHTMLSurface_GoForward(void *self) {
  xlogf("%s(self = %p)\n", __func__, self);
}


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

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

LLVM IR (-O0):
@.str = [15 x i8] c"%s(self = %p)\0A\00"
@__func__.SteamAPI_ISteamHTMLSurface_GoForward = [37 x i8] c"SteamAPI_ISteamHTMLSurface_GoForward\00"
define void @SteamAPI_ISteamHTMLSurface_GoForward(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 (i8*, i8*, i8*, ...) bitcast (i32 (...)* @xlogf to i32 (i8*, i8*, i8*, ...)*)(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([37 x i8], [37 x i8]* @__func__.SteamAPI_ISteamHTMLSurface_GoForward, i64 0, i64 0), i8* %3)
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"%s(self = %p)\0A\00"
@__func__.SteamAPI_ISteamHTMLSurface_GoForward = [37 x i8] c"SteamAPI_ISteamHTMLSurface_GoForward\00"
define void @SteamAPI_ISteamHTMLSurface_GoForward(i8* %0) {
%2 = tail call i32 (i8*, i8*, i8*, ...) bitcast (i32 (...)* @xlogf to i32 (i8*, i8*, i8*, ...)*)(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([37 x i8], [37 x i8]* @__func__.SteamAPI_ISteamHTMLSurface_GoForward, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
long Dynace_GetPageSize();
long Dynace_GetInitialPageSize() { return Dynace_GetPageSize(); }


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

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

LLVM IR (-O0):
define i64 @Dynace_GetInitialPageSize() {
%1 = call i64 (...) @Dynace_GetPageSize()
ret i64 %1
}

LLVM IR (-O2):
define i64 @Dynace_GetInitialPageSize() {
%1 = tail call i64 (...) @Dynace_GetPageSize()
ret i64 %1
}
/* Variables and functions */
int /*<<< orphan*/ f2(int, int *, int);
void call_f2(int *p) {
  f2(-1, p, 0);
  f2(0, p, -1);
}


x86 assembly (clang, -O0):
<call_f2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
mov    $0xffffffff,%edi
xor    %edx,%edx
call   1030 <f2@plt>
mov    -0x8(%rbp),%rsi
xor    %edi,%edi
mov    $0xffffffff,%edx
call   1030 <f2@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<call_f2>:
push   %rbx
mov    %rdi,%rbx
mov    $0xffffffff,%edi
mov    %rbx,%rsi
xor    %edx,%edx
call   1030 <f2@plt>
xor    %edi,%edi
mov    %rbx,%rsi
mov    $0xffffffff,%edx
pop    %rbx
jmp    1030 <f2@plt>

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

LLVM IR (-O2):
define void @call_f2(i32* %0) {
%2 = tail call i32 @f2(i32 -1, i32* %0, i32 0)
%3 = tail call i32 @f2(i32 0, i32* %0, i32 -1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ launch_server();
void *server_init(void *param) { launch_server(); }


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

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

LLVM IR (-O0):
define i8* @server_init(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %3
%4 = call i32 (...) @launch_server()
%5 = load i8*, i8** %2
ret i8* %5
}

LLVM IR (-O2):
define noalias i8* @server_init(i8* nocapture readnone %0) {
%2 = tail call i32 (...) @launch_server()
ret i8* undef
}
int power(int x, unsigned int y) {
  int temp;
  if (y == 0)
    return 1;
  temp = power(x, y / 2);
  if (y % 2 == 0)
    return temp * temp;
  else
    return x * temp * temp;
}


x86 assembly (clang, -O0):
<power>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    1134 <power+0x24>
movl   $0x1,-0x4(%rbp)
jmp    1171 <power+0x61>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
shr    $0x1,%esi
call   1030 <power@plt>
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
jne    1163 <power+0x53>
mov    -0x10(%rbp),%eax
imul   -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1171 <power+0x61>
mov    -0x8(%rbp),%eax
imul   -0x10(%rbp),%eax
imul   -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<power>:
test   %esi,%esi
je     113d <power+0x2d>
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %edi,%ebx
shr    %esi
call   1030 <power@plt>
mov    %eax,%ecx
imul   %eax,%ecx
test   $0x1,%bpl
mov    $0x1,%eax
cmovne %ebx,%eax
imul   %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
mov    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @power(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%7 = load i32, i32* %5
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %2
store i32 1, i32* %3
br label %28
10: ; preds = %2
%11 = load i32, i32* %4
%12 = load i32, i32* %5
%13 = udiv i32 %12, 2
%14 = call i32 @power(i32 %11, i32 %13)
store i32 %14, i32* %6
%15 = load i32, i32* %5
%16 = urem i32 %15, 2
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %22
18: ; preds = %10
%19 = load i32, i32* %6
%20 = load i32, i32* %6
%21 = mul nsw i32 %19, %20
store i32 %21, i32* %3
br label %28
22: ; preds = %10
%23 = load i32, i32* %4
%24 = load i32, i32* %6
%25 = mul nsw i32 %23, %24
%26 = load i32, i32* %6
%27 = mul nsw i32 %25, %26
store i32 %27, i32* %3
br label %28
28: ; preds = %22, %18, %9
%29 = load i32, i32* %3
ret i32 %29
}

LLVM IR (-O2):
define i32 @power(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %12, label %4
4: ; preds = %2
%5 = lshr i32 %1, 1
%6 = tail call i32 @power(i32 %0, i32 %5)
%7 = and i32 %1, 1
%8 = icmp eq i32 %7, 0
%9 = mul i32 %6, %6
%10 = select i1 %8, i32 1, i32 %0
%11 = mul i32 %9, %10
br label %12
12: ; preds = %4, %2
%13 = phi i32 [ 1, %2 ], [ %11, %4 ]
ret i32 %13
}
int test_imm_54uint8_mem(unsigned char *val) {
  return ((*val) & (0x54 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_54uint8_mem(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8, i8* %3
%5 = zext i8 %4 to i32
%6 = and i32 %5, 84
%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_54uint8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, 84
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ assert(int /*<<< orphan*/);
int call(const char *fmt, ...) {
  assert(fmt != NULL);
  return 0;
}


x86 assembly (clang, -O0):
<call>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
test   %rax,%rax
setne  %al
movzbl %al,%edi
call   1030 <assert@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<call>:
push   %rax
xor    %eax,%eax
test   %rdi,%rdi
setne  %al
mov    %eax,%edi
call   1030 <assert@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @call(i8* %0, ...) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = icmp ne i8* %3, null
%5 = zext i1 %4 to i32
%6 = call i32 @assert(i32 %5)
ret i32 0
}

LLVM IR (-O2):
define i32 @call(i8* readnone %0, ...) {
%2 = icmp ne i8* %0, null
%3 = zext i1 %2 to i32
%4 = tail call i32 @assert(i32 %3)
ret i32 0
}
int main() {
  int sum = 0;
  if (0 || 3 && 0 && sum++) {
    sum += 2;
  }
  if (0 || 1 && 0) {
    sum += 4;
  }
  if (1 && 0 || 4 && 6) {
    sum += 8;
  }
  if (1 && 2 && 3 || 5) {
    sum += 16;
  }
  return sum;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x8,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x10,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
%3 = load i32, i32* %2
%4 = add nsw i32 %3, 8
store i32 %4, i32* %2
%5 = load i32, i32* %2
%6 = add nsw i32 %5, 16
store i32 %6, i32* %2
%7 = load i32, i32* %2
ret i32 %7
}

LLVM IR (-O2):
define i32 @main() {
ret i32 24
}