xunge/DecIR huggingface dataset:
/* Type definitions */
struct evhttp_request {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ add_std_hdrs(struct evhttp_request *);
int /*<<< orphan*/ evhttp_send_error(struct evhttp_request *, int,
                                     char const *);
int /*<<< orphan*/ printf(char *, char const *);
void reply_error(struct evhttp_request *req, int code,
                 const char *description) {
  add_std_hdrs(req);
  printf("[Avon] error: %s\n", description);
  evhttp_send_error(req, code, description);
}


x86 assembly (clang, -O0):
<reply_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <add_std_hdrs@plt>
mov    -0x18(%rbp),%rsi
lea    0xea9(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
call   1050 <evhttp_send_error@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<reply_error>:
push   %rbp
push   %r14
push   %rbx
mov    %rdx,%rbx
mov    %esi,%r14d
mov    %rdi,%rbp
call   1040 <add_std_hdrs@plt>
lea    0xeb7(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
mov    %rbp,%rdi
mov    %r14d,%esi
mov    %rbx,%rdx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1050 <evhttp_send_error@plt>

LLVM IR (-O0):
%struct.evhttp_request = type { i32 }
@.str = [18 x i8] c"[Avon] error: %s\0A\00"
define void @reply_error(%struct.evhttp_request* %0, i32 %1, i8* %2) {
%4 = alloca %struct.evhttp_request*
%5 = alloca i32
%6 = alloca i8*
store %struct.evhttp_request* %0, %struct.evhttp_request** %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%7 = load %struct.evhttp_request*, %struct.evhttp_request** %4
%8 = call i32 @add_std_hdrs(%struct.evhttp_request* %7)
%9 = load i8*, i8** %6
%10 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %9)
%11 = load %struct.evhttp_request*, %struct.evhttp_request** %4
%12 = load i32, i32* %5
%13 = load i8*, i8** %6
%14 = call i32 @evhttp_send_error(%struct.evhttp_request* %11, i32 %12, i8* %13)
ret void
}

LLVM IR (-O2):
%struct.evhttp_request = type { i32 }
@.str = [18 x i8] c"[Avon] error: %s\0A\00"
define void @reply_error(%struct.evhttp_request* %0, i32 %1, i8* %2) {
%4 = tail call i32 @add_std_hdrs(%struct.evhttp_request* %0)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %2)
%6 = tail call i32 @evhttp_send_error(%struct.evhttp_request* %0, i32 %1, i8* %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ errno;
scalar_t__ strerror(int /*<<< orphan*/);
const char *sock_errstr(int fd, void *arg) {
  return (const char *)strerror(errno);
}


x86 assembly (clang, -O0):
<sock_errstr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2eba(%rip),%rax
mov    (%rax),%edi
call   1030 <strerror@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sock_errstr>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
jmp    1030 <strerror@plt>

LLVM IR (-O0):
@errno = global i32 0
define i8* @sock_errstr(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
%5 = load i32, i32* @errno
%6 = call i64 @strerror(i32 %5)
%7 = inttoptr i64 %6 to i8*
ret i8* %7
}

LLVM IR (-O2):
@errno = global i32 0
define i8* @sock_errstr(i32 %0, i8* nocapture readnone %1) {
%3 = load i32, i32* @errno
%4 = tail call i64 @strerror(i32 %3)
%5 = inttoptr i64 %4 to i8*
ret i8* %5
}
/* Type definitions */
struct ludis_handle {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct ludis_handle *);
scalar_t__ handle_close(struct ludis_handle *);
int handle_free(struct ludis_handle *h) {
  if (handle_close(h) != 0)
    return -1;
  free(h);
  return 0;
}


x86 assembly (clang, -O0):
<handle_free>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <handle_close@plt>
cmp    $0x0,%rax
je     114b <handle_free+0x2b>
movl   $0xffffffff,-0x4(%rbp)
jmp    115b <handle_free+0x3b>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<handle_free>:
push   %rbx
mov    %rdi,%rbx
call   1040 <handle_close@plt>
mov    %rax,%rcx
mov    $0xffffffff,%eax
test   %rcx,%rcx
je     1138 <handle_free+0x18>
pop    %rbx
ret
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.ludis_handle = type { i32 }
define i32 @handle_free(%struct.ludis_handle* %0) {
%2 = alloca i32
%3 = alloca %struct.ludis_handle*
store %struct.ludis_handle* %0, %struct.ludis_handle** %3
%4 = load %struct.ludis_handle*, %struct.ludis_handle** %3
%5 = call i64 @handle_close(%struct.ludis_handle* %4)
%6 = icmp ne i64 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %1
store i32 -1, i32* %2
br label %11
8: ; preds = %1
%9 = load %struct.ludis_handle*, %struct.ludis_handle** %3
%10 = call i32 @free(%struct.ludis_handle* %9)
store i32 0, i32* %2
br label %11
11: ; preds = %8, %7
%12 = load i32, i32* %2
ret i32 %12
}

LLVM IR (-O2):
%struct.ludis_handle = type { i32 }
define i32 @handle_free(%struct.ludis_handle* %0) {
%2 = tail call i64 @handle_close(%struct.ludis_handle* %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @free(%struct.ludis_handle* %0)
br label %6
6: ; preds = %1, %4
%7 = phi i32 [ 0, %4 ], [ -1, %1 ]
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ regex_flag_extend_short(char, void *);
void regex_flag_extend_long(const char *const c __attribute__((unused)),
                            const char *const unused __attribute__((unused)),
                            void *data) {
  regex_flag_extend_short('e', data);
}


x86 assembly (clang, -O0):
<regex_flag_extend_long>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
mov    $0x65,%edi
call   1030 <regex_flag_extend_short@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<regex_flag_extend_long>:
mov    $0x65,%edi
mov    %rdx,%rsi
jmp    1030 <regex_flag_extend_short@plt>

LLVM IR (-O0):
define void @regex_flag_extend_long(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%7 = load i8*, i8** %6
%8 = call i32 @regex_flag_extend_short(i8 signext 101, i8* %7)
ret void
}

LLVM IR (-O2):
define void @regex_flag_extend_long(i8* nocapture readnone %0, i8* nocapture readnone %1, i8* %2) {
%4 = tail call i32 @regex_flag_extend_short(i8 signext 101, i8* %2)
ret void
}
void gtk_tree_model_get_iter_from_string() {}


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

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

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

LLVM IR (-O2):
define void @gtk_tree_model_get_iter_from_string() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int maain() {
  int a;
  if (4 > 5) {
    scanf("%d", &a);
    printf("%d", 4 - a);
  } else
    printf("%d", 5);
  return 0;
}


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

x86 assembly (clang, -O2):
<maain>:
push   %rax
lea    0xee8(%rip),%rdi
mov    $0x5,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @maain() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 5)
ret i32 0
}
void ErrNonfatal(char *msg, int a1, int a2) { return; }


x86 assembly (clang, -O0):
<ErrNonfatal>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @ErrNonfatal(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
ret void
}

LLVM IR (-O2):
define void @ErrNonfatal(i8* nocapture %0, i32 %1, i32 %2) {
ret void
}
/* Type definitions */
struct constructHeader {
  int dummy;
};

/* Variables and functions */
char const *GetConstructNameString(struct constructHeader *);
const char *EnvGetDeffactsName(void *theEnv, void *theDeffacts) {
  return GetConstructNameString((struct constructHeader *)theDeffacts);
}


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

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

LLVM IR (-O0):
%struct.constructHeader = type { i32 }
define i8* @EnvGetDeffactsName(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 = bitcast i8* %5 to %struct.constructHeader*
%7 = call i8* @GetConstructNameString(%struct.constructHeader* %6)
ret i8* %7
}

LLVM IR (-O2):
%struct.constructHeader = type { i32 }
define i8* @EnvGetDeffactsName(i8* nocapture readnone %0, i8* %1) {
%3 = bitcast i8* %1 to %struct.constructHeader*
%4 = tail call i8* @GetConstructNameString(%struct.constructHeader* %3)
ret i8* %4
}
/* Variables and functions */
int /*<<< orphan*/ keyScene(unsigned char, int /*<<< orphan*/,
                            int /*<<< orphan*/);
void menuScene(int item) { keyScene((unsigned char)item, 0, 0); }


x86 assembly (clang, -O0):
<menuScene>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
xor    %edx,%edx
movzbl %al,%edi
mov    %edx,%esi
call   1030 <keyScene@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<menuScene>:
movzbl %dil,%edi
xor    %esi,%esi
xor    %edx,%edx
jmp    1030 <keyScene@plt>

LLVM IR (-O0):
define void @menuScene(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = trunc i32 %3 to i8
%5 = call i32 @keyScene(i8 zeroext %4, i32 0, i32 0)
ret void
}

LLVM IR (-O2):
define void @menuScene(i32 %0) {
%2 = trunc i32 %0 to i8
%3 = tail call i32 @keyScene(i8 zeroext %2, i32 0, i32 0)
ret void
}
/* Variables and functions */
int RAND_MAX;
int rand();
int randint(int a, int b) {
  return a + (RAND_MAX * rand() + rand()) % (b + 1 - a);
}


x86 assembly (clang, -O0):
<randint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    0x2ebd(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
imul   %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
add    %ecx,%eax
mov    -0x8(%rbp),%ecx
add    $0x1,%ecx
sub    -0x4(%rbp),%ecx
cltd
idiv   %ecx
mov    -0xc(%rbp),%eax
add    %edx,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<randint>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%r14d
mov    0x2ec5(%rip),%rax
mov    (%rax),%r15d
xor    %eax,%eax
call   1030 <rand@plt>
mov    %eax,%ebp
imul   %r15d,%ebp
xor    %eax,%eax
call   1030 <rand@plt>
add    %ebp,%eax
sub    %r14d,%ebx
add    $0x1,%ebx
cltd
idiv   %ebx
add    %edx,%r14d
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@RAND_MAX = global i32 0
define i32 @randint(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* @RAND_MAX
%7 = call i32 (...) @rand()
%8 = mul nsw i32 %6, %7
%9 = call i32 (...) @rand()
%10 = add nsw i32 %8, %9
%11 = load i32, i32* %4
%12 = add nsw i32 %11, 1
%13 = load i32, i32* %3
%14 = sub nsw i32 %12, %13
%15 = srem i32 %10, %14
%16 = add nsw i32 %5, %15
ret i32 %16
}

LLVM IR (-O2):
@RAND_MAX = global i32 0
define i32 @randint(i32 %0, i32 %1) {
%3 = load i32, i32* @RAND_MAX
%4 = tail call i32 (...) @rand()
%5 = mul nsw i32 %4, %3
%6 = tail call i32 (...) @rand()
%7 = add nsw i32 %5, %6
%8 = sub i32 1, %0
%9 = add i32 %8, %1
%10 = srem i32 %7, %9
%11 = add nsw i32 %10, %0
ret i32 %11
}
/* Type definitions */
struct sockaddr {
  int dummy;
};

/* Variables and functions */
int getpeername(int, struct sockaddr *, unsigned int *);
int Xgetpeername(int s, struct sockaddr *a, int *l) {
  unsigned int rl;
  int code;
  rl = *l;
  code = getpeername(s, a, &rl);
  *l = rl;
  return code;
}


x86 assembly (clang, -O0):
<Xgetpeername>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    -0x1c(%rbp),%rdx
call   1030 <getpeername@plt>
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x20(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Xgetpeername>:
push   %rbx
sub    $0x10,%rsp
mov    %rdx,%rbx
mov    (%rdx),%eax
mov    %eax,0xc(%rsp)
lea    0xc(%rsp),%rdx
call   1030 <getpeername@plt>
mov    0xc(%rsp),%ecx
mov    %ecx,(%rbx)
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.sockaddr = type { i32 }
define i32 @Xgetpeername(i32 %0, %struct.sockaddr* %1, i32* %2) {
%4 = alloca i32
%5 = alloca %struct.sockaddr*
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %4
store %struct.sockaddr* %1, %struct.sockaddr** %5
store i32* %2, i32** %6
%9 = load i32*, i32** %6
%10 = load i32, i32* %9
store i32 %10, i32* %7
%11 = load i32, i32* %4
%12 = load %struct.sockaddr*, %struct.sockaddr** %5
%13 = call i32 @getpeername(i32 %11, %struct.sockaddr* %12, i32* %7)
store i32 %13, i32* %8
%14 = load i32, i32* %7
%15 = load i32*, i32** %6
store i32 %14, i32* %15
%16 = load i32, i32* %8
ret i32 %16
}

LLVM IR (-O2):
%struct.sockaddr = type { i32 }
define i32 @Xgetpeername(i32 %0, %struct.sockaddr* %1, i32* nocapture %2) {
%4 = alloca i32
%5 = bitcast i32* %4 to i8*
%6 = load i32, i32* %2
store i32 %6, i32* %4
%7 = call i32 @getpeername(i32 %0, %struct.sockaddr* %1, i32* %4)
%8 = load i32, i32* %4
store i32 %8, i32* %2
ret i32 %7
}
void XcmsQueryBlue() {}


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

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

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

LLVM IR (-O2):
define void @XcmsQueryBlue() {
ret void
}
/* Type definitions */
struct toml_node {
  int dummy;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ _toml_dump(struct toml_node *, int /*<<< orphan*/ *,
                              int /*<<< orphan*/ *, int /*<<< orphan*/, int);
void toml_dump(struct toml_node *toml_root, FILE *output) {
  _toml_dump(toml_root, output, NULL, 0, 1);
}


x86 assembly (clang, -O0):
<toml_dump>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edx
xor    %ecx,%ecx
mov    $0x1,%r8d
call   1030 <_toml_dump@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<toml_dump>:
xor    %edx,%edx
xor    %ecx,%ecx
mov    $0x1,%r8d
jmp    1030 <_toml_dump@plt>

LLVM IR (-O0):
%struct.toml_node = type { i32 }
define void @toml_dump(%struct.toml_node* %0, i32* %1) {
%3 = alloca %struct.toml_node*
%4 = alloca i32*
store %struct.toml_node* %0, %struct.toml_node** %3
store i32* %1, i32** %4
%5 = load %struct.toml_node*, %struct.toml_node** %3
%6 = load i32*, i32** %4
%7 = call i32 @_toml_dump(%struct.toml_node* %5, i32* %6, i32* null, i32 0, i32 1)
ret void
}

LLVM IR (-O2):
%struct.toml_node = type { i32 }
define void @toml_dump(%struct.toml_node* %0, i32* %1) {
%3 = tail call i32 @_toml_dump(%struct.toml_node* %0, i32* %1, i32* null, i32 0, i32 1)
ret void
}
void YM2612_write(const unsigned short port, const unsigned char data) {
  volatile unsigned char *pb;
  pb = (unsigned char *)0xA04000;
  pb[port & 3] = data;
}


x86 assembly (clang, -O0):
<YM2612_write>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %di,%cx
mov    %cx,-0x2(%rbp)
mov    %al,-0x3(%rbp)
mov    $0xa04000,%eax
mov    %rax,-0x10(%rbp)
mov    -0x3(%rbp),%dl
mov    -0x10(%rbp),%rax
movzwl -0x2(%rbp),%ecx
and    $0x3,%ecx
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
pop    %rbp
ret

x86 assembly (clang, -O2):
<YM2612_write>:
and    $0x3,%edi
mov    %sil,0xa04000(%rdi)
ret

LLVM IR (-O0):
define void @YM2612_write(i16 zeroext %0, i8 zeroext %1) {
%3 = alloca i16
%4 = alloca i8
%5 = alloca i8*
store i16 %0, i16* %3
store i8 %1, i8* %4
store i8* inttoptr (i64 10502144 to i8*), i8** %5
%6 = load i8, i8* %4
%7 = load i8*, i8** %5
%8 = load i16, i16* %3
%9 = zext i16 %8 to i32
%10 = and i32 %9, 3
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i8, i8* %7, i64 %11
store volatile i8 %6, i8* %12
ret void
}

LLVM IR (-O2):
define void @YM2612_write(i16 zeroext %0, i8 zeroext %1) {
%3 = and i16 %0, 3
%4 = zext i16 %3 to i64
%5 = getelementptr inbounds i8, i8* inttoptr (i64 10502144 to i8*), i64 %4
store volatile i8 %1, i8* %5
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, ...);
void usage(char *progname) {
  printf("Version: 0.3, 2009/06/24\n");
  printf("Usage: %s <host ip> <host mac> <user name> [password]\n", progname);
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xecd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
lea    0xed5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rbx
mov    %rdi,%rbx
lea    0xefc(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb9(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [26 x i8] c"Version: 0.3, 2009/06/24\0A\00"
@.str.1 = [55 x i8] c"Usage: %s <host ip> <host mac> <user name> [password]\0A\00"
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%4 = load i8*, i8** %2
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%6 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@.str.1 = [55 x i8] c"Usage: %s <host ip> <host mac> <user name> [password]\0A\00"
@str = [25 x i8] c"Version: 0.3, 2009/06/24\00"
define void @usage(i8* %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%4 = tail call i32 @exit(i32 1)
unreachable
}
void uYuv_ClearCoeff(void) {}


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

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

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

LLVM IR (-O2):
define void @uYuv_ClearCoeff() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void set_motors_speed(int steps_per_sec) {
  if (steps_per_sec > 0 && steps_per_sec < (201)) {
    printf("Set speed to %d\n", steps_per_sec);
  }
}


x86 assembly (clang, -O0):
<set_motors_speed>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jle    1141 <set_motors_speed+0x31>
cmpl   $0xc9,-0x4(%rbp)
jge    1141 <set_motors_speed+0x31>
mov    -0x4(%rbp),%esi
lea    0xec4(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_motors_speed>:
mov    %edi,%esi
lea    -0x1(%rsi),%eax
cmp    $0xc7,%eax
ja     1128 <set_motors_speed+0x18>
lea    0xedd(%rip),%rdi
jmp    1030 <printf@plt>
ret

LLVM IR (-O0):
@.str = [17 x i8] c"Set speed to %d\0A\00"
define void @set_motors_speed(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sgt i32 %3, 0
br i1 %4, label %5, label %11
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp slt i32 %6, 201
br i1 %7, label %8, label %11
8: ; preds = %5
%9 = load i32, i32* %2
%10 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %9)
br label %11
11: ; preds = %8, %5, %1
ret void
}

LLVM IR (-O2):
@.str = [17 x i8] c"Set speed to %d\0A\00"
define void @set_motors_speed(i32 %0) {
%2 = add i32 %0, -1
%3 = icmp ult i32 %2, 200
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %0)
br label %6
6: ; preds = %4, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ glDisable(unsigned int);
void Disable(unsigned int f) { glDisable(f); }


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

x86 assembly (clang, -O2):
<Disable>:
jmp    1030 <glDisable@plt>

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

LLVM IR (-O2):
define void @Disable(i32 %0) {
%2 = tail call i32 @glDisable(i32 %0)
ret void
}
/* Variables and functions */
void bzero_char(char *ptr, size_t size) {
  if (size & 1) {
    *(ptr++) = 0;
  }
  size /= 2;
  while (size--) {
    *(ptr++) = 0;
    *(ptr++) = 0;
  }
}


x86 assembly (clang, -O0):
<bzero_char>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
and    $0x1,%rax
cmp    $0x0,%rax
je     1130 <bzero_char+0x30>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movb   $0x0,(%rax)
mov    -0x10(%rbp),%rax
shr    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,-0x10(%rbp)
cmp    $0x0,%rax
je     117e <bzero_char+0x7e>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movb   $0x0,(%rax)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movb   $0x0,(%rax)
jmp    113c <bzero_char+0x3c>
pop    %rbp
ret

x86 assembly (clang, -O2):
<bzero_char>:
push   %rax
mov    %rsi,%rdx
test   $0x1,%dl
jne    1121 <bzero_char+0x11>
cmp    $0x2,%rdx
jae    112e <bzero_char+0x1e>
pop    %rax
ret
movb   $0x0,(%rdi)
add    $0x1,%rdi
cmp    $0x2,%rdx
jb     111f <bzero_char+0xf>
and    $0xfffffffffffffffe,%rdx
xor    %esi,%esi
call   1030 <memset@plt>
pop    %rax
ret

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

LLVM IR (-O2):
define void @bzero_char(i8* nocapture writeonly %0, i64 %1) {
%3 = and i64 %1, 1
%4 = icmp eq i64 %3, 0
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = getelementptr inbounds i8, i8* %0, i64 1
store i8 0, i8* %0
br label %7
7: ; preds = %5, %2
%8 = phi i8* [ %6, %5 ], [ %0, %2 ]
%9 = icmp ult i64 %1, 2
br i1 %9, label %12, label %10
10: ; preds = %7
%11 = and i64 %1, -2
br label %12
12: ; preds = %10, %7
ret void
}
void ResetRadio(void) {}


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

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

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

LLVM IR (-O2):
define void @ResetRadio() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ op_div();
void vm_op_div(void) {
  op_div();
  return;
}


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

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

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

LLVM IR (-O2):
define void @vm_op_div() {
%1 = tail call i32 (...) @op_div()
ret void
}
void SplitUVRow_SSE2() {}


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

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

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

LLVM IR (-O2):
define void @SplitUVRow_SSE2() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ loganon_ip_anon(int, char **);
int /*<<< orphan*/ printf(char *);
int main(int argc, char **argv) {
  printf("Starting IPAnon demo..\n");
  loganon_ip_anon(argc, argv);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0xed1(%rip),%rdi
call   1030 <puts@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
call   1040 <loganon_ip_anon@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
@str = [23 x i8] c"Starting IPAnon demo..\00"
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @loganon_ip_anon(i32 %0, i8** %1)
ret i32 0
}
void igraph_warning_handler_ignore(const char *reason, const char *file,
                                   int line, int igraph_errno) {}


x86 assembly (clang, -O0):
<igraph_warning_handler_ignore>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @igraph_warning_handler_ignore(i8* nocapture %0, i8* nocapture %1, i32 %2, i32 %3) {
ret void
}
isatty(int fd) { return 1; }


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

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

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

LLVM IR (-O2):
define i32 @isatty(i32 %0) {
ret i32 1
}
/* Variables and functions */
int inp_emulate(int);
char TOSH_READ_FLASH_IN_PIN() { return 0x01 & (inp_emulate(0x35) >> 6); }


x86 assembly (clang, -O0):
<TOSH_READ_FLASH_IN_PIN>:
push   %rbp
mov    %rsp,%rbp
mov    $0x35,%edi
call   1030 <inp_emulate@plt>
sar    $0x6,%eax
and    $0x1,%eax
movsbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<TOSH_READ_FLASH_IN_PIN>:
push   %rax
mov    $0x35,%edi
call   1030 <inp_emulate@plt>
shr    $0x6,%al
and    $0x1,%al
pop    %rcx
ret

LLVM IR (-O0):
define signext i8 @TOSH_READ_FLASH_IN_PIN() {
%1 = call i32 @inp_emulate(i32 53)
%2 = ashr i32 %1, 6
%3 = and i32 1, %2
%4 = trunc i32 %3 to i8
ret i8 %4
}

LLVM IR (-O2):
define signext i8 @TOSH_READ_FLASH_IN_PIN() {
%1 = tail call i32 @inp_emulate(i32 53)
%2 = trunc i32 %1 to i8
%3 = lshr i8 %2, 6
%4 = and i8 %3, 1
ret i8 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main() {
  int ans = 0, curr = 1, next = 2, tmp;
  while (curr < 4000000) {
    if (curr % 2 == 0)
      ans += curr;
    tmp = next;
    next += curr;
    curr = tmp;
  }
  printf("%d\n", ans);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
movl   $0x2,-0x10(%rbp)
cmpl   $0x3d0900,-0xc(%rbp)
jge    1178 <main+0x68>
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    115e <main+0x4e>
mov    -0xc(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1134 <main+0x24>
mov    -0x8(%rbp),%esi
lea    0xe7e(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
store i32 1, i32* %3
store i32 2, i32* %4
br label %6
6: ; preds = %17, %0
%7 = load i32, i32* %3
%8 = icmp slt i32 %7, 4000000
br i1 %8, label %9, label %23
9: ; preds = %6
%10 = load i32, i32* %3
%11 = srem i32 %10, 2
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %17
13: ; preds = %9
%14 = load i32, i32* %3
%15 = load i32, i32* %2
%16 = add nsw i32 %15, %14
store i32 %16, i32* %2
br label %17
17: ; preds = %13, %9
%18 = load i32, i32* %4
store i32 %18, i32* %5
%19 = load i32, i32* %3
%20 = load i32, i32* %4
%21 = add nsw i32 %20, %19
store i32 %21, i32* %4
%22 = load i32, i32* %5
store i32 %22, i32* %3
br label %6
23: ; preds = %6
%24 = load i32, i32* %2
%25 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %24)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 4613732)
ret i32 0
}
int test_imm_D3int16_reg(short val) {
  return ((val) & (-0xD3 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_D3int16_reg(i16 signext %0) {
%2 = and i16 %0, -211
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Type definitions */
typedef scalar_t__ uint32_t;

/* Variables and functions */
void SysTickPeriodSet(uint32_t ui32Period) {
  ;
  (*((volatile uint32_t *)(0xE000E014))) = ui32Period - 1;
}


x86 assembly (clang, -O0):
<SysTickPeriodSet>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rcx
sub    $0x1,%rcx
mov    $0xe000e014,%eax
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<SysTickPeriodSet>:
add    $0xffffffffffffffff,%rdi
mov    $0xe000e014,%eax
mov    %rdi,(%rax)
ret

LLVM IR (-O0):
define void @SysTickPeriodSet(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = sub nsw i64 %3, 1
store volatile i64 %4, i64* inttoptr (i64 3758153748 to i64*)
ret void
}

LLVM IR (-O2):
define void @SysTickPeriodSet(i64 %0) {
%2 = add nsw i64 %0, -1
store volatile i64 %2, i64* inttoptr (i64 3758153748 to i64*)
ret void
}
/* Variables and functions */
int INT_MIN;
int divide_power2(int x, int k) {
  int sign = (x & INT_MIN) == INT_MIN;
  int mask = (1 << k) - 1;
  int bias = (mask + !sign) & mask;
  return (x + bias) >> k;
}


x86 assembly (clang, -O0):
<divide_power2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    0x2ed4(%rip),%rcx
and    (%rcx),%eax
mov    0x2ecb(%rip),%rcx
cmp    (%rcx),%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
sub    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmpl   $0x0,-0xc(%rbp)
setne  %cl
xor    $0xff,%cl
and    $0x1,%cl
movzbl %cl,%ecx
add    %ecx,%eax
and    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%eax
add    -0x14(%rbp),%eax
mov    -0x8(%rbp),%ecx
sar    %cl,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<divide_power2>:
mov    %esi,%ecx
mov    0x2edf(%rip),%rax
mov    %edi,%edx
not    %edx
and    (%rax),%edx
mov    $0xffffffff,%esi
shl    %cl,%esi
not    %esi
cmp    $0x1,%edx
mov    %esi,%eax
sbb    $0xffffffff,%eax
and    %esi,%eax
add    %edi,%eax
sar    %cl,%eax
ret

LLVM IR (-O0):
@INT_MIN = global i32 0
define i32 @divide_power2(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
%9 = load i32, i32* @INT_MIN
%10 = and i32 %8, %9
%11 = load i32, i32* @INT_MIN
%12 = icmp eq i32 %10, %11
%13 = zext i1 %12 to i32
store i32 %13, i32* %5
%14 = load i32, i32* %4
%15 = shl i32 1, %14
%16 = sub nsw i32 %15, 1
store i32 %16, i32* %6
%17 = load i32, i32* %6
%18 = load i32, i32* %5
%19 = icmp ne i32 %18, 0
%20 = xor i1 %19, true
%21 = zext i1 %20 to i32
%22 = add nsw i32 %17, %21
%23 = load i32, i32* %6
%24 = and i32 %22, %23
store i32 %24, i32* %7
%25 = load i32, i32* %3
%26 = load i32, i32* %7
%27 = add nsw i32 %25, %26
%28 = load i32, i32* %4
%29 = ashr i32 %27, %28
ret i32 %29
}

LLVM IR (-O2):
@INT_MIN = global i32 0
define i32 @divide_power2(i32 %0, i32 %1) {
%3 = load i32, i32* @INT_MIN
%4 = and i32 %3, %0
%5 = icmp ne i32 %4, %3
%6 = shl nsw i32 -1, %1
%7 = xor i32 %6, -1
%8 = zext i1 %5 to i32
%9 = add nsw i32 %8, %7
%10 = and i32 %9, %7
%11 = add nsw i32 %10, %0
%12 = ashr i32 %11, %1
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void interrupt_handler() { printf("User interrupt set by ILATST.\n"); }


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

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

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

LLVM IR (-O2):
@str = [30 x i8] c"User interrupt set by ILATST.\00"
define void @interrupt_handler() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
ret void
}
void intel_io_unlock(void) {}


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

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

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

LLVM IR (-O2):
define void @intel_io_unlock() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint64_t;

/* Variables and functions */
void set_64bit(__volatile__ uint64_t *ptr, uint64_t val) { *ptr = val; }


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

x86 assembly (clang, -O2):
<set_64bit>:
mov    %esi,(%rdi)
ret

LLVM IR (-O0):
define void @set_64bit(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 = load i32*, i32** %3
store volatile i32 %5, i32* %6
ret void
}

LLVM IR (-O2):
define void @set_64bit(i32* %0, i32 %1) {
store volatile i32 %1, i32* %0
ret void
}
void setpin1() {
  (*(volatile unsigned long *)(0x3FFFC000 + 0x18)) = (1 << 7);
  (*(volatile unsigned long *)(0x3FFFC000 + 0x00)) |= (1 << 7);
}


x86 assembly (clang, -O0):
<setpin1>:
push   %rbp
mov    %rsp,%rbp
mov    $0x3fffc018,%eax
movq   $0x80,(%rax)
mov    $0x3fffc000,%eax
mov    (%rax),%rcx
or     $0x80,%rcx
mov    $0x3fffc000,%eax
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<setpin1>:
movq   $0x80,0x3fffc018
orq    $0x80,0x3fffc000
ret

LLVM IR (-O0):
define void @setpin1() {
store volatile i64 128, i64* inttoptr (i64 1073725464 to i64*)
%1 = load volatile i64, i64* inttoptr (i64 1073725440 to i64*)
%2 = or i64 %1, 128
store volatile i64 %2, i64* inttoptr (i64 1073725440 to i64*)
ret void
}

LLVM IR (-O2):
define void @setpin1() {
store volatile i64 128, i64* inttoptr (i64 1073725464 to i64*)
%1 = load volatile i64, i64* inttoptr (i64 1073725440 to i64*)
%2 = or i64 %1, 128
store volatile i64 %2, i64* inttoptr (i64 1073725440 to i64*)
ret void
}
/* Variables and functions */
scalar_t__ close(int);
int /*<<< orphan*/ xerror(char *);
void xclose(int fd) {
  if (close(fd) != 0)
    xerror("close");
}


x86 assembly (clang, -O0):
<xclose>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <close@plt>
cmp    $0x0,%rax
je     1149 <xclose+0x29>
lea    0xebc(%rip),%rdi
call   1030 <xerror@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xclose>:
push   %rax
call   1040 <close@plt>
test   %rax,%rax
je     1138 <xclose+0x18>
lea    0xece(%rip),%rdi
pop    %rax
jmp    1030 <xerror@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [6 x i8] c"close\00"
define void @xclose(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i64 @close(i32 %3)
%5 = icmp ne i64 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = call i32 @xerror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %1
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"close\00"
define void @xclose(i32 %0) {
%2 = tail call i64 @close(i32 %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @xerror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %4, %1
ret void
}
/* Variables and functions */
int bitcount(int);
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  printf("%d\n", bitcount(0xff));
  printf("%d\n", bitcount(0x11141720));
  printf("%d\n", bitcount(0x414243));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0xff,%edi
call   1040 <bitcount@plt>
mov    %eax,%esi
lea    0xebe(%rip),%rdi
call   1030 <printf@plt>
mov    $0x11141720,%edi
call   1040 <bitcount@plt>
mov    %eax,%esi
lea    0xea6(%rip),%rdi
call   1030 <printf@plt>
mov    $0x414243,%edi
call   1040 <bitcount@plt>
mov    %eax,%esi
lea    0xe8e(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0xff,%edi
call   1040 <bitcount@plt>
lea    0xece(%rip),%rbx
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    $0x11141720,%edi
call   1040 <bitcount@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    $0x414243,%edi
call   1040 <bitcount@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 @bitcount(i32 255)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = tail call i32 @bitcount(i32 286529312)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = tail call i32 @bitcount(i32 4276803)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %5)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ SHA256_compare_read(int /*<<< orphan*/ *);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ stdout;
int main() {
  FILE *fp = fopen("input", "r");
  SHA256_compare_read(fp);
  SHA256_compare_read(fp);
  fflush(stdout);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
lea    0xec0(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <SHA256_compare_read@plt>
mov    -0x8(%rbp),%rdi
call   1050 <SHA256_compare_read@plt>
mov    0x2e78(%rip),%rax
mov    (%rax),%edi
call   1030 <fflush@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xec8(%rip),%rdi
lea    0xec7(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1050 <SHA256_compare_read@plt>
mov    %rbx,%rdi
call   1050 <SHA256_compare_read@plt>
mov    0x2e82(%rip),%rax
mov    (%rax),%edi
call   1030 <fflush@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"input\00"
@.str.1 = [2 x i8] c"r\00"
@stdout = global i32 0
define i32 @main() {
%1 = alloca i32*
%2 = call i32* @fopen(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %2, i32** %1
%3 = load i32*, i32** %1
%4 = call i32 @SHA256_compare_read(i32* %3)
%5 = load i32*, i32** %1
%6 = call i32 @SHA256_compare_read(i32* %5)
%7 = load i32, i32* @stdout
%8 = call i32 @fflush(i32 %7)
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"input\00"
@.str.1 = [2 x i8] c"r\00"
@stdout = global i32 0
define i32 @main() {
%1 = tail call i32* @fopen(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 @SHA256_compare_read(i32* %1)
%3 = tail call i32 @SHA256_compare_read(i32* %1)
%4 = load i32, i32* @stdout
%5 = tail call i32 @fflush(i32 %4)
ret i32 0
}
/* Type definitions */
struct uftrace_report_node {
  int dummy;
};
struct rb_root {
  int dummy;
};

/* Variables and functions */
struct uftrace_report_node *find_or_create_node(struct rb_root *, char const *,
                                                int /*<<< orphan*/ *);
struct uftrace_report_node *report_find_node(struct rb_root *root,
                                             const char *name) {
  return find_or_create_node(root, name, NULL);
}


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

x86 assembly (clang, -O2):
<report_find_node>:
xor    %edx,%edx
jmp    1030 <find_or_create_node@plt>

LLVM IR (-O0):
%struct.uftrace_report_node = type { i32 }
%struct.rb_root = type { i32 }
define %struct.uftrace_report_node* @report_find_node(%struct.rb_root* %0, i8* %1) {
%3 = alloca %struct.rb_root*
%4 = alloca i8*
store %struct.rb_root* %0, %struct.rb_root** %3
store i8* %1, i8** %4
%5 = load %struct.rb_root*, %struct.rb_root** %3
%6 = load i8*, i8** %4
%7 = call %struct.uftrace_report_node* @find_or_create_node(%struct.rb_root* %5, i8* %6, i32* null)
ret %struct.uftrace_report_node* %7
}

LLVM IR (-O2):
%struct.uftrace_report_node = type { i32 }
%struct.rb_root = type { i32 }
define %struct.uftrace_report_node* @report_find_node(%struct.rb_root* %0, i8* %1) {
%3 = tail call %struct.uftrace_report_node* @find_or_create_node(%struct.rb_root* %0, i8* %1, i32* null)
ret %struct.uftrace_report_node* %3
}
/* Variables and functions */
float log(int);
float log2(float n) { return log(n) / log(2); }


x86 assembly (clang, -O0):
<log2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
cvttss2si -0x4(%rbp),%edi
call   1030 <log@plt>
movss  %xmm0,-0x8(%rbp)
mov    $0x2,%edi
call   1030 <log@plt>
movaps %xmm0,%xmm1
movss  -0x8(%rbp),%xmm0
divss  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<log2>:
push   %rax
cvttss2si %xmm0,%edi
call   1030 <log@plt>
movss  %xmm0,0x4(%rsp)
mov    $0x2,%edi
call   1030 <log@plt>
movss  0x4(%rsp),%xmm1
divss  %xmm0,%xmm1
movaps %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @log2(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = fptosi float %3 to i32
%5 = call float @log(i32 %4)
%6 = call float @log(i32 2)
%7 = fdiv float %5, %6
ret float %7
}

LLVM IR (-O2):
define float @log2(float %0) {
%2 = fptosi float %0 to i32
%3 = tail call float @log(i32 %2)
%4 = tail call float @log(i32 2)
%5 = fdiv float %3, %4
ret float %5
}
/* Variables and functions */
int get_filesize(char *);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ system(char *);
int main() {
  printf("FILESIZE: %d-bytes\n", get_filesize("tmp.txt"));
  system("wc -c tmp.txt");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xed4(%rip),%rdi
call   1050 <get_filesize@plt>
mov    %eax,%esi
lea    0xeac(%rip),%rdi
call   1040 <printf@plt>
lea    0xeb4(%rip),%rdi
call   1030 <system@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee2(%rip),%rdi
call   1050 <get_filesize@plt>
lea    0xebc(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
lea    0xec2(%rip),%rdi
call   1030 <system@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [20 x i8] c"FILESIZE: %d-bytes\0A\00"
@.str.1 = [8 x i8] c"tmp.txt\00"
@.str.2 = [14 x i8] c"wc -c tmp.txt\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @get_filesize(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = call i32 @system(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [20 x i8] c"FILESIZE: %d-bytes\0A\00"
@.str.1 = [8 x i8] c"tmp.txt\00"
@.str.2 = [14 x i8] c"wc -c tmp.txt\00"
define i32 @main() {
%1 = tail call i32 @get_filesize(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = tail call i32 @system(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}