xunge/DecIR huggingface dataset:
/* Variables and functions */
char *malloc(size_t);
scalar_t__ memcpy(char *, char const *, size_t);
int strlen(char const *);
char *tfx_strdup(const char *src) {
  size_t len = strlen(src) + 1;
  char *s = malloc(len);
  if (s == NULL)
    return NULL;
  return (char *)memcpy(s, src, len);
}


x86 assembly (clang, -O0):
<tfx_strdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
add    $0x1,%eax
cltq
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <malloc@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1173 <tfx_strdup+0x43>
movq   $0x0,-0x8(%rbp)
jmp    1188 <tfx_strdup+0x58>
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1040 <memcpy@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tfx_strdup>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1030 <strlen@plt>
add    $0x1,%eax
movslq %eax,%rbx
mov    %rbx,%rdi
call   1050 <malloc@plt>
test   %rax,%rax
je     115f <tfx_strdup+0x2f>
mov    %rax,%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1040 <memcpy@plt>
jmp    1161 <tfx_strdup+0x31>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @tfx_strdup(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i8*
store i8* %0, i8** %3
%6 = load i8*, i8** %3
%7 = call i32 @strlen(i8* %6)
%8 = add nsw i32 %7, 1
%9 = sext i32 %8 to i64
store i64 %9, i64* %4
%10 = load i64, i64* %4
%11 = call i8* @malloc(i64 %10)
store i8* %11, i8** %5
%12 = load i8*, i8** %5
%13 = icmp eq i8* %12, null
br i1 %13, label %14, label %15
14: ; preds = %1
store i8* null, i8** %2
br label %21
15: ; preds = %1
%16 = load i8*, i8** %5
%17 = load i8*, i8** %3
%18 = load i64, i64* %4
%19 = call i64 @memcpy(i8* %16, i8* %17, i64 %18)
%20 = inttoptr i64 %19 to i8*
store i8* %20, i8** %2
br label %21
21: ; preds = %15, %14
%22 = load i8*, i8** %2
ret i8* %22
}

LLVM IR (-O2):
define i8* @tfx_strdup(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = add nsw i32 %2, 1
%4 = sext i32 %3 to i64
%5 = tail call i8* @malloc(i64 %4)
%6 = icmp eq i8* %5, null
br i1 %6, label %10, label %7
7: ; preds = %1
%8 = tail call i64 @memcpy(i8* %5, i8* %0, i64 %4)
%9 = inttoptr i64 %8 to i8*
br label %10
10: ; preds = %1, %7
%11 = phi i8* [ %9, %7 ], [ null, %1 ]
ret i8* %11
}
/* Type definitions */
struct sockaddr {
  int dummy;
};
struct __uportsys_sockaddr {
  int dummy;
};
typedef int /*<<< orphan*/ socklen_t;

/* Variables and functions */
int __uportsys_getsockname(int, struct __uportsys_sockaddr *,
                           int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int /*<<< orphan*/ errno;
int getsockname(int sd, struct sockaddr *addr, socklen_t *addr_len) {
  return __uportsys_getsockname(sd, (struct __uportsys_sockaddr *)addr,
                                addr_len, &errno);
}


x86 assembly (clang, -O0):
<getsockname>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    0x2eab(%rip),%rcx
call   1030 <__uportsys_getsockname@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getsockname>:
mov    0x2ec9(%rip),%rcx
jmp    1030 <__uportsys_getsockname@plt>

LLVM IR (-O0):
%struct.sockaddr = type { i32 }
%struct.__uportsys_sockaddr = type { i32 }
@errno = global i32 0
define i32 @getsockname(i32 %0, %struct.sockaddr* %1, i32* %2) {
%4 = alloca i32
%5 = alloca %struct.sockaddr*
%6 = alloca i32*
store i32 %0, i32* %4
store %struct.sockaddr* %1, %struct.sockaddr** %5
store i32* %2, i32** %6
%7 = load i32, i32* %4
%8 = load %struct.sockaddr*, %struct.sockaddr** %5
%9 = bitcast %struct.sockaddr* %8 to %struct.__uportsys_sockaddr*
%10 = load i32*, i32** %6
%11 = call i32 @__uportsys_getsockname(i32 %7, %struct.__uportsys_sockaddr* %9, i32* %10, i32* @errno)
ret i32 %11
}

LLVM IR (-O2):
%struct.sockaddr = type { i32 }
%struct.__uportsys_sockaddr = type { i32 }
@errno = global i32 0
define i32 @getsockname(i32 %0, %struct.sockaddr* %1, i32* %2) {
%4 = bitcast %struct.sockaddr* %1 to %struct.__uportsys_sockaddr*
%5 = tail call i32 @__uportsys_getsockname(i32 %0, %struct.__uportsys_sockaddr* %4, i32* %2, i32* @errno)
ret i32 %5
}
/* Variables and functions */
void *calloc(size_t, size_t);
int /*<<< orphan*/ reuse_null_size();
int /*<<< orphan*/ reuse_out_of_mem();
void *xcalloc(size_t nitems, size_t elsize) {
  void *ptr;
  if (nitems == 0 || elsize == 0)
    reuse_null_size();
  ptr = calloc(nitems, elsize);
  if (ptr == NULL)
    reuse_out_of_mem();
  return ptr;
}


x86 assembly (clang, -O0):
<xcalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1156 <xcalloc+0x26>
cmpq   $0x0,-0x10(%rbp)
jne    115d <xcalloc+0x2d>
mov    $0x0,%al
call   1040 <reuse_null_size@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <calloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1180 <xcalloc+0x50>
mov    $0x0,%al
call   1050 <reuse_out_of_mem@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xcalloc>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
test   %rdi,%rdi
je     1144 <xcalloc+0x14>
test   %r14,%r14
jne    114b <xcalloc+0x1b>
xor    %eax,%eax
call   1040 <reuse_null_size@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <calloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1165 <xcalloc+0x35>
xor    %eax,%eax
call   1050 <reuse_out_of_mem@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @xcalloc(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i8*
store i64 %0, i64* %3
store i64 %1, i64* %4
%6 = load i64, i64* %3
%7 = icmp eq i64 %6, 0
br i1 %7, label %11, label %8
8: ; preds = %2
%9 = load i64, i64* %4
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %8, %2
%12 = call i32 (...) @reuse_null_size()
br label %13
13: ; preds = %11, %8
%14 = load i64, i64* %3
%15 = load i64, i64* %4
%16 = call i8* @calloc(i64 %14, i64 %15)
store i8* %16, i8** %5
%17 = load i8*, i8** %5
%18 = icmp eq i8* %17, null
br i1 %18, label %19, label %21
19: ; preds = %13
%20 = call i32 (...) @reuse_out_of_mem()
br label %21
21: ; preds = %19, %13
%22 = load i8*, i8** %5
ret i8* %22
}

LLVM IR (-O2):
define noalias i8* @xcalloc(i64 %0, i64 %1) {
%3 = icmp eq i64 %0, 0
%4 = icmp eq i64 %1, 0
%5 = or i1 %3, %4
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = tail call i32 (...) @reuse_null_size()
br label %8
8: ; preds = %2, %6
%9 = tail call i8* @calloc(i64 %0, i64 %1)
%10 = icmp eq i8* %9, null
br i1 %10, label %11, label %13
11: ; preds = %8
%12 = tail call i32 (...) @reuse_out_of_mem()
br label %13
13: ; preds = %11, %8
ret i8* %9
}
/* Variables and functions */
int asnReadLength(long *);
int asnReadOid(char *, int);
int asnReadOidL(char *id) {
  long length;
  if (asnReadLength(&length) == -1)
    return -1;
  return asnReadOid(id, (int)length);
}


x86 assembly (clang, -O0):
<asnReadOidL>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
lea    -0x18(%rbp),%rdi
call   1040 <asnReadLength@plt>
cmp    $0xffffffff,%eax
jne    114a <asnReadOidL+0x2a>
movl   $0xffffffff,-0x4(%rbp)
jmp    115c <asnReadOidL+0x3c>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rax
mov    %eax,%esi
call   1030 <asnReadOid@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<asnReadOidL>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
lea    0x8(%rsp),%rdi
call   1040 <asnReadLength@plt>
cmp    $0xffffffff,%eax
je     1145 <asnReadOidL+0x25>
mov    0x8(%rsp),%esi
mov    %rbx,%rdi
call   1030 <asnReadOid@plt>
jmp    114a <asnReadOidL+0x2a>
mov    $0xffffffff,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @asnReadOidL(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
%5 = call i32 @asnReadLength(i64* %4)
%6 = icmp eq i32 %5, -1
br i1 %6, label %7, label %8
7: ; preds = %1
store i32 -1, i32* %2
br label %13
8: ; preds = %1
%9 = load i8*, i8** %3
%10 = load i64, i64* %4
%11 = trunc i64 %10 to i32
%12 = call i32 @asnReadOid(i8* %9, i32 %11)
store i32 %12, i32* %2
br label %13
13: ; preds = %8, %7
%14 = load i32, i32* %2
ret i32 %14
}

LLVM IR (-O2):
define i32 @asnReadOidL(i8* %0) {
%2 = alloca i64
%3 = bitcast i64* %2 to i8*
%4 = call i32 @asnReadLength(i64* %2)
%5 = icmp eq i32 %4, -1
br i1 %5, label %10, label %6
6: ; preds = %1
%7 = load i64, i64* %2
%8 = trunc i64 %7 to i32
%9 = call i32 @asnReadOid(i8* %0, i32 %8)
br label %10
10: ; preds = %1, %6
%11 = phi i32 [ %9, %6 ], [ -1, %1 ]
ret i32 %11
}
void reverse_array(int *p, int size) {
  int *start = p;
  int *end = p + (size - 1);
  int temp;
  while (start != end) {
    temp = *start;
    *start = *end;
    *end = temp;
    start++;
    end--;
  }
  return;
}


x86 assembly (clang, -O0):
<reverse_array>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x20(%rbp),%rax
je     1174 <reverse_array+0x74>
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x24(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x24(%rbp),%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x18(%rbp)
mov    -0x20(%rbp),%rax
add    $0xfffffffffffffffc,%rax
mov    %rax,-0x20(%rbp)
jmp    112b <reverse_array+0x2b>
pop    %rbp
ret

x86 assembly (clang, -O2):
<reverse_array>:
add    $0xffffffff,%esi
je     112a <reverse_array+0x2a>
movslq %esi,%rax
lea    (%rdi,%rax,4),%rax
add    $0xfffffffffffffffc,%rax
mov    (%rdi),%ecx
mov    0x4(%rax),%edx
mov    %edx,(%rdi)
mov    %ecx,0x4(%rax)
add    $0x4,%rdi
lea    -0x4(%rax),%rcx
cmp    %rdi,%rax
mov    %rcx,%rax
jne    1110 <reverse_array+0x10>
ret

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

LLVM IR (-O2):
define void @reverse_array(i32* %0, i32 %1) {
%3 = add nsw i32 %1, -1
%4 = icmp eq i32 %3, 0
br i1 %4, label %16, label %5
5: ; preds = %2
%6 = sext i32 %3 to i64
%7 = getelementptr inbounds i32, i32* %0, i64 %6
br label %8
8: ; preds = %5, %8
%9 = phi i32* [ %13, %8 ], [ %0, %5 ]
%10 = phi i32* [ %14, %8 ], [ %7, %5 ]
%11 = load i32, i32* %9
%12 = load i32, i32* %10
store i32 %12, i32* %9
store i32 %11, i32* %10
%13 = getelementptr inbounds i32, i32* %9, i64 1
%14 = getelementptr inbounds i32, i32* %10, i64 -1
%15 = icmp eq i32* %13, %14
br i1 %15, label %16, label %8
16: ; preds = %8, %2
ret void
}
void sec2msf(unsigned int s, char *msf) {
  msf[0] = s / 75 / 60;
  s = s - msf[0] * 75 * 60;
  msf[1] = s / 75;
  s = s - msf[1] * 75;
  msf[2] = s;
}


x86 assembly (clang, -O0):
<sec2msf>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x4b,%ecx
xor    %edx,%edx
div    %ecx
mov    $0x3c,%ecx
xor    %edx,%edx
div    %ecx
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
mov    -0x4(%rbp),%eax
mov    -0x10(%rbp),%rcx
movsbl (%rcx),%ecx
imul   $0x4b,%ecx,%ecx
imul   $0x3c,%ecx,%ecx
sub    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x4b,%ecx
xor    %edx,%edx
div    %ecx
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,0x1(%rax)
mov    -0x4(%rbp),%eax
mov    -0x10(%rbp),%rcx
movsbl 0x1(%rcx),%ecx
imul   $0x4b,%ecx,%ecx
sub    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,0x2(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<sec2msf>:
mov    %edi,%eax
mov    $0xe90452d5,%ecx
imul   %rax,%rcx
shr    $0x2c,%rcx
mov    %cl,(%rsi)
movsbl %cl,%eax
imul   $0xffffee6c,%eax,%eax
add    %edi,%eax
imul   $0x1b4e81b5,%rax,%rcx
shr    $0x23,%rcx
mov    %cl,0x1(%rsi)
imul   $0xffffffb5,%ecx,%ecx
add    %eax,%ecx
mov    %cl,0x2(%rsi)
ret

LLVM IR (-O0):
define void @sec2msf(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
%5 = load i32, i32* %3
%6 = udiv i32 %5, 75
%7 = udiv i32 %6, 60
%8 = trunc i32 %7 to i8
%9 = load i8*, i8** %4
%10 = getelementptr inbounds i8, i8* %9, i64 0
store i8 %8, i8* %10
%11 = load i32, i32* %3
%12 = load i8*, i8** %4
%13 = getelementptr inbounds i8, i8* %12, i64 0
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = mul nsw i32 %15, 75
%17 = mul nsw i32 %16, 60
%18 = sub i32 %11, %17
store i32 %18, i32* %3
%19 = load i32, i32* %3
%20 = udiv i32 %19, 75
%21 = trunc i32 %20 to i8
%22 = load i8*, i8** %4
%23 = getelementptr inbounds i8, i8* %22, i64 1
store i8 %21, i8* %23
%24 = load i32, i32* %3
%25 = load i8*, i8** %4
%26 = getelementptr inbounds i8, i8* %25, i64 1
%27 = load i8, i8* %26
%28 = sext i8 %27 to i32
%29 = mul nsw i32 %28, 75
%30 = sub i32 %24, %29
store i32 %30, i32* %3
%31 = load i32, i32* %3
%32 = trunc i32 %31 to i8
%33 = load i8*, i8** %4
%34 = getelementptr inbounds i8, i8* %33, i64 2
store i8 %32, i8* %34
ret void
}

LLVM IR (-O2):
define void @sec2msf(i32 %0, i8* nocapture writeonly %1) {
%3 = udiv i32 %0, 4500
%4 = trunc i32 %3 to i8
store i8 %4, i8* %1
%5 = shl i32 %3, 24
%6 = ashr exact i32 %5, 24
%7 = mul nsw i32 %6, -4500
%8 = add i32 %7, %0
%9 = udiv i32 %8, 75
%10 = trunc i32 %9 to i8
%11 = getelementptr inbounds i8, i8* %1, i64 1
store i8 %10, i8* %11
%12 = shl i32 %9, 24
%13 = ashr exact i32 %12, 24
%14 = mul nsw i32 %13, -75
%15 = add i32 %14, %8
%16 = trunc i32 %15 to i8
%17 = getelementptr inbounds i8, i8* %1, i64 2
store i8 %16, i8* %17
ret void
}
/* Variables and functions */
int /*<<< orphan*/ lcd_draw_hline(int, int, int, int);
int /*<<< orphan*/ lcd_draw_vline(int, int, int, int);
void lcd_draw_cross(int row, int col, int halflen, int color) {
  lcd_draw_hline(row, col - halflen, col + halflen, color);
  lcd_draw_vline(col, row - halflen, row + halflen, color);
}


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

x86 assembly (clang, -O2):
<lcd_draw_cross>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %ecx,%r14d
mov    %edx,%ebx
mov    %esi,%r15d
mov    %edi,%ebp
sub    %edx,%esi
lea    (%rbx,%r15,1),%edx
call   1030 <lcd_draw_hline@plt>
mov    %ebp,%esi
sub    %ebx,%esi
add    %ebp,%ebx
mov    %r15d,%edi
mov    %ebx,%edx
mov    %r14d,%ecx
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <lcd_draw_vline@plt>

LLVM IR (-O0):
define void @lcd_draw_cross(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32, i32* %5
%10 = load i32, i32* %6
%11 = load i32, i32* %7
%12 = sub nsw i32 %10, %11
%13 = load i32, i32* %6
%14 = load i32, i32* %7
%15 = add nsw i32 %13, %14
%16 = load i32, i32* %8
%17 = call i32 @lcd_draw_hline(i32 %9, i32 %12, i32 %15, i32 %16)
%18 = load i32, i32* %6
%19 = load i32, i32* %5
%20 = load i32, i32* %7
%21 = sub nsw i32 %19, %20
%22 = load i32, i32* %5
%23 = load i32, i32* %7
%24 = add nsw i32 %22, %23
%25 = load i32, i32* %8
%26 = call i32 @lcd_draw_vline(i32 %18, i32 %21, i32 %24, i32 %25)
ret void
}

LLVM IR (-O2):
define void @lcd_draw_cross(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = sub nsw i32 %1, %2
%6 = add nsw i32 %2, %1
%7 = tail call i32 @lcd_draw_hline(i32 %0, i32 %5, i32 %6, i32 %3)
%8 = sub nsw i32 %0, %2
%9 = add nsw i32 %2, %0
%10 = tail call i32 @lcd_draw_vline(i32 %1, i32 %8, i32 %9, i32 %3)
ret void
}
/* Variables and functions */
int a();
scalar_t__ b();
scalar_t__ c();
main() { return a() & b() == c(); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1050 <a@plt>
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1030 <b@plt>
mov    %rax,-0x10(%rbp)
mov    $0x0,%al
call   1040 <c@plt>
mov    -0x10(%rbp),%rcx
mov    %rax,%rdx
mov    -0x8(%rbp),%eax
cmp    %rdx,%rcx
sete   %cl
and    $0x1,%cl
movzbl %cl,%ecx
and    %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
xor    %eax,%eax
call   1050 <a@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   1030 <b@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1040 <c@plt>
xor    %ecx,%ecx
cmp    %rax,%rbx
sete   %cl
and    %ebp,%ecx
mov    %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @a()
%3 = call i64 (...) @b()
%4 = call i64 (...) @c()
%5 = icmp eq i64 %3, %4
%6 = zext i1 %5 to i32
%7 = and i32 %2, %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @a()
%2 = tail call i64 (...) @b()
%3 = tail call i64 (...) @c()
%4 = icmp eq i64 %2, %3
%5 = zext i1 %4 to i32
%6 = and i32 %1, %5
ret i32 %6
}
int __attribute__((weak)) weak() { return 0; }


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

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

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

LLVM IR (-O2):
define weak i32 @weak() {
ret i32 0
}
int get_grid_point_single_mesh(const int address[3], const int mesh[3]) {
  return address[2] * mesh[0] * mesh[1] + address[1] * mesh[0] + address[0];
}


x86 assembly (clang, -O0):
<get_grid_point_single_mesh>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%eax
mov    -0x10(%rbp),%rcx
imul   (%rcx),%eax
mov    -0x10(%rbp),%rcx
imul   0x4(%rcx),%eax
mov    -0x8(%rbp),%rcx
mov    0x4(%rcx),%ecx
mov    -0x10(%rbp),%rdx
imul   (%rdx),%ecx
add    %ecx,%eax
mov    -0x8(%rbp),%rcx
add    (%rcx),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_grid_point_single_mesh>:
mov    0x4(%rsi),%eax
imul   0x8(%rdi),%eax
add    0x4(%rdi),%eax
imul   (%rsi),%eax
add    (%rdi),%eax
ret

LLVM IR (-O0):
define i32 @get_grid_point_single_mesh(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 = getelementptr inbounds i32, i32* %5, i64 2
%7 = load i32, i32* %6
%8 = load i32*, i32** %4
%9 = getelementptr inbounds i32, i32* %8, i64 0
%10 = load i32, i32* %9
%11 = mul nsw i32 %7, %10
%12 = load i32*, i32** %4
%13 = getelementptr inbounds i32, i32* %12, i64 1
%14 = load i32, i32* %13
%15 = mul nsw i32 %11, %14
%16 = load i32*, i32** %3
%17 = getelementptr inbounds i32, i32* %16, i64 1
%18 = load i32, i32* %17
%19 = load i32*, i32** %4
%20 = getelementptr inbounds i32, i32* %19, i64 0
%21 = load i32, i32* %20
%22 = mul nsw i32 %18, %21
%23 = add nsw i32 %15, %22
%24 = load i32*, i32** %3
%25 = getelementptr inbounds i32, i32* %24, i64 0
%26 = load i32, i32* %25
%27 = add nsw i32 %23, %26
ret i32 %27
}

LLVM IR (-O2):
define i32 @get_grid_point_single_mesh(i32* nocapture %0, i32* nocapture %1) {
%3 = getelementptr inbounds i32, i32* %0, i64 2
%4 = load i32, i32* %3
%5 = load i32, i32* %1
%6 = getelementptr inbounds i32, i32* %1, i64 1
%7 = load i32, i32* %6
%8 = mul i32 %7, %4
%9 = getelementptr inbounds i32, i32* %0, i64 1
%10 = load i32, i32* %9
%11 = load i32, i32* %0
%12 = add i32 %10, %8
%13 = mul i32 %12, %5
%14 = add i32 %13, %11
ret i32 %14
}
void RTLockValidatorRecSharedResetOwner(void) {}


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

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

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

LLVM IR (-O2):
define void @RTLockValidatorRecSharedResetOwner() {
ret void
}
void strength_result2(int *data) {
  int k = data[0];
  int i = 0;
  do {
    data[data[2]] = 2;
    i = i + k;
  } while (i < data[1]);
}


x86 assembly (clang, -O0):
<strength_result2>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x8(%rbp),%rcx
movslq 0x8(%rcx),%rcx
movl   $0x2,(%rax,%rcx,4)
mov    -0x10(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    -0x8(%rbp),%rcx
cmp    0x4(%rcx),%eax
jl     1118 <strength_result2+0x18>
pop    %rbp
ret

x86 assembly (clang, -O2):
<strength_result2>:
mov    (%rdi),%eax
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    %eax,%ecx
movslq 0x8(%rdi),%rdx
movl   $0x2,(%rdi,%rdx,4)
cmp    0x4(%rdi),%ecx
jl     1110 <strength_result2+0x10>
ret

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

LLVM IR (-O2):
define void @strength_result2(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = getelementptr inbounds i32, i32* %0, i64 2
%4 = getelementptr inbounds i32, i32* %0, i64 1
br label %5
5: ; preds = %5, %1
%6 = phi i32 [ 0, %1 ], [ %10, %5 ]
%7 = load i32, i32* %3
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds i32, i32* %0, i64 %8
store i32 2, i32* %9
%10 = add nsw i32 %6, %2
%11 = load i32, i32* %4
%12 = icmp slt i32 %10, %11
br i1 %12, label %5, label %13
13: ; preds = %5
ret void
}
/* Type definitions */
typedef scalar_t__ uint32_t;
typedef int uint16_t;

/* Variables and functions */
int /*<<< orphan*/ snprintf(char *, int, char *, int);
void i830_16bit_func(char *result, int len, int reg, uint32_t val,
                     uint32_t devid) {
  snprintf(result, len, "0x%04x", (uint16_t)val);
}


x86 assembly (clang, -O0):
<i830_16bit_func>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rax
mov    %eax,%ecx
lea    0xec2(%rip),%rdx
call   1030 <snprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<i830_16bit_func>:
lea    0xee9(%rip),%rdx
jmp    1030 <snprintf@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"0x%04x\00"
define void @i830_16bit_func(i8* %0, i32 %1, i32 %2, i64 %3, i64 %4) {
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i64
%10 = alloca i64
store i8* %0, i8** %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i64 %3, i64* %9
store i64 %4, i64* %10
%11 = load i8*, i8** %6
%12 = load i32, i32* %7
%13 = load i64, i64* %9
%14 = trunc i64 %13 to i32
%15 = call i32 @snprintf(i8* %11, i32 %12, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %14)
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"0x%04x\00"
define void @i830_16bit_func(i8* %0, i32 %1, i32 %2, i64 %3, i64 %4) {
%6 = trunc i64 %3 to i32
%7 = tail call i32 @snprintf(i8* %0, i32 %1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %6)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ ASN1_VALUE;
typedef int /*<<< orphan*/ ASN1_BIT_STRING;

/* Variables and functions */
int /*<<< orphan*/ ASN1_BIT_STRING_it;
scalar_t__ ASN1_item_d2i(int /*<<< orphan*/ **, unsigned char const **, long,
                         int /*<<< orphan*/ *);
ASN1_BIT_STRING *d2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a,
                                     const unsigned char **in, long len) {
  return (ASN1_BIT_STRING *)ASN1_item_d2i((ASN1_VALUE **)a, in, len,
                                          &ASN1_BIT_STRING_it);
}


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

x86 assembly (clang, -O2):
<d2i_ASN1_BIT_STRING>:
mov    0x2ec9(%rip),%rcx
jmp    1030 <ASN1_item_d2i@plt>

LLVM IR (-O0):
@ASN1_BIT_STRING_it = global i32 0
define i32* @d2i_ASN1_BIT_STRING(i32** %0, i8** %1, i64 %2) {
%4 = alloca i32**
%5 = alloca i8**
%6 = alloca i64
store i32** %0, i32*** %4
store i8** %1, i8*** %5
store i64 %2, i64* %6
%7 = load i32**, i32*** %4
%8 = load i8**, i8*** %5
%9 = load i64, i64* %6
%10 = call i64 @ASN1_item_d2i(i32** %7, i8** %8, i64 %9, i32* @ASN1_BIT_STRING_it)
%11 = inttoptr i64 %10 to i32*
ret i32* %11
}

LLVM IR (-O2):
@ASN1_BIT_STRING_it = global i32 0
define i32* @d2i_ASN1_BIT_STRING(i32** %0, i8** %1, i64 %2) {
%4 = tail call i64 @ASN1_item_d2i(i32** %0, i8** %1, i64 %2, i32* @ASN1_BIT_STRING_it)
%5 = inttoptr i64 %4 to i32*
ret i32* %5
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ asprintf(char **, char *, float, int /*<<< orphan*/);
char *fmt_f32(float num) {
  uint32_t single_as_hex = *(uint32_t *)&num;
  char *fmt;
  asprintf(&fmt, "f32(%02.20a:%#010x)", num, single_as_hex);
  return fmt;
}


x86 assembly (clang, -O0):
<fmt_f32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
mov    -0x8(%rbp),%edx
lea    -0x10(%rbp),%rdi
lea    0xeca(%rip),%rsi
call   1030 <asprintf@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fmt_f32>:
push   %rax
movd   %xmm0,%edx
lea    0xee4(%rip),%rsi
mov    %rsp,%rdi
call   1030 <asprintf@plt>
mov    (%rsp),%rax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [20 x i8] c"f32(%02.20a:%x)\00"
define i8* @fmt_f32(float %0) {
%2 = alloca float
%3 = alloca i32
%4 = alloca i8*
store float %0, float* %2
%5 = bitcast float* %2 to i32*
%6 = load i32, i32* %5
store i32 %6, i32* %3
%7 = load float, float* %2
%8 = load i32, i32* %3
%9 = call i32 @asprintf(i8** %4, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), float %7, i32 %8)
%10 = load i8*, i8** %4
ret i8* %10
}

LLVM IR (-O2):
@.str = [20 x i8] c"f32(%02.20a:%x)\00"
define i8* @fmt_f32(float %0) {
%2 = alloca i8*
%3 = bitcast float %0 to i32
%4 = bitcast i8** %2 to i8*
%5 = call i32 @asprintf(i8** %2, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), float %0, i32 %3)
%6 = load i8*, i8** %2
ret i8* %6
}
/* Type definitions */
typedef int uint8_t;
typedef int /*<<< orphan*/ uint16_t;
typedef scalar_t__ int16_t;

/* Variables and functions */
int /*<<< orphan*/ __wleu16(int *, int /*<<< orphan*/);
int i2c_transact(int, int, int *, int, int /*<<< orphan*/);
int i2c_write_leint16(int fd, int chip_addr, int reg, int16_t value) {
  uint8_t data[1 + sizeof(uint16_t)];
  data[0] = reg;
  __wleu16(&data[1], (uint16_t)value);
  return i2c_transact(fd, chip_addr, data, 1 + sizeof(uint16_t), 0);
}


x86 assembly (clang, -O0):
<i2c_write_leint16>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %rcx,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x30(%rbp)
lea    -0x30(%rbp),%rdi
add    $0x4,%rdi
mov    -0x18(%rbp),%rax
mov    %eax,%esi
call   1040 <__wleu16@plt>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
lea    -0x30(%rbp),%rdx
mov    $0x5,%ecx
xor    %r8d,%r8d
call   1030 <i2c_transact@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<i2c_write_leint16>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
mov    %esi,%ebx
mov    %edi,%ebp
mov    %edx,(%rsp)
lea    0x4(%rsp),%rdi
mov    %ecx,%esi
call   1040 <__wleu16@plt>
mov    %rsp,%rdx
mov    %ebp,%edi
mov    %ebx,%esi
mov    $0x5,%ecx
xor    %r8d,%r8d
call   1030 <i2c_transact@plt>
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @i2c_write_leint16(i32 %0, i32 %1, i32 %2, i64 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i64
%9 = alloca [5 x i32]
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i64 %3, i64* %8
%10 = load i32, i32* %7
%11 = getelementptr inbounds [5 x i32], [5 x i32]* %9, i64 0, i64 0
store i32 %10, i32* %11
%12 = getelementptr inbounds [5 x i32], [5 x i32]* %9, i64 0, i64 1
%13 = load i64, i64* %8
%14 = trunc i64 %13 to i32
%15 = call i32 @__wleu16(i32* %12, i32 %14)
%16 = load i32, i32* %5
%17 = load i32, i32* %6
%18 = getelementptr inbounds [5 x i32], [5 x i32]* %9, i64 0, i64 0
%19 = call i32 @i2c_transact(i32 %16, i32 %17, i32* %18, i32 5, i32 0)
ret i32 %19
}

LLVM IR (-O2):
define i32 @i2c_write_leint16(i32 %0, i32 %1, i32 %2, i64 %3) {
%5 = alloca [5 x i32]
%6 = bitcast [5 x i32]* %5 to i8*
%7 = getelementptr inbounds [5 x i32], [5 x i32]* %5, i64 0, i64 0
store i32 %2, i32* %7
%8 = getelementptr inbounds [5 x i32], [5 x i32]* %5, i64 0, i64 1
%9 = trunc i64 %3 to i32
%10 = call i32 @__wleu16(i32* %8, i32 %9)
%11 = call i32 @i2c_transact(i32 %0, i32 %1, i32* %7, i32 5, i32 0)
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
ClrScreen() { printf("\n\n"); }


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

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

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

LLVM IR (-O2):
@str = [2 x i8] c"\0A\00"
define i32 @ClrScreen() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ err(int /*<<< orphan*/, char *, size_t const);
void *malloc(size_t const);
__attribute__((alloc_size(1))) void *xmalloc(const size_t size) {
  void *ret = malloc(size);
  if (!ret && size)
    err(EXIT_FAILURE, "cannot allocate %zu bytes", size);
  return ret;
}


x86 assembly (clang, -O0):
<xmalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1168 <xmalloc+0x48>
cmpq   $0x0,-0x8(%rbp)
je     1168 <xmalloc+0x48>
mov    0x2e8a(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xe9d(%rip),%rsi
call   1030 <err@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xmalloc>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1040 <malloc@plt>
mov    %rax,%r14
test   %rbx,%rbx
je     1151 <xmalloc+0x31>
test   %r14,%r14
jne    1151 <xmalloc+0x31>
mov    0x2ea0(%rip),%rax
mov    (%rax),%edi
lea    0xeb7(%rip),%rsi
mov    %rbx,%rdx
call   1030 <err@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@EXIT_FAILURE = global i32 0
@.str = [26 x i8] c"cannot allocate %zu bytes\00"
define i8* @xmalloc(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = call i8* @malloc(i64 %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = icmp ne i8* %6, null
br i1 %7, label %15, label %8
8: ; preds = %1
%9 = load i64, i64* %2
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %15
11: ; preds = %8
%12 = load i32, i32* @EXIT_FAILURE
%13 = load i64, i64* %2
%14 = call i32 @err(i32 %12, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i64 %13)
br label %15
15: ; preds = %11, %8, %1
%16 = load i8*, i8** %3
ret i8* %16
}

LLVM IR (-O2):
@EXIT_FAILURE = global i32 0
@.str = [26 x i8] c"cannot allocate %zu bytes\00"
define noalias i8* @xmalloc(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
%3 = icmp eq i8* %2, null
%4 = icmp ne i64 %0, 0
%5 = and i1 %4, %3
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load i32, i32* @EXIT_FAILURE
%8 = tail call i32 @err(i32 %7, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i64 %0)
br label %9
9: ; preds = %6, %1
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int sumOfDigits(int);
int main() {
  int num;
  printf("Enter a number> ");
  scanf("%d", &num);
  printf("The sum of the digits of %d is %d\n", num, sumOfDigits(num));
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xec4(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xec7(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%ebx
mov    %ebx,%edi
call   1030 <sumOfDigits@plt>
lea    0xeae(%rip),%rdi
mov    %ebx,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [17 x i8] c"Enter a number> \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [35 x i8] c"The sum of the digits of %d is %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%5 = load i32, i32* %2
%6 = load i32, i32* %2
%7 = call i32 @sumOfDigits(i32 %6)
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0), i32 %5, i32 %7)
ret i32 0
}

LLVM IR (-O2):
@.str = [17 x i8] c"Enter a number> \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [35 x i8] c"The sum of the digits of %d is %d\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 ([17 x i8], [17 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 @sumOfDigits(i32 %5)
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0), i32 %5, i32 %6)
ret i32 0
}
/* Variables and functions */
int fputs(char const *, void *);
int stdio_file_handler_print(void *file, const char *str) {
  return fputs(str, file);
}


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

x86 assembly (clang, -O2):
<stdio_file_handler_print>:
mov    %rdi,%rax
mov    %rsi,%rdi
mov    %rax,%rsi
jmp    1030 <fputs@plt>

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

LLVM IR (-O2):
define i32 @stdio_file_handler_print(i8* nocapture %0, i8* nocapture %1) {
%3 = tail call i32 @fputs(i8* %1, i8* %0)
ret i32 %3
}
/* Variables and functions */
scalar_t__ strcmp(char *, char *);
bool streq(char *a, char *b) { return strcmp(a, b) == 0; }


x86 assembly (clang, -O0):
<streq>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<streq>:
push   %rax
call   1030 <strcmp@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @streq(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** %4
%7 = call i64 @strcmp(i8* %5, i8* %6)
%8 = icmp eq i64 %7, 0
%9 = zext i1 %8 to i32
ret i32 %9
}

LLVM IR (-O2):
define i32 @streq(i8* %0, i8* %1) {
%3 = tail call i64 @strcmp(i8* %0, i8* %1)
%4 = icmp eq i64 %3, 0
%5 = zext i1 %4 to i32
ret i32 %5
}
char binfrom6bit(char ascii) {
  if ((ascii < 0x30) || (ascii > 0x77) || ((ascii > 0x57) && (ascii < 0x60)))
    return -1;
  if (ascii < 0x60)
    return (ascii - 0x30) & 0x3F;
  else
    return (ascii - 0x38) & 0x3F;
}


x86 assembly (clang, -O0):
<binfrom6bit>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x2(%rbp)
movsbl -0x2(%rbp),%eax
cmp    $0x30,%eax
jl     113e <binfrom6bit+0x3e>
movsbl -0x2(%rbp),%eax
cmp    $0x77,%eax
jg     113e <binfrom6bit+0x3e>
movsbl -0x2(%rbp),%eax
cmp    $0x57,%eax
jle    1147 <binfrom6bit+0x47>
movsbl -0x2(%rbp),%eax
cmp    $0x60,%eax
jge    1147 <binfrom6bit+0x47>
movb   $0xff,-0x1(%rbp)
jmp    1173 <binfrom6bit+0x73>
movsbl -0x2(%rbp),%eax
cmp    $0x60,%eax
jge    1166 <binfrom6bit+0x66>
movsbl -0x2(%rbp),%eax
sub    $0x30,%eax
and    $0x3f,%eax
mov    %al,-0x1(%rbp)
jmp    1173 <binfrom6bit+0x73>
movsbl -0x2(%rbp),%eax
sub    $0x38,%eax
and    $0x3f,%eax
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<binfrom6bit>:
lea    -0x78(%rdi),%ecx
mov    $0xff,%al
cmp    $0xb8,%cl
jb     112a <binfrom6bit+0x2a>
mov    %edi,%ecx
and    $0xf8,%cl
cmp    $0x58,%cl
je     112a <binfrom6bit+0x2a>
cmp    $0x5f,%dil
ja     1120 <binfrom6bit+0x20>
add    $0x10,%dil
jmp    1124 <binfrom6bit+0x24>
add    $0x8,%dil
and    $0x3f,%dil
mov    %edi,%eax
ret

LLVM IR (-O0):
define signext i8 @binfrom6bit(i8 signext %0) {
%2 = alloca i8
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = icmp slt i32 %5, 48
br i1 %6, label %19, label %7
7: ; preds = %1
%8 = load i8, i8* %3
%9 = sext i8 %8 to i32
%10 = icmp sgt i32 %9, 119
br i1 %10, label %19, label %11
11: ; preds = %7
%12 = load i8, i8* %3
%13 = sext i8 %12 to i32
%14 = icmp sgt i32 %13, 87
br i1 %14, label %15, label %20
15: ; preds = %11
%16 = load i8, i8* %3
%17 = sext i8 %16 to i32
%18 = icmp slt i32 %17, 96
br i1 %18, label %19, label %20
19: ; preds = %15, %7, %1
store i8 -1, i8* %2
br label %36
20: ; preds = %15, %11
%21 = load i8, i8* %3
%22 = sext i8 %21 to i32
%23 = icmp slt i32 %22, 96
br i1 %23, label %24, label %30
24: ; preds = %20
%25 = load i8, i8* %3
%26 = sext i8 %25 to i32
%27 = sub nsw i32 %26, 48
%28 = and i32 %27, 63
%29 = trunc i32 %28 to i8
store i8 %29, i8* %2
br label %36
30: ; preds = %20
%31 = load i8, i8* %3
%32 = sext i8 %31 to i32
%33 = sub nsw i32 %32, 56
%34 = and i32 %33, 63
%35 = trunc i32 %34 to i8
store i8 %35, i8* %2
br label %36
36: ; preds = %30, %24, %19
%37 = load i8, i8* %2
ret i8 %37
}

LLVM IR (-O2):
define signext i8 @binfrom6bit(i8 signext %0) {
%2 = add i8 %0, -120
%3 = icmp ult i8 %2, -72
%4 = and i8 %0, -8
%5 = icmp eq i8 %4, 88
%6 = or i1 %3, %5
br i1 %6, label %15, label %7
7: ; preds = %1
%8 = icmp ult i8 %0, 96
br i1 %8, label %9, label %12
9: ; preds = %7
%10 = add nuw nsw i8 %0, 16
%11 = and i8 %10, 63
br label %15
12: ; preds = %7
%13 = add nuw nsw i8 %0, 8
%14 = and i8 %13, 63
br label %15
15: ; preds = %1, %12, %9
%16 = phi i8 [ %11, %9 ], [ %14, %12 ], [ -1, %1 ]
ret i8 %16
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
void KeccakP200_AddByte(void *state, unsigned char byte, unsigned int offset) {
  assert(offset < 25);
  ((unsigned char *)state)[offset] ^= byte;
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    %edx,-0x10(%rbp)
cmpl   $0x19,-0x10(%rbp)
setb   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
movzbl -0x9(%rbp),%esi
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
movzbl (%rax,%rcx,1),%edx
xor    %esi,%edx
mov    %dl,(%rax,%rcx,1)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
push   %rbp
push   %r14
push   %rbx
mov    %edx,%ebx
mov    %esi,%r14d
mov    %rdi,%rbp
xor    %edi,%edi
cmp    $0x19,%edx
setb   %dil
call   1030 <assert@plt>
mov    %ebx,%eax
xor    %r14b,0x0(%rbp,%rax,1)
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @KeccakP200_AddByte(i8* %0, i8 zeroext %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 i32, i32* %6
%8 = icmp ult i32 %7, 25
%9 = zext i1 %8 to i32
%10 = call i32 @assert(i32 %9)
%11 = load i8, i8* %5
%12 = zext i8 %11 to i32
%13 = load i8*, i8** %4
%14 = load i32, i32* %6
%15 = zext i32 %14 to i64
%16 = getelementptr inbounds i8, i8* %13, i64 %15
%17 = load i8, i8* %16
%18 = zext i8 %17 to i32
%19 = xor i32 %18, %12
%20 = trunc i32 %19 to i8
store i8 %20, i8* %16
ret void
}

LLVM IR (-O2):
define void @KeccakP200_AddByte(i8* nocapture %0, i8 zeroext %1, i32 %2) {
%4 = icmp ult i32 %2, 25
%5 = zext i1 %4 to i32
%6 = tail call i32 @assert(i32 %5)
%7 = zext i32 %2 to i64
%8 = getelementptr inbounds i8, i8* %0, i64 %7
%9 = load i8, i8* %8
%10 = xor i8 %9, %1
store i8 %10, i8* %8
ret void
}
int test_imm_5Euint8_mem(unsigned char *val) {
  return ((*val) & (0x5E << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_5Euint8_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, 94
%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_5Euint8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, 94
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
double P(int degree) { return 0.7 / (double)(degree * degree); }


x86 assembly (clang, -O0):
<P>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
imul   -0x4(%rbp),%eax
cvtsi2sd %eax,%xmm1
movsd  0xee6(%rip),%xmm0
divsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<P>:
imul   %edi,%edi
cvtsi2sd %edi,%xmm1
movsd  0xef1(%rip),%xmm0
divsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @P(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* %2
%5 = mul nsw i32 %3, %4
%6 = sitofp i32 %5 to double
%7 = fdiv double 0x3FE6666666666666, %6
ret double %7
}

LLVM IR (-O2):
define double @P(i32 %0) {
%2 = mul nsw i32 %0, %0
%3 = sitofp i32 %2 to double
%4 = fdiv double 0x3FE6666666666666, %3
ret double %4
}
void avcodec_align_dimensions() {}


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

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

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

LLVM IR (-O2):
define void @avcodec_align_dimensions() {
ret void
}
int *_Z_myalloc(k)
int k;
{
  int *tmp;
  if (tmp = (int *)calloc((unsigned)k, (unsigned)1)) {
    return (tmp);
  }
  Z_fatal("Out of Memory\n");
  return (tmp);
}


x86 assembly (clang, -O0):
<_Z_myalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,%edi
mov    $0x1,%esi
call   1040 <calloc@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
je     1155 <_Z_myalloc+0x35>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    116b <_Z_myalloc+0x4b>
lea    0xea4(%rip),%rdi
mov    $0x0,%al
call   1030 <Z_fatal@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_Z_myalloc>:
push   %rbx
mov    %edi,%edi
mov    $0x1,%esi
call   1040 <calloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1143 <_Z_myalloc+0x23>
lea    0xec4(%rip),%rdi
xor    %eax,%eax
call   1030 <Z_fatal@plt>
mov    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [15 x i8] c"Out of Memory\0A\00"
define i32* @_Z_myalloc(i32 %0) {
%2 = zext i32 %0 to i64
%3 = tail call i8* @calloc(i64 %2, i64 1)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = tail call i32 (i8*, ...) bitcast (i32 (...)* @Z_fatal to i32 (i8*, ...)*)(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %1, %5
%8 = bitcast i8* %3 to i32*
ret i32* %8
}
void INT_Excep_CAN1_TXF1(void) {}


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

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

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

LLVM IR (-O2):
define void @INT_Excep_CAN1_TXF1() {
ret void
}
/* Variables and functions */
int neither(char const *, char, char, int);
int wspace(const char *str, int first) {
  return neither(str, ' ', '\t', first);
}


x86 assembly (clang, -O0):
<wspace>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%ecx
mov    $0x20,%esi
mov    $0x9,%edx
call   1030 <neither@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wspace>:
mov    %esi,%ecx
mov    $0x20,%esi
mov    $0x9,%edx
jmp    1030 <neither@plt>

LLVM IR (-O0):
define i32 @wspace(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 @neither(i8* %5, i8 signext 32, i8 signext 9, i32 %6)
ret i32 %7
}

LLVM IR (-O2):
define i32 @wspace(i8* %0, i32 %1) {
%3 = tail call i32 @neither(i8* %0, i8 signext 32, i8 signext 9, i32 %1)
ret i32 %3
}