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

/* Variables and functions */
int /*<<< orphan*/ SwapWord(char *, int);
int big2littlei(int num) {
  SwapWord((char *)&num, sizeof(num));
  return num;
}


x86 assembly (clang, -O0):
<big2littlei>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    -0x4(%rbp),%rdi
mov    $0x4,%esi
call   1030 <SwapWord@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<big2littlei>:
push   %rax
mov    %edi,0x4(%rsp)
lea    0x4(%rsp),%rdi
mov    $0x4,%esi
call   1030 <SwapWord@plt>
mov    0x4(%rsp),%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @big2littlei(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = bitcast i32* %2 to i8*
%4 = call i32 @SwapWord(i8* %3, i32 4)
%5 = load i32, i32* %2
ret i32 %5
}

LLVM IR (-O2):
define i32 @big2littlei(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = bitcast i32* %2 to i8*
%4 = call i32 @SwapWord(i8* %3, i32 4)
%5 = load i32, i32* %2
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ keywait(int /*<<< orphan*/);
void keyupwait() { keywait(0); }


x86 assembly (clang, -O0):
<keyupwait>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1030 <keywait@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<keyupwait>:
xor    %edi,%edi
jmp    1030 <keywait@plt>

LLVM IR (-O0):
define void @keyupwait() {
%1 = call i32 @keywait(i32 0)
ret void
}

LLVM IR (-O2):
define void @keyupwait() {
%1 = tail call i32 @keywait(i32 0)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_t;

/* Variables and functions */
int pthread_join(int /*<<< orphan*/, int /*<<< orphan*/ *);
void pthread_join_opaque(pthread_t *threadptr, int *err) {
  *err = pthread_join(*threadptr, NULL);
}


x86 assembly (clang, -O0):
<pthread_join_opaque>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <pthread_join@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pthread_join_opaque>:
push   %rbx
mov    %rsi,%rbx
mov    (%rdi),%edi
xor    %esi,%esi
call   1030 <pthread_join@plt>
mov    %eax,(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
define void @pthread_join_opaque(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* %5
%7 = call i32 @pthread_join(i32 %6, i32* null)
%8 = load i32*, i32** %4
store i32 %7, i32* %8
ret void
}

LLVM IR (-O2):
define void @pthread_join_opaque(i32* nocapture %0, i32* nocapture writeonly %1) {
%3 = load i32, i32* %0
%4 = tail call i32 @pthread_join(i32 %3, i32* null)
store i32 %4, i32* %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void print_integer(void *n) { printf("%d\n", *(int *)n); }


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

x86 assembly (clang, -O2):
<print_integer>:
mov    (%rdi),%esi
lea    0xee7(%rip),%rdi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define void @print_integer(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = load i32, i32* %2
%4 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
int f(int i, int j) { printf("%d, %d\n", i, j); }


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
mov    %esi,%edx
mov    %edi,%esi
lea    0xee5(%rip),%rdi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [8 x i8] c"%d, %d\0A\00"
define i32 @f(i32 %0, i32 %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %1)
ret i32 undef
}
/* Variables and functions */
int send(int, char const *, int, int /*<<< orphan*/);
int /*<<< orphan*/ send_int(int, int);
int strlen(char const *);
int send_str(int sock, const char *str) {
  int len;
  len = strlen(str);
  if (!send_int(sock, len))
    return 0;
  if (send(sock, str, len, 0) != len)
    return 0;
  return 1;
}


x86 assembly (clang, -O0):
<send_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x14(%rbp),%esi
call   1050 <send_int@plt>
cmp    $0x0,%eax
jne    116b <send_str+0x3b>
movl   $0x0,-0x4(%rbp)
jmp    1198 <send_str+0x68>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
xor    %ecx,%ecx
call   1040 <send@plt>
cmp    -0x14(%rbp),%eax
je     1191 <send_str+0x61>
movl   $0x0,-0x4(%rbp)
jmp    1198 <send_str+0x68>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<send_str>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %edi,%ebp
mov    %rsi,%rdi
call   1030 <strlen@plt>
mov    %eax,%ebx
mov    %ebp,%edi
mov    %eax,%esi
call   1050 <send_int@plt>
test   %eax,%eax
je     1169 <send_str+0x39>
mov    %ebp,%edi
mov    %r14,%rsi
mov    %ebx,%edx
xor    %ecx,%ecx
call   1040 <send@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    %ebx,%ecx
sete   %al
jmp    116b <send_str+0x3b>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @send_str(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
store i32 %0, i32* %4
store i8* %1, i8** %5
%7 = load i8*, i8** %5
%8 = call i32 @strlen(i8* %7)
store i32 %8, i32* %6
%9 = load i32, i32* %4
%10 = load i32, i32* %6
%11 = call i32 @send_int(i32 %9, i32 %10)
%12 = icmp ne i32 %11, 0
br i1 %12, label %14, label %13
13: ; preds = %2
store i32 0, i32* %3
br label %23
14: ; preds = %2
%15 = load i32, i32* %4
%16 = load i8*, i8** %5
%17 = load i32, i32* %6
%18 = call i32 @send(i32 %15, i8* %16, i32 %17, i32 0)
%19 = load i32, i32* %6
%20 = icmp ne i32 %18, %19
br i1 %20, label %21, label %22
21: ; preds = %14
store i32 0, i32* %3
br label %23
22: ; preds = %14
store i32 1, i32* %3
br label %23
23: ; preds = %22, %21, %13
%24 = load i32, i32* %3
ret i32 %24
}

LLVM IR (-O2):
define i32 @send_str(i32 %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %1)
%4 = tail call i32 @send_int(i32 %0, i32 %3)
%5 = icmp eq i32 %4, 0
br i1 %5, label %10, label %6
6: ; preds = %2
%7 = tail call i32 @send(i32 %0, i8* %1, i32 %3, i32 0)
%8 = icmp eq i32 %7, %3
%9 = zext i1 %8 to i32
br label %10
10: ; preds = %6, %2
%11 = phi i32 [ 0, %2 ], [ %9, %6 ]
ret i32 %11
}
ISR(TIMER1_CAPT_vect) {}


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

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

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

LLVM IR (-O2):
define i32 @ISR(i32 %0) {
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ putchar(char);
void fill(int numFillers, char filler) {
  while (numFillers-- > 0) {
    putchar(filler);
  }
}


x86 assembly (clang, -O0):
<fill>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %edi,-0x4(%rbp)
mov    %al,-0x5(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x4(%rbp)
cmp    $0x0,%eax
jle    1143 <fill+0x33>
movsbl -0x5(%rbp),%edi
call   1030 <putchar@plt>
jmp    1121 <fill+0x11>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fill>:
push   %rbp
push   %rbx
push   %rax
test   %edi,%edi
jle    112f <fill+0x1f>
mov    %edi,%ebx
add    $0x1,%ebx
movsbl %sil,%ebp
mov    %ebp,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
cmp    $0x1,%ebx
ja     1120 <fill+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define void @fill(i32 %0, i8 signext %1) {
%3 = alloca i32
%4 = alloca i8
store i32 %0, i32* %3
store i8 %1, i8* %4
br label %5
5: ; preds = %9, %2
%6 = load i32, i32* %3
%7 = add nsw i32 %6, -1
store i32 %7, i32* %3
%8 = icmp sgt i32 %6, 0
br i1 %8, label %9, label %12
9: ; preds = %5
%10 = load i8, i8* %4
%11 = call i32 @putchar(i8 signext %10)
br label %5
12: ; preds = %5
ret void
}

LLVM IR (-O2):
define void @fill(i32 %0, i8 signext %1) {
%3 = icmp sgt i32 %0, 0
br i1 %3, label %4, label %9
4: ; preds = %2, %4
%5 = phi i32 [ %6, %4 ], [ %0, %2 ]
%6 = add nsw i32 %5, -1
%7 = tail call i32 @putchar(i8 signext %1)
%8 = icmp ugt i32 %5, 1
br i1 %8, label %4, label %9
9: ; preds = %4, %2
ret void
}
int ntz(int v) {
  int c;
  v = (v ^ (v - 1)) >> 1;
  for (c = 0; v; c++) {
    v >>= 1;
  }
  return c;
}


x86 assembly (clang, -O0):
<ntz>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
xor    %ecx,%eax
sar    $0x1,%eax
mov    %eax,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1140 <ntz+0x40>
mov    -0x4(%rbp),%eax
sar    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    111f <ntz+0x1f>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ntz>:
lea    -0x1(%rdi),%ecx
xor    %edi,%ecx
xor    %eax,%eax
cmp    $0x2,%ecx
jb     111c <ntz+0x1c>
xor    %eax,%eax
mov    %ecx,%edx
sar    %edx
add    $0x1,%eax
cmp    $0x3,%ecx
mov    %edx,%ecx
ja     1110 <ntz+0x10>
ret

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

LLVM IR (-O2):
define i32 @ntz(i32 %0) {
%2 = add nsw i32 %0, -1
%3 = xor i32 %2, %0
%4 = icmp ult i32 %3, 2
br i1 %4, label %11, label %5
5: ; preds = %1, %5
%6 = phi i32 [ %9, %5 ], [ 0, %1 ]
%7 = phi i32 [ %8, %5 ], [ %3, %1 ]
%8 = ashr i32 %7, 1
%9 = add nuw nsw i32 %6, 1
%10 = icmp ult i32 %7, 4
br i1 %10, label %11, label %5
11: ; preds = %5, %1
%12 = phi i32 [ 0, %1 ], [ %9, %5 ]
ret i32 %12
}
/* Variables and functions */
char *rxp__expand(int);
char *rxp_expand(void) { return (rxp__expand(1)); }


x86 assembly (clang, -O0):
<rxp_expand>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
call   1030 <rxp__expand@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<rxp_expand>:
mov    $0x1,%edi
jmp    1030 <rxp__expand@plt>

LLVM IR (-O0):
define i8* @rxp_expand() {
%1 = call i8* @rxp__expand(i32 1)
ret i8* %1
}

LLVM IR (-O2):
define i8* @rxp_expand() {
%1 = tail call i8* @rxp__expand(i32 1)
ret i8* %1
}
void gtk_text_view_forward_display_line_end() {}


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

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

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

LLVM IR (-O2):
define void @gtk_text_view_forward_display_line_end() {
ret void
}
/* Type definitions */
struct sockaddr_in6 {
  int dummy;
};
struct sockaddr_in {
  int dummy;
};
struct sockaddr {
  int sa_family;
};
typedef int socklen_t;

/* Variables and functions */
#define AF_INET 129
#define AF_INET6 128
int /*<<< orphan*/ assert(int /*<<< orphan*/);
socklen_t sockutil_addrlen(struct sockaddr *a) {
  switch (a->sa_family) {
  case AF_INET:
    return sizeof(struct sockaddr_in);
  case AF_INET6:
    return sizeof(struct sockaddr_in6);
  default:
    assert(0);
    return 0;
  }
}


x86 assembly (clang, -O0):
<sockutil_addrlen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
sub    $0x80,%eax
je     1154 <sockutil_addrlen+0x44>
jmp    1135 <sockutil_addrlen+0x25>
mov    -0x14(%rbp),%eax
sub    $0x81,%eax
jne    1160 <sockutil_addrlen+0x50>
jmp    1148 <sockutil_addrlen+0x38>
movl   $0x4,-0x4(%rbp)
jmp    116e <sockutil_addrlen+0x5e>
movl   $0x4,-0x4(%rbp)
jmp    116e <sockutil_addrlen+0x5e>
xor    %edi,%edi
call   1030 <assert@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sockutil_addrlen>:
push   %rbx
mov    (%rdi),%eax
and    $0xfffffffe,%eax
mov    $0x4,%ebx
cmp    $0x80,%eax
je     112b <sockutil_addrlen+0x1b>
xor    %ebx,%ebx
xor    %edi,%edi
call   1030 <assert@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.sockaddr = type { i32 }
define i32 @sockutil_addrlen(%struct.sockaddr* %0) {
%2 = alloca i32
%3 = alloca %struct.sockaddr*
store %struct.sockaddr* %0, %struct.sockaddr** %3
%4 = load %struct.sockaddr*, %struct.sockaddr** %3
%5 = getelementptr inbounds %struct.sockaddr, %struct.sockaddr* %4, i32 0, i32 0
%6 = load i32, i32* %5
switch i32 %6, label %9 [
i32 129, label %7
i32 128, label %8
]
7: ; preds = %1
store i32 4, i32* %2
br label %11
8: ; preds = %1
store i32 4, i32* %2
br label %11
9: ; preds = %1
%10 = call i32 @assert(i32 0)
store i32 0, i32* %2
br label %11
11: ; preds = %9, %8, %7
%12 = load i32, i32* %2
ret i32 %12
}

LLVM IR (-O2):
%struct.sockaddr = type { i32 }
define i32 @sockutil_addrlen(%struct.sockaddr* nocapture %0) {
%2 = getelementptr inbounds %struct.sockaddr, %struct.sockaddr* %0, i64 0, i32 0
%3 = load i32, i32* %2
%4 = and i32 %3, -2
%5 = icmp eq i32 %4, 128
br i1 %5, label %8, label %6
6: ; preds = %1
%7 = tail call i32 @assert(i32 0)
br label %8
8: ; preds = %1, %6
%9 = phi i32 [ 0, %6 ], [ 4, %1 ]
ret i32 %9
}
/* Type definitions */
typedef int /*<<< orphan*/ line;

/* Variables and functions */
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stdin;
int words(char *);
int main() {
  char line[100];
  while (1) {
    printf("Enter line:");
    fgets(line, sizeof(line), stdin);
    printf("Number of words: %d\n", words(line));
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x70(%rbp),%rdi
mov    0x2e90(%rip),%rax
mov    (%rax),%edx
mov    $0x64,%esi
call   1040 <fgets@plt>
lea    -0x70(%rbp),%rdi
call   1050 <words@plt>
mov    %eax,%esi
lea    0xe96(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    113f <main+0xf>

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x68,%rsp
lea    0xebe(%rip),%r14
mov    0x2e9f(%rip),%r12
mov    %rsp,%rbx
lea    0xeb9(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    (%r12),%edx
mov    %rbx,%rdi
mov    $0x64,%esi
call   1040 <fgets@plt>
mov    %rbx,%rdi
call   1050 <words@plt>
mov    %r15,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    1160 <main+0x30>

LLVM IR (-O0):
@.str = [12 x i8] c"Enter line:\00"
@stdin = global i32 0
@.str.1 = [21 x i8] c"Number of words: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i8]
store i32 0, i32* %1
br label %3
3: ; preds = %0, %3
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%5 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%6 = load i32, i32* @stdin
%7 = call i32 @fgets(i8* %5, i32 100, i32 %6)
%8 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%9 = call i32 @words(i8* %8)
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 %9)
br label %3
}

LLVM IR (-O2):
@.str = [12 x i8] c"Enter line:\00"
@stdin = global i32 0
@.str.1 = [21 x i8] c"Number of words: %d\0A\00"
define i32 @main() {
%1 = alloca [100 x i8]
%2 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
br label %3
3: ; preds = %3, %0
%4 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%5 = load i32, i32* @stdin
%6 = call i32 @fgets(i8* %2, i32 100, i32 %5)
%7 = call i32 @words(i8* %2)
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 %7)
br label %3
}
void set_rapl_limit(const int socket, struct rapl_limit *limit1,
                    struct rapl_limit *limit2, struct rapl_limit *dram) {}


x86 assembly (clang, -O0):
<set_rapl_limit>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.rapl_limit = type opaque
define void @set_rapl_limit(i32 %0, %struct.rapl_limit* %1, %struct.rapl_limit* %2, %struct.rapl_limit* %3) {
%5 = alloca i32
%6 = alloca %struct.rapl_limit*
%7 = alloca %struct.rapl_limit*
%8 = alloca %struct.rapl_limit*
store i32 %0, i32* %5
store %struct.rapl_limit* %1, %struct.rapl_limit** %6
store %struct.rapl_limit* %2, %struct.rapl_limit** %7
store %struct.rapl_limit* %3, %struct.rapl_limit** %8
ret void
}

LLVM IR (-O2):
%struct.rapl_limit = type opaque
define void @set_rapl_limit(i32 %0, %struct.rapl_limit* nocapture %1, %struct.rapl_limit* nocapture %2, %struct.rapl_limit* nocapture %3) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ squeeze(char *, char *);
int main() {
  char foo[16] = "foobarbaz";
  char bar[16] = "boz";
  squeeze(foo, bar);
  printf("%s\n", foo);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xec7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xec4(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xec1(%rip),%rax
mov    %rax,-0x28(%rbp)
lea    -0x20(%rbp),%rdi
lea    -0x30(%rbp),%rsi
call   1030 <squeeze@plt>
lea    -0x20(%rbp),%rsi
lea    0xead(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
movaps 0xed4(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xed8(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0x10(%rsp),%rbx
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1030 <squeeze@plt>
lea    0xecd(%rip),%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.foo = [16 x i8] c"foobarbaz\00\00\00\00\00\00\00"
@__const.main.bar = [16 x i8] c"boz\00\00\00\00\00\00\00\00\00\00\00\00\00"
@.str = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [16 x i8]
%3 = alloca [16 x i8]
store i32 0, i32* %1
%4 = bitcast [16 x i8]* %2 to i8*
%5 = bitcast [16 x i8]* %3 to i8*
%6 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 0
%7 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 0
%8 = call i32 @squeeze(i8* %6, i8* %7)
%9 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 0
%10 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %9)
ret i32 0
}

LLVM IR (-O2):
@__const.main.foo = [16 x i8] c"foobarbaz\00\00\00\00\00\00\00"
@__const.main.bar = [16 x i8] c"boz\00\00\00\00\00\00\00\00\00\00\00\00\00"
@.str = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca [16 x i8]
%2 = alloca [16 x i8]
%3 = getelementptr inbounds [16 x i8], [16 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 0
%5 = call i32 @squeeze(i8* %3, i8* %4)
%6 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %3)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void main() { printf("this is a test master\n"); }


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

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

LLVM IR (-O0):
@.str = [23 x i8] c"this is a test master\0A\00"
define void @main() {
%1 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [22 x i8] c"this is a test master\00"
define void @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
ret void
}
void recure(int n) {
  {
    printf("n = %d\n", &n);
    recure(n - 1);
    printf("n = %d\n", &n);
  }
}


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

x86 assembly (clang, -O2):
<recure>:
push   %r14
push   %rbx
push   %rax
mov    %edi,0x4(%rsp)
lea    0xed1(%rip),%r14
lea    0x4(%rsp),%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x4(%rsp),%edi
add    $0xffffffff,%edi
call   1030 <recure@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [8 x i8] c"n = %d\0A\00"
define void @recure(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32* %2)
%4 = load i32, i32* %2
%5 = add nsw i32 %4, -1
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32* %2)
ret void
}
_Noreturn void f6(void) {}


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

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

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

LLVM IR (-O2):
define void @f6() {
ret void
}
/* Type definitions */
struct timeval {
  double tv_sec;
  double tv_usec;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
double hrtime_(void) {
  struct timeval tv;
  gettimeofday(&tv, NULL);
  return (tv.tv_sec + 1.e-6 * tv.tv_usec);
}


x86 assembly (clang, -O0):
<hrtime_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <gettimeofday@plt>
movsd  -0x10(%rbp),%xmm1
movsd  -0x8(%rbp),%xmm0
movsd  0xec9(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hrtime_>:
sub    $0x18,%rsp
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
movsd  0x10(%rsp),%xmm0
mulsd  0xed2(%rip),%xmm0
addsd  0x8(%rsp),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timeval = type { double, double }
define double @hrtime_() {
%1 = alloca %struct.timeval
%2 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%3 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 0
%4 = load double, double* %3
%5 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 1
%6 = load double, double* %5
%7 = call double @llvm.fmuladd.f64(double 0x3EB0C6F7A0B5ED8D, double %6, double %4)
ret double %7
}

LLVM IR (-O2):
%struct.timeval = type { double, double }
define double @hrtime_() {
%1 = alloca %struct.timeval
%2 = bitcast %struct.timeval* %1 to i8*
%3 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%5 = load double, double* %4
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%7 = load double, double* %6
%8 = tail call double @llvm.fmuladd.f64(double %7, double 0x3EB0C6F7A0B5ED8D, double %5)
ret double %8
}
int f3(int x) {
  int y;
  return x ? 1 : y;
}


x86 assembly (clang, -O0):
<f3>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     111e <f3+0x1e>
mov    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1124 <f3+0x24>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @f3(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = icmp ne i32 %4, 0
br i1 %5, label %6, label %7
6: ; preds = %1
br label %9
7: ; preds = %1
%8 = load i32, i32* %3
br label %9
9: ; preds = %7, %6
%10 = phi i32 [ 1, %6 ], [ %8, %7 ]
ret i32 %10
}

LLVM IR (-O2):
define i32 @f3(i32 %0) {
ret i32 1
}
int do_323() { return 323; }


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

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

LLVM IR (-O0):
define i32 @do_323() {
ret i32 323
}

LLVM IR (-O2):
define i32 @do_323() {
ret i32 323
}
/* Variables and functions */
int ulckpwdf();
int unlock_shadow_file() { return ulckpwdf(); }


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

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

LLVM IR (-O0):
define i32 @unlock_shadow_file() {
%1 = call i32 (...) @ulckpwdf()
ret i32 %1
}

LLVM IR (-O2):
define i32 @unlock_shadow_file() {
%1 = tail call i32 (...) @ulckpwdf()
ret i32 %1
}
/* Type definitions */
typedef int /*<<< orphan*/ __u8;

/* Variables and functions */
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ exit(int);
scalar_t__ i2c_smbus_write_byte_data(int, int /*<<< orphan*/,
                                     int /*<<< orphan*/);
void bmp085_i2c_Write_Byte(int fd, __u8 address, __u8 value) {
  if (i2c_smbus_write_byte_data(fd, address, value) < 0) {
    close(fd);
    exit(1);
  }
}


x86 assembly (clang, -O0):
<bmp085_i2c_Write_Byte>:
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   1040 <i2c_smbus_write_byte_data@plt>
cmp    $0x0,%rax
jge    116b <bmp085_i2c_Write_Byte+0x3b>
mov    -0x4(%rbp),%edi
call   1030 <close@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bmp085_i2c_Write_Byte>:
push   %rbx
mov    %edi,%ebx
call   1040 <i2c_smbus_write_byte_data@plt>
test   %rax,%rax
js     113f <bmp085_i2c_Write_Byte+0xf>
pop    %rbx
ret
mov    %ebx,%edi
call   1030 <close@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
define void @bmp085_i2c_Write_Byte(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 i64 @i2c_smbus_write_byte_data(i32 %7, i32 %8, i32 %9)
%11 = icmp slt i64 %10, 0
br i1 %11, label %12, label %16
12: ; preds = %3
%13 = load i32, i32* %4
%14 = call i32 @close(i32 %13)
%15 = call i32 @exit(i32 1)
unreachable
16: ; preds = %3
ret void
}

LLVM IR (-O2):
define void @bmp085_i2c_Write_Byte(i32 %0, i32 %1, i32 %2) {
%4 = tail call i64 @i2c_smbus_write_byte_data(i32 %0, i32 %1, i32 %2)
%5 = icmp slt i64 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %3
%7 = tail call i32 @close(i32 %0)
%8 = tail call i32 @exit(i32 1)
unreachable
9: ; preds = %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ irq_ack(int);
int /*<<< orphan*/ timer_int_clean(int /*<<< orphan*/);
void timer0_isr(void) {
  timer_int_clean(0);
  irq_ack((0x00000020));
}


x86 assembly (clang, -O0):
<timer0_isr>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1040 <timer_int_clean@plt>
mov    $0x20,%edi
call   1030 <irq_ack@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<timer0_isr>:
push   %rax
xor    %edi,%edi
call   1040 <timer_int_clean@plt>
mov    $0x20,%edi
pop    %rax
jmp    1030 <irq_ack@plt>

LLVM IR (-O0):
define void @timer0_isr() {
%1 = call i32 @timer_int_clean(i32 0)
%2 = call i32 @irq_ack(i32 32)
ret void
}

LLVM IR (-O2):
define void @timer0_isr() {
%1 = tail call i32 @timer_int_clean(i32 0)
%2 = tail call i32 @irq_ack(i32 32)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ showAsciiTable();
int main() {
  showAsciiTable();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <showAsciiTable@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <showAsciiTable@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @showAsciiTable()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @showAsciiTable()
ret i32 0
}
/* Variables and functions */
float __ocml_mul_rtn_f32(float, float);
float __fmul_ru(float x, float y) { return __ocml_mul_rtn_f32(x, y); }


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

x86 assembly (clang, -O2):
<__fmul_ru>:
jmp    1030 <__ocml_mul_rtn_f32@plt>

LLVM IR (-O0):
define float @__fmul_ru(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 = load float, float* %4
%7 = call float @__ocml_mul_rtn_f32(float %5, float %6)
ret float %7
}

LLVM IR (-O2):
define float @__fmul_ru(float %0, float %1) {
%3 = tail call float @__ocml_mul_rtn_f32(float %0, float %1)
ret float %3
}
/* Variables and functions */
int /*<<< orphan*/ OutputGetTachoCount(unsigned char, int *);
int MotorTachoCount(unsigned char Output) {
  int Result = 0;
  OutputGetTachoCount(Output, &Result);
  return Result;
}


x86 assembly (clang, -O0):
<MotorTachoCount>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movl   $0x0,-0x8(%rbp)
lea    -0x8(%rbp),%rsi
movzbl -0x1(%rbp),%edi
call   1030 <OutputGetTachoCount@plt>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<MotorTachoCount>:
push   %rax
movl   $0x0,0x4(%rsp)
lea    0x4(%rsp),%rsi
call   1030 <OutputGetTachoCount@plt>
mov    0x4(%rsp),%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @MotorTachoCount(i8 zeroext %0) {
%2 = alloca i8
%3 = alloca i32
store i8 %0, i8* %2
store i32 0, i32* %3
%4 = load i8, i8* %2
%5 = call i32 @OutputGetTachoCount(i8 zeroext %4, i32* %3)
%6 = load i32, i32* %3
ret i32 %6
}

LLVM IR (-O2):
define i32 @MotorTachoCount(i8 zeroext %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%4 = call i32 @OutputGetTachoCount(i8 zeroext %0, i32* %2)
%5 = load i32, i32* %2
ret i32 %5
}
int toupper(int cha) {
  if ((cha >= 'a') && (cha <= 'z'))
    return (cha - 'a' + 'A');
  return (cha);
}


x86 assembly (clang, -O0):
<toupper>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x61,-0x8(%rbp)
jl     112c <toupper+0x2c>
cmpl   $0x7a,-0x8(%rbp)
jg     112c <toupper+0x2c>
mov    -0x8(%rbp),%eax
sub    $0x61,%eax
add    $0x41,%eax
mov    %eax,-0x4(%rbp)
jmp    1132 <toupper+0x32>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<toupper>:
lea    -0x61(%rdi),%ecx
lea    -0x20(%rdi),%eax
cmp    $0x1a,%ecx
cmovae %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @toupper(i32 %0) {
%2 = add i32 %0, -97
%3 = icmp ult i32 %2, 26
%4 = add nsw i32 %0, -32
%5 = select i1 %3, i32 %4, i32 %0
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, char *);
int /*<<< orphan*/ stderr;
void usage(void) {
  fprintf(stderr, "%s\n%s\n",
          "usage: jot [-cnr] [-b word] [-w word] [-s string] [-p precision]",
          "           [reps [begin [end [s]]]]");
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
lea    0xecc(%rip),%rdx
lea    0xf06(%rip),%rcx
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rsi
lea    0xecf(%rip),%rdx
lea    0xf09(%rip),%rcx
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [7 x i8] c"%s\0A%s\0A\00"
@.str.1 = [65 x i8] c"usage: jot [-cnr] [-b word] [-w word] [-s string] [-p precision]\00"
@.str.2 = [36 x i8] c" [reps [begin [end [s]]]]\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0))
%3 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [7 x i8] c"%s\0A%s\0A\00"
@.str.1 = [65 x i8] c"usage: jot [-cnr] [-b word] [-w word] [-s string] [-p precision]\00"
@.str.2 = [36 x i8] c" [reps [begin [end [s]]]]\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0))
%3 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void usage(char *program) {
  printf("Usage:\n%s [-c as client] [-s as server] [-h help] \n", program);
  printf("example:\n");
  printf("\t%s -s \n", program);
}


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

x86 assembly (clang, -O2):
<usage>:
push   %rbx
mov    %rdi,%rbx
lea    0xed5(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xf01(%rip),%rdi
call   1030 <puts@plt>
lea    0xeec(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
pop    %rbx
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [52 x i8] c"Usage:\0A%s [-c as client] [-s as server] [-h help] \0A\00"
@.str.1 = [10 x i8] c"example:\0A\00"
@.str.2 = [9 x i8] c"\09%s -s \0A\00"
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%6 = load i8*, i8** %2
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* %6)
ret void
}

LLVM IR (-O2):
@.str = [52 x i8] c"Usage:\0A%s [-c as client] [-s as server] [-h help] \0A\00"
@.str.2 = [9 x i8] c"\09%s -s \0A\00"
@str = [9 x i8] c"example:\00"
define void @usage(i8* %0) {
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* %0)
ret void
}
char *langRomTypeSvi328Fdc() { return "SVI-328 Disk Controller"; }


x86 assembly (clang, -O0):
<langRomTypeSvi328Fdc>:
push   %rbp
mov    %rsp,%rbp
lea    0xef5(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<langRomTypeSvi328Fdc>:
lea    0xef9(%rip),%rax
ret

LLVM IR (-O0):
@.str = [24 x i8] c"SVI-328 Disk Controller\00"
define i8* @langRomTypeSvi328Fdc() {
ret i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [24 x i8] c"SVI-328 Disk Controller\00"
define i8* @langRomTypeSvi328Fdc() {
ret i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0)
}
int gcd(int x, int y) { return y ? gcd(y, x % y) : x; }


x86 assembly (clang, -O0):
<gcd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1141 <gcd+0x31>
mov    -0x8(%rbp),%edi
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    %edx,%esi
call   1030 <gcd@plt>
mov    %eax,-0xc(%rbp)
jmp    1147 <gcd+0x37>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @gcd(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %9, label %4
4: ; preds = %2, %4
%5 = phi i32 [ %7, %4 ], [ %1, %2 ]
%6 = phi i32 [ %5, %4 ], [ %0, %2 ]
%7 = srem i32 %6, %5
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %4
9: ; preds = %4, %2
%10 = phi i32 [ %0, %2 ], [ %5, %4 ]
ret i32 %10
}
/* Type definitions */
typedef int uint16_t;
struct buffer {
  int dummy;
};

/* Variables and functions */
int get8(struct buffer *);
uint16_t get16le(struct buffer *input) {
  uint16_t ret;
  ret = get8(input);
  ret |= get8(input) << 8;
  return ret;
}


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

x86 assembly (clang, -O2):
<get16le>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1030 <get8@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1030 <get8@plt>
shl    $0x8,%eax
or     %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.buffer = type { i32 }
define i32 @get16le(%struct.buffer* %0) {
%2 = alloca %struct.buffer*
%3 = alloca i32
store %struct.buffer* %0, %struct.buffer** %2
%4 = load %struct.buffer*, %struct.buffer** %2
%5 = call i32 @get8(%struct.buffer* %4)
store i32 %5, i32* %3
%6 = load %struct.buffer*, %struct.buffer** %2
%7 = call i32 @get8(%struct.buffer* %6)
%8 = shl i32 %7, 8
%9 = load i32, i32* %3
%10 = or i32 %9, %8
store i32 %10, i32* %3
%11 = load i32, i32* %3
ret i32 %11
}

LLVM IR (-O2):
%struct.buffer = type { i32 }
define i32 @get16le(%struct.buffer* %0) {
%2 = tail call i32 @get8(%struct.buffer* %0)
%3 = tail call i32 @get8(%struct.buffer* %0)
%4 = shl i32 %3, 8
%5 = or i32 %4, %2
ret i32 %5
}
void send_keyboard_report(void) {}


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

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

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

LLVM IR (-O2):
define void @send_keyboard_report() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void fun_init() {
  printf("fun_init"
         "\n");
}


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

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

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

LLVM IR (-O2):
@str = [9 x i8] c"fun_init\00"
define void @fun_init() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str, i64 0, i64 0))
ret void
}
int foo2(long long x) { return (double)x != 0; }


x86 assembly (clang, -O0):
<foo2>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
cvtsi2sdq -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
setne  %al
setp   %cl
or     %cl,%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo2>:
xor    %eax,%eax
test   %rdi,%rdi
setne  %al
ret

LLVM IR (-O0):
define i32 @foo2(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = sitofp i64 %3 to double
%5 = fcmp une double %4, 0.000000e+00
%6 = zext i1 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
define i32 @foo2(i64 %0) {
%2 = icmp ne i64 %0, 0
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Variables and functions */
double bar(float, double);
double foo(double a) { return bar(1.0f, 2.0) + a; }


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movss  0xedb(%rip),%xmm0
movsd  0xedb(%rip),%xmm1
call   1030 <bar@plt>
addsd  -0x8(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
push   %rax
movsd  %xmm0,(%rsp)
movss  0xee2(%rip),%xmm0
movsd  0xee2(%rip),%xmm1
call   1030 <bar@plt>
addsd  (%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @foo(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = call double @bar(float 1.000000e+00, double 2.000000e+00)
%4 = load double, double* %2
%5 = fadd double %3, %4
ret double %5
}

LLVM IR (-O2):
define double @foo(double %0) {
%2 = tail call double @bar(float 1.000000e+00, double 2.000000e+00)
%3 = fadd double %2, %0
ret double %3
}
/* Variables and functions */
unsigned long get_msr_value(int, int, int, int, int *);
float Read_Voltage_CPU(int cpu_num) {
  int error_indx;
  unsigned long val = get_msr_value(cpu_num, 0x198, 47, 32, &error_indx);
  return (float)val / (float)(1 << 13);
}


x86 assembly (clang, -O0):
<Read_Voltage_CPU>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x198,%esi
mov    $0x2f,%edx
mov    $0x20,%ecx
lea    -0x8(%rbp),%r8
call   1030 <get_msr_value@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rdx
shr    %rdx
mov    %eax,%ecx
and    $0x1,%ecx
or     %rdx,%rcx
cvtsi2ss %rcx,%xmm0
addss  %xmm0,%xmm0
cvtsi2ss %rax,%xmm1
movss  %xmm1,-0x18(%rbp)
test   %rax,%rax
movss  %xmm0,-0x14(%rbp)
js     1177 <Read_Voltage_CPU+0x67>
movss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
movss  0xe7c(%rip),%xmm1
divss  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Read_Voltage_CPU>:
push   %rax
lea    0x4(%rsp),%r8
mov    $0x198,%esi
mov    $0x2f,%edx
mov    $0x20,%ecx
call   1030 <get_msr_value@plt>
test   %rax,%rax
js     1136 <Read_Voltage_CPU+0x26>
cvtsi2ss %rax,%xmm0
jmp    114b <Read_Voltage_CPU+0x3b>
mov    %rax,%rcx
shr    %rcx
and    $0x1,%eax
or     %rcx,%rax
cvtsi2ss %rax,%xmm0
addss  %xmm0,%xmm0
mulss  0xead(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @Read_Voltage_CPU(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i64
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = call i64 @get_msr_value(i32 %5, i32 408, i32 47, i32 32, i32* %3)
store i64 %6, i64* %4
%7 = load i64, i64* %4
%8 = uitofp i64 %7 to float
%9 = fdiv float %8, 8.192000e+03
ret float %9
}

LLVM IR (-O2):
define float @Read_Voltage_CPU(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = call i64 @get_msr_value(i32 %0, i32 408, i32 47, i32 32, i32* %2)
%5 = uitofp i64 %4 to float
%6 = fmul float %5, 0x3F20000000000000
ret float %6
}
int fun341() { return 341; }


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

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

LLVM IR (-O0):
define i32 @fun341() {
ret i32 341
}

LLVM IR (-O2):
define i32 @fun341() {
ret i32 341
}
char *generateRandomCharArray(unsigned int length) {
  char *c;
  return c;
}


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

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

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

LLVM IR (-O2):
define noalias i8* @generateRandomCharArray(i32 %0) {
ret i8* undef
}