xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void sig_quit(int signo) { printf("in sig_quit:\n"); }


x86 assembly (clang, -O0):
<sig_quit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xede(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [14 x i8] c"in sig_quit:\0A\00"
define void @sig_quit(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [13 x i8] c"in sig_quit:\00"
define void @sig_quit(i32 %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef scalar_t__ uint8_t;
typedef int uint32_t;

/* Variables and functions */
uint32_t bytes_r32net(const uint8_t *data) {
  return ((uint32_t)data[3]) | (((uint32_t)data[2]) << 8) |
         (((uint32_t)data[1]) << 16) | (((uint32_t)data[0]) << 24);
}


x86 assembly (clang, -O0):
<bytes_r32net>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0x18(%rax),%rax
mov    -0x8(%rbp),%rcx
mov    0x10(%rcx),%rcx
shl    $0x8,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
mov    0x8(%rcx),%rcx
shl    $0x10,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
mov    (%rcx),%rcx
shl    $0x18,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bytes_r32net>:
mov    0x10(%rdi),%ecx
shl    $0x8,%ecx
or     0x18(%rdi),%ecx
mov    (%rdi),%eax
mov    0x8(%rdi),%edx
shl    $0x10,%edx
shl    $0x18,%eax
or     %edx,%eax
or     %ecx,%eax
ret

LLVM IR (-O0):
define i32 @bytes_r32net(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = getelementptr inbounds i64, i64* %3, i64 3
%5 = load i64, i64* %4
%6 = trunc i64 %5 to i32
%7 = load i64*, i64** %2
%8 = getelementptr inbounds i64, i64* %7, i64 2
%9 = load i64, i64* %8
%10 = trunc i64 %9 to i32
%11 = shl i32 %10, 8
%12 = or i32 %6, %11
%13 = load i64*, i64** %2
%14 = getelementptr inbounds i64, i64* %13, i64 1
%15 = load i64, i64* %14
%16 = trunc i64 %15 to i32
%17 = shl i32 %16, 16
%18 = or i32 %12, %17
%19 = load i64*, i64** %2
%20 = getelementptr inbounds i64, i64* %19, i64 0
%21 = load i64, i64* %20
%22 = trunc i64 %21 to i32
%23 = shl i32 %22, 24
%24 = or i32 %18, %23
ret i32 %24
}

LLVM IR (-O2):
define i32 @bytes_r32net(i64* nocapture %0) {
%2 = getelementptr inbounds i64, i64* %0, i64 3
%3 = load i64, i64* %2
%4 = trunc i64 %3 to i32
%5 = getelementptr inbounds i64, i64* %0, i64 2
%6 = load i64, i64* %5
%7 = trunc i64 %6 to i32
%8 = shl i32 %7, 8
%9 = or i32 %8, %4
%10 = getelementptr inbounds i64, i64* %0, i64 1
%11 = load i64, i64* %10
%12 = trunc i64 %11 to i32
%13 = shl i32 %12, 16
%14 = or i32 %9, %13
%15 = load i64, i64* %0
%16 = trunc i64 %15 to i32
%17 = shl i32 %16, 24
%18 = or i32 %14, %17
ret i32 %18
}
void gdk_window_at_pointer() {}


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

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

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

LLVM IR (-O2):
define void @gdk_window_at_pointer() {
ret void
}
void thread() {}


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

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

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

LLVM IR (-O2):
define void @thread() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ japi_selecttext(int, int, int);
void j_selecttext(int arg0, int arg1, int arg2) {
  japi_selecttext(arg0, arg1, arg2);
}


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

x86 assembly (clang, -O2):
<j_selecttext>:
jmp    1030 <japi_selecttext@plt>

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

LLVM IR (-O2):
define void @j_selecttext(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 @japi_selecttext(i32 %0, i32 %1, i32 %2)
ret void
}
/* Variables and functions */
scalar_t__ isdigit(char const);
extern char sockIsIpAddress(const char *pString) {
  while (*pString != '\0') {
    if (!(*pString == '.' || isdigit(*pString)))
      return 0;
    pString++;
  }
  return 1;
}


x86 assembly (clang, -O0):
<sockIsIpAddress>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     116c <sockIsIpAddress+0x5c>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2e,%eax
je     115b <sockIsIpAddress+0x4b>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
jne    115b <sockIsIpAddress+0x4b>
movb   $0x0,-0x1(%rbp)
jmp    1170 <sockIsIpAddress+0x60>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    111c <sockIsIpAddress+0xc>
movb   $0x1,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sockIsIpAddress>:
push   %rbx
mov    %rdi,%rbx
jmp    1124 <sockIsIpAddress+0x14>
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%rbx
movzbl (%rbx),%eax
cmp    $0x2e,%al
je     1120 <sockIsIpAddress+0x10>
test   %al,%al
je     1140 <sockIsIpAddress+0x30>
movsbl %al,%edi
call   1030 <isdigit@plt>
test   %rax,%rax
jne    1120 <sockIsIpAddress+0x10>
xor    %eax,%eax
pop    %rbx
ret
mov    $0x1,%al
pop    %rbx
ret

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

LLVM IR (-O2):
define signext i8 @sockIsIpAddress(i8* nocapture %0) {
br label %2
2: ; preds = %8, %1
%3 = phi i8* [ %0, %1 ], [ %9, %8 ]
%4 = load i8, i8* %3
switch i8 %4, label %5 [
i8 0, label %10
i8 46, label %8
]
5: ; preds = %2
%6 = tail call i64 @isdigit(i8 signext %4)
%7 = icmp eq i64 %6, 0
br i1 %7, label %10, label %8
8: ; preds = %2, %5
%9 = getelementptr inbounds i8, i8* %3, i64 1
br label %2
10: ; preds = %2, %5
%11 = phi i8 [ 0, %5 ], [ 1, %2 ]
ret i8 %11
}
int foo2(int *A, int N) { return A[2 * N]; }


x86 assembly (clang, -O0):
<foo2>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
shl    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo2>:
add    %esi,%esi
movslq %esi,%rax
mov    (%rdi,%rax,4),%eax
ret

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

LLVM IR (-O2):
define i32 @foo2(i32* nocapture %0, i32 %1) {
%3 = shl nsw i32 %1, 1
%4 = sext i32 %3 to i64
%5 = getelementptr inbounds i32, i32* %0, i64 %4
%6 = load i32, i32* %5
ret i32 %6
}
/* Type definitions */
struct sched_attr {
  int dummy;
};
typedef int /*<<< orphan*/ pid_t;

/* Variables and functions */
int /*<<< orphan*/ SYS_sched_getattr;
int syscall(int /*<<< orphan*/, int /*<<< orphan*/, struct sched_attr *,
            unsigned int, unsigned int);
int sched_getattr(pid_t pid, struct sched_attr *attr, unsigned int size,
                  unsigned int flags) {
  return syscall(SYS_sched_getattr, pid, attr, size, flags);
}


x86 assembly (clang, -O0):
<sched_getattr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    0x2eb4(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%esi
mov    -0x10(%rbp),%rdx
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%r8d
call   1030 <syscall@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sched_getattr>:
mov    %ecx,%r8d
mov    %edx,%ecx
mov    %rsi,%rdx
mov    %edi,%esi
mov    0x2ebf(%rip),%rax
mov    (%rax),%edi
jmp    1030 <syscall@plt>

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

LLVM IR (-O2):
%struct.sched_attr = type { i32 }
@SYS_sched_getattr = global i32 0
define i32 @sched_getattr(i32 %0, %struct.sched_attr* %1, i32 %2, i32 %3) {
%5 = load i32, i32* @SYS_sched_getattr
%6 = tail call i32 @syscall(i32 %5, i32 %0, %struct.sched_attr* %1, i32 %2, i32 %3)
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, unsigned int);
int /*<<< orphan*/ stderr;
void budd_panic_uint(char *a, unsigned int b) {
  fprintf(stderr, "error: %s: 0x%x\n", a, b);
  exit(1);
}


x86 assembly (clang, -O0):
<budd_panic_uint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    0x2eaa(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
mov    -0xc(%rbp),%ecx
lea    0xeba(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<budd_panic_uint>:
push   %rax
mov    %esi,%ecx
mov    %rdi,%rdx
mov    0x2eb3(%rip),%rax
mov    (%rax),%edi
lea    0xeca(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [17 x i8] c"error: %s: 0x%x\0A\00"
define void @budd_panic_uint(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* @stderr
%6 = load i8*, i8** %3
%7 = load i32, i32* %4
%8 = call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* %6, i32 %7)
%9 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [17 x i8] c"error: %s: 0x%x\0A\00"
define void @budd_panic_uint(i8* %0, i32 %1) {
%3 = load i32, i32* @stderr
%4 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %1)
%5 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ string_copy(char *, char *);
size_t string_length(char *);
void string_append(char *destination, char *source) {
  string_copy(&destination[string_length(destination)], source);
}


x86 assembly (clang, -O0):
<string_append>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <string_length@plt>
mov    -0x18(%rbp),%rdi
add    %rax,%rdi
mov    -0x10(%rbp),%rsi
call   1040 <string_copy@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<string_append>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1030 <string_length@plt>
add    %rax,%rbx
mov    %rbx,%rdi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <string_copy@plt>

LLVM IR (-O0):
define void @string_append(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = load i8*, i8** %3
%7 = call i64 @string_length(i8* %6)
%8 = getelementptr inbounds i8, i8* %5, i64 %7
%9 = load i8*, i8** %4
%10 = call i32 @string_copy(i8* %8, i8* %9)
ret void
}

LLVM IR (-O2):
define void @string_append(i8* %0, i8* %1) {
%3 = tail call i64 @string_length(i8* %0)
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = tail call i32 @string_copy(i8* %4, i8* %1)
ret void
}
void I422ToRGBARow_SSSE3() {}


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

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

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

LLVM IR (-O2):
define void @I422ToRGBARow_SSSE3() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fun();
int /*<<< orphan*/ printf(char *);
int main() {
  printf("[+] start\n");
  fun();
  printf("[+] end\n");
  return 0;
}


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

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

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

LLVM IR (-O2):
@str = [10 x i8] c"[+] start\00"
@str.2 = [8 x i8] c"[+] end\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (...) @fun()
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.2, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
scalar_t__ INT_MIN;
unsigned int test6u(unsigned int x) {
  unsigned int y = (unsigned int)INT_MIN;
  return ~(x - y);
}


x86 assembly (clang, -O0):
<test6u>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    0x2eda(%rip),%rax
mov    (%rax),%rax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
sub    -0x8(%rbp),%eax
xor    $0xffffffff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test6u>:
mov    %edi,%eax
mov    0x2edf(%rip),%rcx
not    %eax
add    (%rcx),%eax
ret

LLVM IR (-O0):
@INT_MIN = global i64 0
define i32 @test6u(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i64, i64* @INT_MIN
%5 = trunc i64 %4 to i32
store i32 %5, i32* %3
%6 = load i32, i32* %2
%7 = load i32, i32* %3
%8 = sub i32 %6, %7
%9 = xor i32 %8, -1
ret i32 %9
}

LLVM IR (-O2):
@INT_MIN = global i64 0
define i32 @test6u(i32 %0) {
%2 = load i64, i64* @INT_MIN
%3 = trunc i64 %2 to i32
%4 = xor i32 %0, -1
%5 = add i32 %3, %4
ret i32 %5
}
int modulo(int n, int M) { return ((n % M) + M) % M; }


x86 assembly (clang, -O0):
<modulo>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    %edx,%eax
add    -0x8(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    %edx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<modulo>:
mov    %edi,%eax
cltd
idiv   %esi
lea    (%rdx,%rsi,1),%eax
cltd
idiv   %esi
mov    %edx,%eax
ret

LLVM IR (-O0):
define i32 @modulo(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = srem i32 %5, %6
%8 = load i32, i32* %4
%9 = add nsw i32 %7, %8
%10 = load i32, i32* %4
%11 = srem i32 %9, %10
ret i32 %11
}

LLVM IR (-O2):
define i32 @modulo(i32 %0, i32 %1) {
%3 = srem i32 %0, %1
%4 = add nsw i32 %3, %1
%5 = srem i32 %4, %1
ret i32 %5
}
int get_uptime(void) { return 0; }


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

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

LLVM IR (-O0):
define i32 @get_uptime() {
ret i32 0
}

LLVM IR (-O2):
define i32 @get_uptime() {
ret i32 0
}
/* Variables and functions */
int strcasecmp(char const *, char const *);
int namelist_cmp(const void *a, const void *b) {
  return strcasecmp(*(const char **)a, *(const char **)b);
}


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

x86 assembly (clang, -O2):
<namelist_cmp>:
mov    (%rdi),%rdi
mov    (%rsi),%rsi
jmp    1030 <strcasecmp@plt>

LLVM IR (-O0):
define i32 @namelist_cmp(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = bitcast i8* %5 to i8**
%7 = load i8*, i8** %6
%8 = load i8*, i8** %4
%9 = bitcast i8* %8 to i8**
%10 = load i8*, i8** %9
%11 = call i32 @strcasecmp(i8* %7, i8* %10)
ret i32 %11
}

LLVM IR (-O2):
define i32 @namelist_cmp(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i8**
%4 = load i8*, i8** %3
%5 = bitcast i8* %1 to i8**
%6 = load i8*, i8** %5
%7 = tail call i32 @strcasecmp(i8* %4, i8* %6)
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main(void) {
  int x;
  printf("x: ");
  scanf("%i", &x);
  printf("x: %i\n", x);
}


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

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

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

LLVM IR (-O2):
@.str = [4 x i8] c"x: \00"
@.str.1 = [3 x i8] c"%i\00"
@.str.2 = [7 x i8] c"x: %i\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 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 ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32 %5)
ret i32 0
}
int fun_base_fun_2(int a, int b) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @fun_base_fun_2(i32 %0, i32 %1) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ usb_init();
int /*<<< orphan*/ usb_set_debug(int /*<<< orphan*/);
void owon_usb_init() {
  usb_init();
  usb_set_debug(0);
}


x86 assembly (clang, -O0):
<owon_usb_init>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <usb_init@plt>
xor    %edi,%edi
call   1040 <usb_set_debug@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<owon_usb_init>:
push   %rax
xor    %eax,%eax
call   1030 <usb_init@plt>
xor    %edi,%edi
pop    %rax
jmp    1040 <usb_set_debug@plt>

LLVM IR (-O0):
define void @owon_usb_init() {
%1 = call i32 (...) @usb_init()
%2 = call i32 @usb_set_debug(i32 0)
ret void
}

LLVM IR (-O2):
define void @owon_usb_init() {
%1 = tail call i32 (...) @usb_init()
%2 = tail call i32 @usb_set_debug(i32 0)
ret void
}
int test() { return 11; }


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

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

LLVM IR (-O0):
define i32 @test() {
ret i32 11
}

LLVM IR (-O2):
define i32 @test() {
ret i32 11
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ uart_read();
void sigio_handler(int sig) {
  printf("Received data from UART\n");
  uart_read();
}


x86 assembly (clang, -O0):
<sigio_handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xece(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1030 <uart_read@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sigio_handler>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <uart_read@plt>

LLVM IR (-O0):
@.str = [25 x i8] c"Received data from UART\0A\00"
define void @sigio_handler(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%4 = call i32 (...) @uart_read()
ret void
}

LLVM IR (-O2):
@str = [24 x i8] c"Received data from UART\00"
define void @sigio_handler(i32 %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 (...) @uart_read()
ret void
}
/* Type definitions */
struct in_addr {
  int dummy;
};

/* Variables and functions */
char *inet_ntoa_r(struct in_addr, char *);
char *inet_ntoa(struct in_addr in) {
  static char buf[16];
  return (inet_ntoa_r(in, buf));
}


x86 assembly (clang, -O0):
<inet_ntoa>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
lea    0x2f1b(%rip),%rsi
call   1030 <inet_ntoa_r@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<inet_ntoa>:
lea    0x2f29(%rip),%rsi
jmp    1030 <inet_ntoa_r@plt>

LLVM IR (-O0):
%struct.in_addr = type { i32 }
@inet_ntoa.buf = internal global [16 x i8] zeroinitializer
define i8* @inet_ntoa(i32 %0) {
%2 = alloca %struct.in_addr
%3 = getelementptr inbounds %struct.in_addr, %struct.in_addr* %2, i32 0, i32 0
store i32 %0, i32* %3
%4 = getelementptr inbounds %struct.in_addr, %struct.in_addr* %2, i32 0, i32 0
%5 = load i32, i32* %4
%6 = call i8* @inet_ntoa_r(i32 %5, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @inet_ntoa.buf, i64 0, i64 0))
ret i8* %6
}

LLVM IR (-O2):
@inet_ntoa.buf = internal global [16 x i8] zeroinitializer
define i8* @inet_ntoa(i32 %0) {
%2 = tail call i8* @inet_ntoa_r(i32 %0, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @inet_ntoa.buf, i64 0, i64 0))
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void printUsage(char *fname) {
  printf("\nLittle hax for playing different music during Ys II Special intro"
         "\nUsage:\n"
         "   %s <input file> <output file>\n",
         fname);
}


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

x86 assembly (clang, -O2):
<printUsage>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [108 x i8] c"\0ALittle hax for playing different music during Ys II Special intro\0AUsage:\0A %s <input file> <output file>\0A\00"
define void @printUsage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([108 x i8], [108 x i8]* @.str, i64 0, i64 0), i8* %3)
ret void
}

LLVM IR (-O2):
@.str = [108 x i8] c"\0ALittle hax for playing different music during Ys II Special intro\0AUsage:\0A %s <input file> <output file>\0A\00"
define void @printUsage(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([108 x i8], [108 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
char *strtok_r(char *s, const char *delim, char **ptrptr) { return NULL; }


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

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

LLVM IR (-O0):
define i8* @strtok_r(i8* %0, i8* %1, i8** %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
ret i8* null
}

LLVM IR (-O2):
define noalias i8* @strtok_r(i8* nocapture readnone %0, i8* nocapture readnone %1, i8** nocapture readnone %2) {
ret i8* null
}
/* Variables and functions */
int /*<<< orphan*/ SendToReceiver(int);
void SendNoteOn(int note) { SendToReceiver(note); }


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

x86 assembly (clang, -O2):
<SendNoteOn>:
jmp    1030 <SendToReceiver@plt>

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

LLVM IR (-O2):
define void @SendNoteOn(i32 %0) {
%2 = tail call i32 @SendToReceiver(i32 %0)
ret void
}
int test_imm_E4int16_reg(short val) {
  return ((val) & (-0xE4 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_E4int16_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movswl -0x2(%rbp),%edx
and    $0xffffff1c,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_E4int16_reg>:
test   $0xff1c,%edi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_E4int16_reg(i16 signext %0) {
%2 = and i16 %0, -228
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
main() {
  printf("hello, ");
  printf("world");
  printf("\n");
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
call   1040 <printf@plt>
lea    0xed4(%rip),%rdi
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [8 x i8] c"hello, \00"
@.str.1 = [6 x i8] c"world\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @putchar(i32 10)
ret i32 0
}
struct ioat_dma_device *dma_device_to_ioat(struct dma_device *dev) {
  return (struct ioat_dma_device *)dev;
}


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

x86 assembly (clang, -O2):
<dma_device_to_ioat>:
mov    %rdi,%rax
ret

LLVM IR (-O0):
%struct.ioat_dma_device = type opaque
%struct.dma_device = type opaque
define %struct.ioat_dma_device* @dma_device_to_ioat(%struct.dma_device* %0) {
%2 = alloca %struct.dma_device*
store %struct.dma_device* %0, %struct.dma_device** %2
%3 = load %struct.dma_device*, %struct.dma_device** %2
%4 = bitcast %struct.dma_device* %3 to %struct.ioat_dma_device*
ret %struct.ioat_dma_device* %4
}

LLVM IR (-O2):
%struct.ioat_dma_device = type opaque
%struct.dma_device = type opaque
define %struct.ioat_dma_device* @dma_device_to_ioat(%struct.dma_device* readnone %0) {
%2 = bitcast %struct.dma_device* %0 to %struct.ioat_dma_device*
ret %struct.ioat_dma_device* %2
}
/* Variables and functions */
scalar_t__ nrfx_usbd_errata_type_52833();
scalar_t__ nrfx_usbd_errata_type_52840_eng_b_or_later();
bool nrfx_usbd_errata_187(void) {
  return (1 && (nrfx_usbd_errata_type_52840_eng_b_or_later() ||
                nrfx_usbd_errata_type_52833()));
}


x86 assembly (clang, -O0):
<nrfx_usbd_errata_187>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <nrfx_usbd_errata_type_52840_eng_b_or_later@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0x1(%rbp)
jne    1152 <nrfx_usbd_errata_187+0x32>
mov    $0x0,%al
call   1040 <nrfx_usbd_errata_type_52833@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x1(%rbp)
mov    -0x1(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nrfx_usbd_errata_187>:
push   %rax
xor    %eax,%eax
call   1030 <nrfx_usbd_errata_type_52840_eng_b_or_later@plt>
mov    %rax,%rcx
mov    $0x1,%eax
test   %rcx,%rcx
je     1137 <nrfx_usbd_errata_187+0x17>
pop    %rcx
ret
xor    %eax,%eax
call   1040 <nrfx_usbd_errata_type_52833@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
setne  %al
pop    %rcx
ret

LLVM IR (-O0):
define i32 @nrfx_usbd_errata_187() {
%1 = call i64 (...) @nrfx_usbd_errata_type_52840_eng_b_or_later()
%2 = icmp ne i64 %1, 0
br i1 %2, label %6, label %3
3: ; preds = %0
%4 = call i64 (...) @nrfx_usbd_errata_type_52833()
%5 = icmp ne i64 %4, 0
br label %6
6: ; preds = %3, %0
%7 = phi i1 [ true, %0 ], [ %5, %3 ]
%8 = zext i1 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @nrfx_usbd_errata_187() {
%1 = tail call i64 (...) @nrfx_usbd_errata_type_52840_eng_b_or_later()
%2 = icmp eq i64 %1, 0
br i1 %2, label %3, label %7
3: ; preds = %0
%4 = tail call i64 (...) @nrfx_usbd_errata_type_52833()
%5 = icmp ne i64 %4, 0
%6 = zext i1 %5 to i32
br label %7
7: ; preds = %3, %0
%8 = phi i32 [ 1, %0 ], [ %6, %3 ]
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ Manual(char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
int main(int argc, char **argv) {
  if (argc != 2) {
    fprintf(stderr, "Usage: build_solutions_guide <examples-dir> < in > out\n");
    return 2;
  }
  Manual(argv[1]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     1161 <main+0x41>
mov    0x2e99(%rip),%rax
mov    (%rax),%edi
lea    0xeb0(%rip),%rsi
call   1040 <fprintf@plt>
movl   $0x2,-0x4(%rbp)
jmp    1175 <main+0x55>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <Manual@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
cmp    $0x2,%edi
jne    1133 <main+0x13>
mov    0x8(%rsi),%rdi
call   1030 <Manual@plt>
xor    %eax,%eax
pop    %rcx
ret
mov    0x2ea6(%rip),%rax
mov    (%rax),%edi
lea    0xebd(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x2,%eax
pop    %rcx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [56 x i8] c"Usage: build_solutions_guide <examples-dir> < in > out\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = icmp ne i32 %6, 2
br i1 %7, label %8, label %11
8: ; preds = %2
%9 = load i32, i32* @stderr
%10 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0))
store i32 2, i32* %3
br label %16
11: ; preds = %2
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
%15 = call i32 @Manual(i8* %14)
store i32 0, i32* %3
br label %16
16: ; preds = %11, %8
%17 = load i32, i32* %3
ret i32 %17
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [56 x i8] c"Usage: build_solutions_guide <examples-dir> < in > out\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %7, label %4
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0))
br label %11
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = tail call i32 @Manual(i8* %9)
br label %11
11: ; preds = %7, %4
%12 = phi i32 [ 2, %4 ], [ 0, %7 ]
ret i32 %12
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int s(int, int);
uint32_t s_1(uint32_t x) { return s(x, 6) ^ s(x, 11) ^ s(x, 25); }


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

x86 assembly (clang, -O2):
<s_1>:
push   %rbp
push   %r14
push   %rbx
mov    %edi,%ebx
mov    $0x6,%esi
call   1030 <s@plt>
mov    %eax,%r14d
mov    %ebx,%edi
mov    $0xb,%esi
call   1030 <s@plt>
mov    %eax,%ebp
xor    %r14d,%ebp
mov    %ebx,%edi
mov    $0x19,%esi
call   1030 <s@plt>
xor    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @s_1(i32 %0) {
%2 = tail call i32 @s(i32 %0, i32 6)
%3 = tail call i32 @s(i32 %0, i32 11)
%4 = xor i32 %3, %2
%5 = tail call i32 @s(i32 %0, i32 25)
%6 = xor i32 %4, %5
ret i32 %6
}
int test_brak() {
  int *pi;
  int y;
  pi[y = 2];
  return 0;
}


x86 assembly (clang, -O0):
<test_brak>:
push   %rbp
mov    %rsp,%rbp
movl   $0x2,-0xc(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @test_brak() {
%1 = alloca i32*
%2 = alloca i32
%3 = load i32*, i32** %1
store i32 2, i32* %2
%4 = getelementptr inbounds i32, i32* %3, i64 2
%5 = load i32, i32* %4
ret i32 0
}

LLVM IR (-O2):
define i32 @test_brak() {
ret i32 0
}
/* Variables and functions */
scalar_t__ hypot(double, double);
float hypotf(float x, float y) { return (float)hypot((double)x, (double)y); }


x86 assembly (clang, -O0):
<hypotf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x8(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
call   1030 <hypot@plt>
cvtsi2ss %rax,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hypotf>:
push   %rax
cvtss2sd %xmm0,%xmm0
cvtss2sd %xmm1,%xmm1
call   1030 <hypot@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %rax,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @hypotf(float %0, float %1) {
%3 = alloca float
%4 = alloca float
store float %0, float* %3
store float %1, float* %4
%5 = load float, float* %3
%6 = fpext float %5 to double
%7 = load float, float* %4
%8 = fpext float %7 to double
%9 = call i64 @hypot(double %6, double %8)
%10 = sitofp i64 %9 to float
ret float %10
}

LLVM IR (-O2):
define float @hypotf(float %0, float %1) {
%3 = fpext float %0 to double
%4 = fpext float %1 to double
%5 = tail call i64 @hypot(double %3, double %4)
%6 = sitofp i64 %5 to float
ret float %6
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
int rfun(int);
int main(void) {
  int x = 0x73;
  int n = rfun(x);
  printf("0x%X: %d\n", x, n);
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [10 x i8] c"0x%X: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 115, i32* %2
%4 = load i32, i32* %2
%5 = call i32 @rfun(i32 %4)
store i32 %5, i32* %3
%6 = load i32, i32* %2
%7 = load i32, i32* %3
%8 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %6, i32 %7)
ret i32 0
}

LLVM IR (-O2):
@.str = [10 x i8] c"0x%X: %d\0A\00"
define i32 @main() {
%1 = tail call i32 @rfun(i32 115)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 115, i32 %1)
ret i32 0
}
/* Type definitions */
struct genlist {
  int dummy;
};
struct clause_list {
  int dummy;
};
struct Clause {
  int dummy;
};

/* Variables and functions */
scalar_t__ genlist_front(struct genlist const *);
struct Clause *clause_list_front(const struct clause_list *tthis) {
  return (struct Clause *)genlist_front((const struct genlist *)tthis);
}


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

x86 assembly (clang, -O2):
<clause_list_front>:
jmp    1030 <genlist_front@plt>

LLVM IR (-O0):
%struct.Clause = type { i32 }
%struct.clause_list = type { i32 }
%struct.genlist = type { i32 }
define %struct.Clause* @clause_list_front(%struct.clause_list* %0) {
%2 = alloca %struct.clause_list*
store %struct.clause_list* %0, %struct.clause_list** %2
%3 = load %struct.clause_list*, %struct.clause_list** %2
%4 = bitcast %struct.clause_list* %3 to %struct.genlist*
%5 = call i64 @genlist_front(%struct.genlist* %4)
%6 = inttoptr i64 %5 to %struct.Clause*
ret %struct.Clause* %6
}

LLVM IR (-O2):
%struct.Clause = type { i32 }
%struct.clause_list = type { i32 }
%struct.genlist = type { i32 }
define %struct.Clause* @clause_list_front(%struct.clause_list* %0) {
%2 = bitcast %struct.clause_list* %0 to %struct.genlist*
%3 = tail call i64 @genlist_front(%struct.genlist* %2)
%4 = inttoptr i64 %3 to %struct.Clause*
ret %struct.Clause* %4
}
unsigned short int f45(unsigned short int x, int y) {
  return (x >> y) | (x << (8 * sizeof(unsigned short) - y));
}


x86 assembly (clang, -O0):
<f45>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    %esi,-0x8(%rbp)
movzwl -0x2(%rbp),%eax
mov    -0x8(%rbp),%ecx
sar    %cl,%eax
movzwl -0x2(%rbp),%edx
movslq -0x8(%rbp),%rsi
mov    $0x10,%ecx
sub    %rsi,%rcx
shl    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
movzwl %ax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f45>:
mov    %esi,%ecx
mov    %edi,%eax
ror    %cl,%ax
ret

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

LLVM IR (-O2):
define zeroext i16 @f45(i16 zeroext %0, i32 %1) {
%3 = trunc i32 %1 to i16
%4 = tail call i16 @llvm.fshr.i16(i16 %0, i16 %0, i16 %3)
ret i16 %4
}
void DNegate(unsigned long long *dv) { *dv = 0 - (*dv); }


x86 assembly (clang, -O0):
<DNegate>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
xor    %ecx,%ecx
sub    (%rax),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<DNegate>:
negq   (%rdi)
ret

LLVM IR (-O0):
define void @DNegate(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64, i64* %3
%5 = sub i64 0, %4
%6 = load i64*, i64** %2
store i64 %5, i64* %6
ret void
}

LLVM IR (-O2):
define void @DNegate(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = sub i64 0, %2
store i64 %3, i64* %0
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ GLenum;

/* Variables and functions */
int /*<<< orphan*/ glColorMaterial(int /*<<< orphan*/, int /*<<< orphan*/);
void ColorMaterial(GLenum face, GLenum mode) { glColorMaterial(face, mode); }


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

x86 assembly (clang, -O2):
<ColorMaterial>:
jmp    1030 <glColorMaterial@plt>

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

LLVM IR (-O2):
define void @ColorMaterial(i32 %0, i32 %1) {
%3 = tail call i32 @glColorMaterial(i32 %0, i32 %1)
ret void
}
int func2(void) { return 2; }


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

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

LLVM IR (-O0):
define i32 @func2() {
ret i32 2
}

LLVM IR (-O2):
define i32 @func2() {
ret i32 2
}
/* Variables and functions */
int av_log2_c(int);
__attribute__((const)) int av_ceil_log2(int x) {
  return av_log2_c((x - 1) << 1);
}


x86 assembly (clang, -O0):
<av_ceil_log2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
sub    $0x1,%edi
shl    $0x1,%edi
call   1030 <av_log2_c@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<av_ceil_log2>:
add    %edi,%edi
add    $0xfffffffe,%edi
jmp    1030 <av_log2_c@plt>

LLVM IR (-O0):
define i32 @av_ceil_log2(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sub nsw i32 %3, 1
%5 = shl i32 %4, 1
%6 = call i32 @av_log2_c(i32 %5)
ret i32 %6
}

LLVM IR (-O2):
define i32 @av_ceil_log2(i32 %0) {
%2 = shl i32 %0, 1
%3 = add i32 %2, -2
%4 = tail call i32 @av_log2_c(i32 %3)
ret i32 %4
}
/* Variables and functions */
int EOPNOTSUPP;
int so_nosigpipe(int fd, _Bool nosigpipe) { return EOPNOTSUPP; }


x86 assembly (clang, -O0):
<so_nosigpipe>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %edi,-0x4(%rbp)
and    $0x1,%al
mov    %al,-0x5(%rbp)
mov    0x2eca(%rip),%rax
mov    (%rax),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<so_nosigpipe>:
mov    0x2ed9(%rip),%rax
mov    (%rax),%eax
ret

LLVM IR (-O0):
@EOPNOTSUPP = global i32 0
define i32 @so_nosigpipe(i32 %0, i1 zeroext %1) {
%3 = alloca i32
%4 = alloca i8
store i32 %0, i32* %3
%5 = zext i1 %1 to i8
store i8 %5, i8* %4
%6 = load i32, i32* @EOPNOTSUPP
ret i32 %6
}

LLVM IR (-O2):
@EOPNOTSUPP = global i32 0
define i32 @so_nosigpipe(i32 %0, i1 zeroext %1) {
%3 = load i32, i32* @EOPNOTSUPP
ret i32 %3
}
void gtk_table_set_row_spacing() {}


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

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

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

LLVM IR (-O2):
define void @gtk_table_set_row_spacing() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ WaitMouseMiddle273();
void waitmousemiddle() { WaitMouseMiddle273(); }


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

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

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

LLVM IR (-O2):
define void @waitmousemiddle() {
%1 = tail call i32 (...) @WaitMouseMiddle273()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ execlp(char *, char *, char *, int /*<<< orphan*/);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int main() {
  printf("Runnning ps with "
         "execlp-------------------------------------------------------------");
  execlp("ps", "ps", "ax", 0);
  printf("Done .\n");
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
call   1030 <printf@plt>
lea    0xf03(%rip),%rsi
lea    0xeff(%rip),%rdx
xor    %ecx,%ecx
mov    %rsi,%rdi
call   1050 <execlp@plt>
lea    0xef1(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xeb8(%rip),%rdi
call   1040 <printf@plt>
lea    0xf01(%rip),%rdi
lea    0xefd(%rip),%rdx
mov    %rdi,%rsi
xor    %ecx,%ecx
call   1060 <execlp@plt>
lea    0xeef(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [85 x i8] c"Runnning ps with execlp-------------------------------------------------------------\00"
@.str.1 = [3 x i8] c"ps\00"
@.str.2 = [3 x i8] c"ax\00"
@.str.3 = [8 x i8] c"Done .\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([85 x i8], [85 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @execlp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 0)
%4 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%5 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [85 x i8] c"Runnning ps with execlp-------------------------------------------------------------\00"
@.str.1 = [3 x i8] c"ps\00"
@.str.2 = [3 x i8] c"ax\00"
@str = [7 x i8] c"Done .\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([85 x i8], [85 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @execlp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 0)
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @exit(i32 0)
unreachable
}