xunge/DecIR huggingface dataset:
int test_imm_AAint64_lowword_mem(long long *val) {
  return ((*val) & (0xAA << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_AAint64_lowword_mem(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64, i64* %3
%5 = and i64 %4, 170
%6 = icmp ne i64 %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_AAint64_lowword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 170
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int fork();
int fork1(void) {
  int pid;
  pid = fork();
  return pid;
}


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

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

LLVM IR (-O0):
define i32 @fork1() {
%1 = alloca i32
%2 = call i32 (...) @fork()
store i32 %2, i32* %1
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
define i32 @fork1() {
%1 = tail call i32 (...) @fork()
ret i32 %1
}
void byte2hex(char in, char *out) {
  char hexChars[] = {'0', '1', '2', '3', '4', '5', '6', '7',
                     '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
  out[2] = 0;
  out[1] = hexChars[in & 0x0F];
  out[0] = hexChars[(in & 0xF0) >> 4];
}


x86 assembly (clang, -O0):
<byte2hex>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xeeb(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xee8(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movb   $0x0,0x2(%rax)
movsbl -0x1(%rbp),%eax
and    $0xf,%eax
cltq
mov    -0x20(%rbp,%rax,1),%cl
mov    -0x10(%rbp),%rax
mov    %cl,0x1(%rax)
movsbl -0x1(%rbp),%eax
and    $0xf0,%eax
sar    $0x4,%eax
cltq
mov    -0x20(%rbp,%rax,1),%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<byte2hex>:
movb   $0x0,0x2(%rsi)
movzbl %dil,%eax
and    $0xf,%edi
lea    0xeee(%rip),%rcx
mov    (%rdi,%rcx,1),%dl
mov    %dl,0x1(%rsi)
shr    $0x4,%rax
mov    (%rax,%rcx,1),%al
mov    %al,(%rsi)
ret

LLVM IR (-O0):
@__const.byte2hex.hexChars = [16 x i8] c"0123456789ABCDEF"
define void @byte2hex(i8 signext %0, i8* %1) {
%3 = alloca i8
%4 = alloca i8*
%5 = alloca [16 x i8]
store i8 %0, i8* %3
store i8* %1, i8** %4
%6 = bitcast [16 x i8]* %5 to i8*
%7 = load i8*, i8** %4
%8 = getelementptr inbounds i8, i8* %7, i64 2
store i8 0, i8* %8
%9 = load i8, i8* %3
%10 = sext i8 %9 to i32
%11 = and i32 %10, 15
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds [16 x i8], [16 x i8]* %5, i64 0, i64 %12
%14 = load i8, i8* %13
%15 = load i8*, i8** %4
%16 = getelementptr inbounds i8, i8* %15, i64 1
store i8 %14, i8* %16
%17 = load i8, i8* %3
%18 = sext i8 %17 to i32
%19 = and i32 %18, 240
%20 = ashr i32 %19, 4
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [16 x i8], [16 x i8]* %5, i64 0, i64 %21
%23 = load i8, i8* %22
%24 = load i8*, i8** %4
%25 = getelementptr inbounds i8, i8* %24, i64 0
store i8 %23, i8* %25
ret void
}

LLVM IR (-O2):
@__const.byte2hex.hexChars = [16 x i8] c"0123456789ABCDEF"
define void @byte2hex(i8 signext %0, i8* nocapture writeonly %1) {
%3 = getelementptr inbounds i8, i8* %1, i64 2
store i8 0, i8* %3
%4 = zext i8 %0 to i32
%5 = and i32 %4, 15
%6 = zext i32 %5 to i64
%7 = getelementptr inbounds [16 x i8], [16 x i8]* @__const.byte2hex.hexChars, i64 0, i64 %6
%8 = load i8, i8* %7
%9 = getelementptr inbounds i8, i8* %1, i64 1
store i8 %8, i8* %9
%10 = lshr i32 %4, 4
%11 = zext i32 %10 to i64
%12 = getelementptr inbounds [16 x i8], [16 x i8]* @__const.byte2hex.hexChars, i64 0, i64 %11
%13 = load i8, i8* %12
store i8 %13, i8* %1
ret void
}
/* Variables and functions */
int rand();
int get_nonce(void) {
  static int nonce;
  -1 == nonce;
  if (nonce == -1) {
    int nonce = rand();
  }
  return nonce;
}


x86 assembly (clang, -O0):
<get_nonce>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
cmpl   $0xffffffff,0x2f0d(%rip)
jne    112f <get_nonce+0x1f>
mov    $0x0,%al
call   1030 <rand@plt>
mov    %eax,-0x4(%rbp)
mov    0x2ef7(%rip),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@get_nonce.nonce = internal global i32 0
define i32 @get_nonce() {
%1 = alloca i32
%2 = load i32, i32* @get_nonce.nonce
%3 = icmp eq i32 -1, %2
%4 = zext i1 %3 to i32
%5 = load i32, i32* @get_nonce.nonce
%6 = icmp eq i32 %5, -1
br i1 %6, label %7, label %9
7: ; preds = %0
%8 = call i32 (...) @rand()
store i32 %8, i32* %1
br label %9
9: ; preds = %7, %0
%10 = load i32, i32* @get_nonce.nonce
ret i32 %10
}

LLVM IR (-O2):
define i32 @get_nonce() {
ret i32 0
}
int isspace(int c) { return (c == ' ' || c == '\t' || c == '\n'); }


x86 assembly (clang, -O0):
<isspace>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    $0x1,%al
cmpl   $0x20,-0x4(%rbp)
mov    %al,-0x5(%rbp)
je     112f <isspace+0x2f>
mov    $0x1,%al
cmpl   $0x9,-0x4(%rbp)
mov    %al,-0x5(%rbp)
je     112f <isspace+0x2f>
cmpl   $0xa,-0x4(%rbp)
sete   %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isspace>:
mov    $0x1,%eax
cmp    $0x9,%edi
je     110f <isspace+0xf>
cmp    $0x20,%edi
jne    1110 <isspace+0x10>
ret
xor    %eax,%eax
cmp    $0xa,%edi
sete   %al
ret

LLVM IR (-O0):
define i32 @isspace(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp eq i32 %3, 32
br i1 %4, label %11, label %5
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp eq i32 %6, 9
br i1 %7, label %11, label %8
8: ; preds = %5
%9 = load i32, i32* %2
%10 = icmp eq i32 %9, 10
br label %11
11: ; preds = %8, %5, %1
%12 = phi i1 [ true, %5 ], [ true, %1 ], [ %10, %8 ]
%13 = zext i1 %12 to i32
ret i32 %13
}

LLVM IR (-O2):
define i32 @isspace(i32 %0) {
switch i32 %0, label %2 [
i32 32, label %5
i32 9, label %5
]
2: ; preds = %1
%3 = icmp eq i32 %0, 10
%4 = zext i1 %3 to i32
br label %5
5: ; preds = %1, %1, %2
%6 = phi i32 [ 1, %1 ], [ %4, %2 ], [ 1, %1 ]
ret i32 %6
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ _IOFBF;
int /*<<< orphan*/ _IONBF;
int /*<<< orphan*/ setvbuf(int /*<<< orphan*/ *, char *, int /*<<< orphan*/,
                           size_t);
void setbuffer(FILE *f, char *buf, size_t size) {
  setvbuf(f, buf, buf ? _IOFBF : _IONBF, size);
}


x86 assembly (clang, -O0):
<setbuffer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1150 <setbuffer+0x40>
mov    0x2e92(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x2c(%rbp)
jmp    115c <setbuffer+0x4c>
mov    0x2e91(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdi
mov    -0x2c(%rbp),%edx
mov    -0x18(%rbp),%rcx
call   1030 <setvbuf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setbuffer>:
mov    %rdx,%rcx
test   %rsi,%rsi
jne    1126 <setbuffer+0x16>
mov    0x2ec9(%rip),%rax
mov    (%rax),%edx
jmp    1030 <setvbuf@plt>
mov    0x2eab(%rip),%rax
mov    (%rax),%edx
jmp    1030 <setvbuf@plt>

LLVM IR (-O0):
@_IOFBF = global i32 0
@_IONBF = global i32 0
define void @setbuffer(i32* %0, i8* %1, i64 %2) {
%4 = alloca i32*
%5 = alloca i8*
%6 = alloca i64
store i32* %0, i32** %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%7 = load i32*, i32** %4
%8 = load i8*, i8** %5
%9 = load i8*, i8** %5
%10 = icmp ne i8* %9, null
br i1 %10, label %11, label %13
11: ; preds = %3
%12 = load i32, i32* @_IOFBF
br label %15
13: ; preds = %3
%14 = load i32, i32* @_IONBF
br label %15
15: ; preds = %13, %11
%16 = phi i32 [ %12, %11 ], [ %14, %13 ]
%17 = load i64, i64* %6
%18 = call i32 @setvbuf(i32* %7, i8* %8, i32 %16, i64 %17)
ret void
}

LLVM IR (-O2):
@_IOFBF = global i32 0
@_IONBF = global i32 0
define void @setbuffer(i32* nocapture %0, i8* %1, i64 %2) {
%4 = icmp eq i8* %1, null
%5 = load i32, i32* @_IOFBF
%6 = load i32, i32* @_IONBF
%7 = select i1 %4, i32 %6, i32 %5
%8 = tail call i32 @setvbuf(i32* %0, i8* %1, i32 %7, i64 %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ AddParam(char *);
void LoadConfiguration(int argc, char *argv[]) {
  int n;
  for (n = 0; n < argc; n++)
    AddParam(argv[n]);
}


x86 assembly (clang, -O0):
<LoadConfiguration>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1151 <LoadConfiguration+0x41>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <AddParam@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1126 <LoadConfiguration+0x16>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<LoadConfiguration>:
push   %r15
push   %r14
push   %rbx
test   %edi,%edi
jle    1142 <LoadConfiguration+0x32>
mov    %rsi,%r14
mov    %edi,%r15d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%r14,%rbx,8),%rdi
call   1030 <AddParam@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1130 <LoadConfiguration+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @LoadConfiguration(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 0
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = zext i32 %0 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %11, %6 ]
%8 = getelementptr inbounds i8*, i8** %1, i64 %7
%9 = load i8*, i8** %8
%10 = tail call i32 @AddParam(i8* %9)
%11 = add nuw nsw i64 %7, 1
%12 = icmp eq i64 %11, %5
br i1 %12, label %13, label %6
13: ; preds = %6, %2
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
char *malloc(size_t);
int /*<<< orphan*/ memcpy(char *, int /*<<< orphan*/ const *, size_t);
char *hpack_decode_str_raw(const uint8_t *data, size_t length) {
  char *s = malloc(length + 1);
  if (s != NULL) {
    memcpy(s, data, length);
    s[length] = '\0';
  }
  return s;
}


x86 assembly (clang, -O0):
<hpack_decode_str_raw>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
add    $0x1,%rdi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1169 <hpack_decode_str_raw+0x49>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
call   1030 <memcpy@plt>
mov    -0x18(%rbp),%rax
mov    -0x10(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hpack_decode_str_raw>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r15
lea    0x1(%rsi),%rdi
call   1040 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
je     114f <hpack_decode_str_raw+0x2f>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
call   1030 <memcpy@plt>
movb   $0x0,(%rbx,%r14,1)
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i8* @hpack_decode_str_raw(i32* %0, i64 %1) {
%3 = add i64 %1, 1
%4 = tail call i8* @malloc(i64 %3)
%5 = icmp eq i8* %4, null
br i1 %5, label %9, label %6
6: ; preds = %2
%7 = tail call i32 @memcpy(i8* %4, i32* %0, i64 %1)
%8 = getelementptr inbounds i8, i8* %4, i64 %1
store i8 0, i8* %8
br label %9
9: ; preds = %6, %2
ret i8* %4
}
char *hash_plugin_summary(void) { return ("nsldap \t\tLDAP SHA plugin"); }


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

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

LLVM IR (-O0):
@.str = [25 x i8] c"nsldap \09\09LDAP SHA plugin\00"
define i8* @hash_plugin_summary() {
ret i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [25 x i8] c"nsldap \09\09LDAP SHA plugin\00"
define i8* @hash_plugin_summary() {
ret i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0)
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *, char *);
int main(int argc, const char *argv[]) {
  printf("%s: %s\n", "partial string test", "string test");
  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    0xed3(%rip),%rdi
lea    0xed4(%rip),%rsi
lea    0xed5(%rip),%rdx
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
lea    0xee9(%rip),%rsi
lea    0xeea(%rip),%rdx
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [8 x i8] c"%s: %s\0A\00"
@.str.1 = [20 x i8] c"partial string test\00"
@.str.2 = [12 x i8] c"string test\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 ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"%s: %s\0A\00"
@.str.1 = [20 x i8] c"partial string test\00"
@.str.2 = [12 x i8] c"string test\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}
int checkValue(int data) {
  return (data + (data >> 8) + (data >> 16) + (data >> 24)) & 0xFF;
}


x86 assembly (clang, -O0):
<checkValue>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x4(%rbp),%ecx
sar    $0x8,%ecx
add    %ecx,%eax
mov    -0x4(%rbp),%ecx
sar    $0x10,%ecx
add    %ecx,%eax
mov    -0x4(%rbp),%ecx
sar    $0x18,%ecx
add    %ecx,%eax
and    $0xff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<checkValue>:
mov    %edi,%eax
shr    $0x8,%eax
add    %edi,%eax
mov    %edi,%ecx
shr    $0x10,%ecx
add    %eax,%ecx
shr    $0x18,%edi
add    %ecx,%edi
movzbl %dil,%eax
ret

LLVM IR (-O0):
define i32 @checkValue(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* %2
%5 = ashr i32 %4, 8
%6 = add nsw i32 %3, %5
%7 = load i32, i32* %2
%8 = ashr i32 %7, 16
%9 = add nsw i32 %6, %8
%10 = load i32, i32* %2
%11 = ashr i32 %10, 24
%12 = add nsw i32 %9, %11
%13 = and i32 %12, 255
ret i32 %13
}

LLVM IR (-O2):
define i32 @checkValue(i32 %0) {
%2 = lshr i32 %0, 8
%3 = add i32 %2, %0
%4 = lshr i32 %0, 16
%5 = add i32 %3, %4
%6 = lshr i32 %0, 24
%7 = add i32 %5, %6
%8 = and i32 %7, 255
ret i32 %8
}
/* Type definitions */
struct _Locale_name_hint {
  int dummy;
};

/* Variables and functions */
char const *_Locale_extract_name(char const *, int *);
char const *_Locale_extract_monetary_name(const char *name, char *buf,
                                          struct _Locale_name_hint *hint,
                                          int *__err_code) {
  return _Locale_extract_name(name, __err_code);
}


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

x86 assembly (clang, -O2):
<_Locale_extract_monetary_name>:
mov    %rcx,%rsi
jmp    1030 <_Locale_extract_name@plt>

LLVM IR (-O0):
%struct._Locale_name_hint = type { i32 }
define i8* @_Locale_extract_monetary_name(i8* %0, i8* %1, %struct._Locale_name_hint* %2, i32* %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca %struct._Locale_name_hint*
%8 = alloca i32*
store i8* %0, i8** %5
store i8* %1, i8** %6
store %struct._Locale_name_hint* %2, %struct._Locale_name_hint** %7
store i32* %3, i32** %8
%9 = load i8*, i8** %5
%10 = load i32*, i32** %8
%11 = call i8* @_Locale_extract_name(i8* %9, i32* %10)
ret i8* %11
}

LLVM IR (-O2):
%struct._Locale_name_hint = type { i32 }
define i8* @_Locale_extract_monetary_name(i8* %0, i8* nocapture readnone %1, %struct._Locale_name_hint* nocapture readnone %2, i32* %3) {
%5 = tail call i8* @_Locale_extract_name(i8* %0, i32* %3)
ret i8* %5
}
int test_imm_50uint64_midword_reg(unsigned long long val) {
  return ((val >> 16) & (0x50 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_50uint64_midword_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdx
shr    $0x10,%rdx
and    $0x50,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @test_imm_50uint64_midword_reg(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = lshr i64 %3, 16
%5 = and i64 %4, 80
%6 = icmp ne i64 %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_50uint64_midword_reg(i64 %0) {
%2 = and i64 %0, 5242880
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int /*<<< orphan*/ AuxAdiDdiSafeWrite(int, int, int);
void DDI32BitsSet(uint32_t ui32Base, uint32_t ui32Reg, uint32_t ui32Val) {
  uint32_t ui32RegOffset;
  ;
  ;
  ui32RegOffset = 0x00000040;
  AuxAdiDdiSafeWrite(ui32Base + ui32RegOffset + ui32Reg, ui32Val, 4);
}


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

x86 assembly (clang, -O2):
<DDI32BitsSet>:
add    %esi,%edi
add    $0x40,%edi
mov    %edx,%esi
mov    $0x4,%edx
jmp    1030 <AuxAdiDdiSafeWrite@plt>

LLVM IR (-O0):
define void @DDI32BitsSet(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
store i32 64, i32* %7
%8 = load i32, i32* %4
%9 = load i32, i32* %7
%10 = add nsw i32 %8, %9
%11 = load i32, i32* %5
%12 = add nsw i32 %10, %11
%13 = load i32, i32* %6
%14 = call i32 @AuxAdiDdiSafeWrite(i32 %12, i32 %13, i32 4)
ret void
}

LLVM IR (-O2):
define void @DDI32BitsSet(i32 %0, i32 %1, i32 %2) {
%4 = add nsw i32 %0, 64
%5 = add nsw i32 %4, %1
%6 = tail call i32 @AuxAdiDdiSafeWrite(i32 %5, i32 %2, i32 4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() {
  int val;
  printf("Hello World\n");
  for (int i = 0; i < 3; i++) {
    printf("AAAAAAAAAAAAA\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0x3,-0xc(%rbp)
jge    1156 <main+0x46>
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1132 <main+0x22>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
lea    0xee8(%rip),%rbx
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [13 x i8] c"Hello World\0A\00"
@.str.1 = [15 x i8] c"AAAAAAAAAAAAA\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
br label %5
5: ; preds = %10, %0
%6 = load i32, i32* %3
%7 = icmp slt i32 %6, 3
br i1 %7, label %8, label %13
8: ; preds = %5
%9 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
br label %10
10: ; preds = %8
%11 = load i32, i32* %3
%12 = add nsw i32 %11, 1
store i32 %12, i32* %3
br label %5
13: ; preds = %5
ret i32 0
}

LLVM IR (-O2):
@str = [12 x i8] c"Hello World\00"
@str.2 = [14 x i8] c"AAAAAAAAAAAAA\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.2, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.2, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.2, i64 0, i64 0))
ret i32 0
}
void write(const char *s) {
  volatile char *video = (volatile char *)0xb8000;
  while (*s) {
    *video++ = *s++;
    *video++ = 0x0f;
  }
}


x86 assembly (clang, -O0):
<write>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    $0xb8000,%eax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1157 <write+0x57>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
mov    (%rax),%cl
mov    -0x10(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x10(%rbp)
mov    %cl,(%rax)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0xf,(%rax)
jmp    1111 <write+0x11>
pop    %rbp
ret

x86 assembly (clang, -O2):
<write>:
mov    (%rdi),%al
test   %al,%al
je     112c <write+0x2c>
xor    %ecx,%ecx
nopl   0x0(%rax,%rax,1)
mov    %al,0xb8000(%rcx,%rcx,1)
movb   $0xf,0xb8001(%rcx,%rcx,1)
0f
movzbl 0x1(%rdi,%rcx,1),%eax
add    $0x1,%rcx
test   %al,%al
jne    1110 <write+0x10>
ret

LLVM IR (-O0):
define void @write(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
store i8* inttoptr (i64 753664 to i8*), i8** %3
br label %4
4: ; preds = %8, %1
%5 = load i8*, i8** %2
%6 = load i8, i8* %5
%7 = icmp ne i8 %6, 0
br i1 %7, label %8, label %16
8: ; preds = %4
%9 = load i8*, i8** %2
%10 = getelementptr inbounds i8, i8* %9, i32 1
store i8* %10, i8** %2
%11 = load i8, i8* %9
%12 = load i8*, i8** %3
%13 = getelementptr inbounds i8, i8* %12, i32 1
store i8* %13, i8** %3
store volatile i8 %11, i8* %12
%14 = load i8*, i8** %3
%15 = getelementptr inbounds i8, i8* %14, i32 1
store i8* %15, i8** %3
store volatile i8 15, i8* %14
br label %4
16: ; preds = %4
ret void
}

LLVM IR (-O2):
define void @write(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %13, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %11, %4 ], [ %2, %1 ]
%6 = phi i8* [ %10, %4 ], [ inttoptr (i64 753664 to i8*), %1 ]
%7 = phi i8* [ %8, %4 ], [ %0, %1 ]
%8 = getelementptr inbounds i8, i8* %7, i64 1
%9 = getelementptr inbounds i8, i8* %6, i64 1
store volatile i8 %5, i8* %6
%10 = getelementptr inbounds i8, i8* %6, i64 2
store volatile i8 15, i8* %9
%11 = load i8, i8* %8
%12 = icmp eq i8 %11, 0
br i1 %12, label %13, label %4
13: ; preds = %4, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ot(char *);
int /*<<< orphan*/ outdec(int);
int /*<<< orphan*/ outstr(char *);
void CpCharVal(int val) {
  ot("cp\t#(");
  outdec(val);
  outstr("% 256)\n");
}


x86 assembly (clang, -O0):
<CpCharVal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xebe(%rip),%rdi
call   1050 <ot@plt>
mov    -0x4(%rbp),%edi
call   1040 <outdec@plt>
lea    0xeb0(%rip),%rdi
call   1030 <outstr@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CpCharVal>:
push   %rbx
mov    %edi,%ebx
lea    0xec6(%rip),%rdi
call   1050 <ot@plt>
mov    %ebx,%edi
call   1040 <outdec@plt>
lea    0xeb9(%rip),%rdi
pop    %rbx
jmp    1030 <outstr@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"cp\09#(\00"
@.str.1 = [8 x i8] c"% 256)\0A\00"
define void @CpCharVal(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @ot(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%4 = load i32, i32* %2
%5 = call i32 @outdec(i32 %4)
%6 = call i32 @outstr(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"cp\09#(\00"
@.str.1 = [8 x i8] c"% 256)\0A\00"
define void @CpCharVal(i32 %0) {
%2 = tail call i32 @ot(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @outdec(i32 %0)
%4 = tail call i32 @outstr(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ suggest();
int main() {
  suggest();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @suggest()
ret i32 0
}
/* Variables and functions */
int g(double);
int f(double x) { return g(x); }


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

x86 assembly (clang, -O2):
<f>:
jmp    1030 <g@plt>

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

LLVM IR (-O2):
define i32 @f(double %0) {
%2 = tail call i32 @g(double %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ cc(int);
__attribute__((no)) void bb(int x) { cc(x); }


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

x86 assembly (clang, -O2):
<bb>:
jmp    1030 <cc@plt>

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

LLVM IR (-O2):
define void @bb(i32 %0) {
%2 = tail call i32 @cc(i32 %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ F_GETFL;
int /*<<< orphan*/ F_SETFL;
int O_NONBLOCK;
int fcntl(int, int /*<<< orphan*/, ...);
void setnonblock(int fd) {
  int flags;
  flags = fcntl(fd, F_GETFL);
  flags |= O_NONBLOCK;
  fcntl(fd, F_SETFL, flags);
}


x86 assembly (clang, -O0):
<setnonblock>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2eab(%rip),%rax
mov    (%rax),%esi
mov    $0x0,%al
call   1030 <fcntl@plt>
mov    %eax,-0x8(%rbp)
mov    0x2eb0(%rip),%rax
mov    (%rax),%eax
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2e8e(%rip),%rax
mov    (%rax),%esi
mov    -0x8(%rbp),%edx
mov    $0x0,%al
call   1030 <fcntl@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setnonblock>:
push   %rbx
mov    %edi,%ebx
mov    0x2eb6(%rip),%rax
mov    (%rax),%esi
xor    %eax,%eax
call   1030 <fcntl@plt>
mov    0x2ebe(%rip),%rcx
or     (%rcx),%eax
mov    0x2ea5(%rip),%rcx
mov    (%rcx),%esi
mov    %ebx,%edi
mov    %eax,%edx
xor    %eax,%eax
pop    %rbx
jmp    1030 <fcntl@plt>

LLVM IR (-O0):
@F_GETFL = global i32 0
@O_NONBLOCK = global i32 0
@F_SETFL = global i32 0
define void @setnonblock(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = load i32, i32* @F_GETFL
%6 = call i32 (i32, i32, ...) @fcntl(i32 %4, i32 %5)
store i32 %6, i32* %3
%7 = load i32, i32* @O_NONBLOCK
%8 = load i32, i32* %3
%9 = or i32 %8, %7
store i32 %9, i32* %3
%10 = load i32, i32* %2
%11 = load i32, i32* @F_SETFL
%12 = load i32, i32* %3
%13 = call i32 (i32, i32, ...) @fcntl(i32 %10, i32 %11, i32 %12)
ret void
}

LLVM IR (-O2):
@F_GETFL = global i32 0
@O_NONBLOCK = global i32 0
@F_SETFL = global i32 0
define void @setnonblock(i32 %0) {
%2 = load i32, i32* @F_GETFL
%3 = tail call i32 (i32, i32, ...) @fcntl(i32 %0, i32 %2)
%4 = load i32, i32* @O_NONBLOCK
%5 = or i32 %4, %3
%6 = load i32, i32* @F_SETFL
%7 = tail call i32 (i32, i32, ...) @fcntl(i32 %0, i32 %6, i32 %5)
ret void
}
void limit2_u8(unsigned char *x, unsigned char lower, unsigned char upper) {
  if (*x >= upper)
    *x = upper;
  else if (*x <= lower)
    *x = lower;
}


x86 assembly (clang, -O0):
<limit2_u8>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %sil,%cl
mov    %rdi,-0x8(%rbp)
mov    %cl,-0x9(%rbp)
mov    %al,-0xa(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
movzbl -0xa(%rbp),%ecx
cmp    %ecx,%eax
jl     1134 <limit2_u8+0x34>
mov    -0xa(%rbp),%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
jmp    1155 <limit2_u8+0x55>
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
movzbl -0x9(%rbp),%ecx
cmp    %ecx,%eax
jg     1150 <limit2_u8+0x50>
mov    -0x9(%rbp),%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
jmp    1155 <limit2_u8+0x55>
pop    %rbp
ret

x86 assembly (clang, -O2):
<limit2_u8>:
mov    (%rdi),%al
cmp    %dl,%al
jae    110d <limit2_u8+0xd>
mov    %esi,%edx
cmp    %sil,%al
ja     110f <limit2_u8+0xf>
mov    %dl,(%rdi)
ret

LLVM IR (-O0):
define void @limit2_u8(i8* %0, i8 zeroext %1, i8 zeroext %2) {
%4 = alloca i8*
%5 = alloca i8
%6 = alloca i8
store i8* %0, i8** %4
store i8 %1, i8* %5
store i8 %2, i8* %6
%7 = load i8*, i8** %4
%8 = load i8, i8* %7
%9 = zext i8 %8 to i32
%10 = load i8, i8* %6
%11 = zext i8 %10 to i32
%12 = icmp sge i32 %9, %11
br i1 %12, label %13, label %16
13: ; preds = %3
%14 = load i8, i8* %6
%15 = load i8*, i8** %4
store i8 %14, i8* %15
br label %27
16: ; preds = %3
%17 = load i8*, i8** %4
%18 = load i8, i8* %17
%19 = zext i8 %18 to i32
%20 = load i8, i8* %5
%21 = zext i8 %20 to i32
%22 = icmp sle i32 %19, %21
br i1 %22, label %23, label %26
23: ; preds = %16
%24 = load i8, i8* %5
%25 = load i8*, i8** %4
store i8 %24, i8* %25
br label %26
26: ; preds = %23, %16
br label %27
27: ; preds = %26, %13
ret void
}

LLVM IR (-O2):
define void @limit2_u8(i8* nocapture %0, i8 zeroext %1, i8 zeroext %2) {
%4 = load i8, i8* %0
%5 = icmp ult i8 %4, %2
br i1 %5, label %6, label %8
6: ; preds = %3
%7 = icmp ugt i8 %4, %1
br i1 %7, label %10, label %8
8: ; preds = %6, %3
%9 = phi i8 [ %2, %3 ], [ %1, %6 ]
store i8 %9, i8* %0
br label %10
10: ; preds = %8, %6
ret void
}
/* Variables and functions */
void *dlsym(void *, char const *);
void *iposix_shared_get(void *shared, const char *name) {
  return dlsym(shared, name);
}


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

x86 assembly (clang, -O2):
<iposix_shared_get>:
jmp    1030 <dlsym@plt>

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

LLVM IR (-O2):
define i8* @iposix_shared_get(i8* %0, i8* %1) {
%3 = tail call i8* @dlsym(i8* %0, i8* %1)
ret i8* %3
}
/* Variables and functions */
scalar_t__ isdigit(int);
int isxdigit(int c) {
  if (isdigit(c) || ('a' <= c && c <= 'f') || ('A' <= c && c <= 'F')) {
    return 1;
  } else {
    return 0;
  }
}


x86 assembly (clang, -O0):
<isxdigit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
jne    115d <isxdigit+0x4d>
mov    $0x61,%eax
cmp    -0x8(%rbp),%eax
jg     1145 <isxdigit+0x35>
cmpl   $0x66,-0x8(%rbp)
jle    115d <isxdigit+0x4d>
mov    $0x41,%eax
cmp    -0x8(%rbp),%eax
jg     1169 <isxdigit+0x59>
cmpl   $0x46,-0x8(%rbp)
jg     1169 <isxdigit+0x59>
movl   $0x1,-0x4(%rbp)
jmp    1170 <isxdigit+0x60>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isxdigit>:
push   %rbx
mov    %edi,%ebx
call   1030 <isdigit@plt>
test   %rax,%rax
setne  %al
and    $0xffffffdf,%ebx
add    $0xffffffbf,%ebx
cmp    $0x6,%ebx
setb   %cl
or     %al,%cl
movzbl %cl,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @isxdigit(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = call i64 @isdigit(i32 %4)
%6 = icmp ne i64 %5, 0
br i1 %6, label %19, label %7
7: ; preds = %1
%8 = load i32, i32* %3
%9 = icmp sle i32 97, %8
br i1 %9, label %10, label %13
10: ; preds = %7
%11 = load i32, i32* %3
%12 = icmp sle i32 %11, 102
br i1 %12, label %19, label %13
13: ; preds = %10, %7
%14 = load i32, i32* %3
%15 = icmp sle i32 65, %14
br i1 %15, label %16, label %20
16: ; preds = %13
%17 = load i32, i32* %3
%18 = icmp sle i32 %17, 70
br i1 %18, label %19, label %20
19: ; preds = %16, %10, %1
store i32 1, i32* %2
br label %21
20: ; preds = %16, %13
store i32 0, i32* %2
br label %21
21: ; preds = %20, %19
%22 = load i32, i32* %2
ret i32 %22
}

LLVM IR (-O2):
define i32 @isxdigit(i32 %0) {
%2 = tail call i64 @isdigit(i32 %0)
%3 = icmp ne i64 %2, 0
%4 = and i32 %0, -33
%5 = add i32 %4, -65
%6 = icmp ult i32 %5, 6
%7 = or i1 %6, %3
%8 = zext i1 %7 to i32
ret i32 %8
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;
struct bladerf {
  int dummy;
};

/* Variables and functions */
int nios_legacy_pio_write(struct bladerf *, int /*<<< orphan*/,
                          int /*<<< orphan*/);
int nios_legacy_config_write(struct bladerf *dev, uint32_t val) {
  do {
    do {
    } while (0);
  } while (0);
  return nios_legacy_pio_write(dev, 0, val);
}


x86 assembly (clang, -O0):
<nios_legacy_config_write>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
jmp    1124 <nios_legacy_config_write+0x14>
jmp    1129 <nios_legacy_config_write+0x19>
jmp    112e <nios_legacy_config_write+0x1e>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
xor    %esi,%esi
call   1030 <nios_legacy_pio_write@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nios_legacy_config_write>:
mov    %esi,%edx
xor    %esi,%esi
jmp    1030 <nios_legacy_pio_write@plt>

LLVM IR (-O0):
%struct.bladerf = type { i32 }
define i32 @nios_legacy_config_write(%struct.bladerf* %0, i32 %1) {
%3 = alloca %struct.bladerf*
%4 = alloca i32
store %struct.bladerf* %0, %struct.bladerf** %3
store i32 %1, i32* %4
br label %5
5: ; preds = %2
br label %6
6: ; preds = %5
br label %7
7: ; preds = %6
br label %8
8: ; preds = %7
%9 = load %struct.bladerf*, %struct.bladerf** %3
%10 = load i32, i32* %4
%11 = call i32 @nios_legacy_pio_write(%struct.bladerf* %9, i32 0, i32 %10)
ret i32 %11
}

LLVM IR (-O2):
%struct.bladerf = type { i32 }
define i32 @nios_legacy_config_write(%struct.bladerf* %0, i32 %1) {
%3 = tail call i32 @nios_legacy_pio_write(%struct.bladerf* %0, i32 0, i32 %1)
ret i32 %3
}
/* Variables and functions */
int PM_inpb(int);
int kbWaitForWriteReady(void) {
  int timeout = 8192;
  while ((timeout > 0) && (PM_inpb(0x64) & 0x02))
    timeout--;
  return (timeout > 0);
}


x86 assembly (clang, -O0):
<kbWaitForWriteReady>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x2000,-0x4(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jle    1144 <kbWaitForWriteReady+0x34>
mov    $0x64,%edi
call   1030 <PM_inpb@plt>
and    $0x2,%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
test   $0x1,%al
jne    1154 <kbWaitForWriteReady+0x44>
jmp    1162 <kbWaitForWriteReady+0x52>
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x4(%rbp)
jmp    111f <kbWaitForWriteReady+0xf>
cmpl   $0x0,-0x4(%rbp)
setg   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<kbWaitForWriteReady>:
push   %rbx
mov    $0x2000,%ebx
cs nopw 0x0(%rax,%rax,1)
mov    $0x64,%edi
call   1030 <PM_inpb@plt>
and    $0x2,%eax
je     1139 <kbWaitForWriteReady+0x29>
lea    -0x1(%rbx),%ecx
cmp    $0x1,%ebx
mov    %ecx,%ebx
ja     1120 <kbWaitForWriteReady+0x10>
shr    %eax
xor    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @kbWaitForWriteReady() {
%1 = alloca i32
store i32 8192, i32* %1
br label %2
2: ; preds = %11, %0
%3 = load i32, i32* %1
%4 = icmp sgt i32 %3, 0
br i1 %4, label %5, label %9
5: ; preds = %2
%6 = call i32 @PM_inpb(i32 100)
%7 = and i32 %6, 2
%8 = icmp ne i32 %7, 0
br label %9
9: ; preds = %5, %2
%10 = phi i1 [ false, %2 ], [ %8, %5 ]
br i1 %10, label %11, label %14
11: ; preds = %9
%12 = load i32, i32* %1
%13 = add nsw i32 %12, -1
store i32 %13, i32* %1
br label %2
14: ; preds = %9
%15 = load i32, i32* %1
%16 = icmp sgt i32 %15, 0
%17 = zext i1 %16 to i32
ret i32 %17
}

LLVM IR (-O2):
define i32 @kbWaitForWriteReady() {
br label %1
1: ; preds = %1, %0
%2 = phi i32 [ 8192, %0 ], [ %6, %1 ]
%3 = tail call i32 @PM_inpb(i32 100)
%4 = and i32 %3, 2
%5 = icmp ne i32 %4, 0
%6 = add nsw i32 %2, -1
%7 = icmp ugt i32 %2, 1
%8 = select i1 %5, i1 %7, i1 false
br i1 %8, label %1, label %9
9: ; preds = %1
%10 = lshr exact i32 %4, 1
%11 = xor i32 %10, 1
ret i32 %11
}
double F_v_u_d(double f_t_k_d, double A_k, double gamma_M) {
  return ((0.6 * f_t_k_d * A_k) / gamma_M);
}


x86 assembly (clang, -O0):
<F_v_u_d>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  0xee5(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
divsd  -0x18(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<F_v_u_d>:
mulsd  0xef8(%rip),%xmm0
mulsd  %xmm1,%xmm0
divsd  %xmm2,%xmm0
ret

LLVM IR (-O0):
define double @F_v_u_d(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
%7 = load double, double* %4
%8 = fmul double 6.000000e-01, %7
%9 = load double, double* %5
%10 = fmul double %8, %9
%11 = load double, double* %6
%12 = fdiv double %10, %11
ret double %12
}

LLVM IR (-O2):
define double @F_v_u_d(double %0, double %1, double %2) {
%4 = fmul double %0, 6.000000e-01
%5 = fmul double %4, %1
%6 = fdiv double %5, %2
ret double %6
}
int main(void) {
  for (;;) {
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
jmp    110b <main+0xb>

x86 assembly (clang, -O2):
<main>:
jmp    1100 <main>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
br label %2
2: ; preds = %2, %0
br label %2
}

LLVM IR (-O2):
define i32 @main() {
br label %1
1: ; preds = %1, %0
br label %1
}
/* Variables and functions */
int /*<<< orphan*/ my_putchar(char);
void my_putstr(char *str) {
  int count;
  count = 0;
  while (*(str + count)) {
    my_putchar(*(str + count));
    count++;
  }
}


x86 assembly (clang, -O0):
<my_putstr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
cmpb   $0x0,(%rax,%rcx,1)
je     1154 <my_putstr+0x44>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <my_putchar@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <my_putstr+0x13>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_putstr>:
push   %rbx
mov    (%rdi),%al
test   %al,%al
je     1133 <my_putstr+0x23>
mov    %rdi,%rbx
add    $0x1,%rbx
xchg   %ax,%ax
movsbl %al,%edi
call   1030 <my_putchar@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1120 <my_putstr+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @my_putstr(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %12, label %4
4: ; preds = %1, %4
%5 = phi i64 [ %8, %4 ], [ 0, %1 ]
%6 = phi i8 [ %10, %4 ], [ %2, %1 ]
%7 = tail call i32 @my_putchar(i8 signext %6)
%8 = add nuw i64 %5, 1
%9 = getelementptr inbounds i8, i8* %0, i64 %8
%10 = load i8, i8* %9
%11 = icmp eq i8 %10, 0
br i1 %11, label %12, label %4
12: ; preds = %4, %1
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ stdout;
void IOErrorHdrHook(FILE *where) { fflush(stdout); }


x86 assembly (clang, -O0):
<IOErrorHdrHook>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
call   1030 <fflush@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@stdout = global i32 0
define void @IOErrorHdrHook(i32* nocapture readnone %0) {
%2 = load i32, i32* @stdout
%3 = tail call i32 @fflush(i32 %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ wakeUp();
void handleChld() { wakeUp(); }


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

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

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

LLVM IR (-O2):
define void @handleChld() {
%1 = tail call i32 (...) @wakeUp()
ret void
}
/* Type definitions */
struct mem_block {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ mem_block_footer_btag(struct mem_block *);
int /*<<< orphan*/ mem_block_header_btag(struct mem_block *);
int /*<<< orphan*/ mem_btag_set_allocated(int /*<<< orphan*/);
void mem_block_set_allocated(struct mem_block *block) {
  mem_btag_set_allocated(mem_block_header_btag(block));
  mem_btag_set_allocated(mem_block_footer_btag(block));
}


x86 assembly (clang, -O0):
<mem_block_set_allocated>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <mem_block_header_btag@plt>
mov    %eax,%edi
call   1040 <mem_btag_set_allocated@plt>
mov    -0x8(%rbp),%rdi
call   1030 <mem_block_footer_btag@plt>
mov    %eax,%edi
call   1040 <mem_btag_set_allocated@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mem_block_set_allocated>:
push   %rbx
mov    %rdi,%rbx
call   1050 <mem_block_header_btag@plt>
mov    %eax,%edi
call   1040 <mem_btag_set_allocated@plt>
mov    %rbx,%rdi
call   1030 <mem_block_footer_btag@plt>
mov    %eax,%edi
pop    %rbx
jmp    1040 <mem_btag_set_allocated@plt>

LLVM IR (-O0):
%struct.mem_block = type { i32 }
define void @mem_block_set_allocated(%struct.mem_block* %0) {
%2 = alloca %struct.mem_block*
store %struct.mem_block* %0, %struct.mem_block** %2
%3 = load %struct.mem_block*, %struct.mem_block** %2
%4 = call i32 @mem_block_header_btag(%struct.mem_block* %3)
%5 = call i32 @mem_btag_set_allocated(i32 %4)
%6 = load %struct.mem_block*, %struct.mem_block** %2
%7 = call i32 @mem_block_footer_btag(%struct.mem_block* %6)
%8 = call i32 @mem_btag_set_allocated(i32 %7)
ret void
}

LLVM IR (-O2):
%struct.mem_block = type { i32 }
define void @mem_block_set_allocated(%struct.mem_block* %0) {
%2 = tail call i32 @mem_block_header_btag(%struct.mem_block* %0)
%3 = tail call i32 @mem_btag_set_allocated(i32 %2)
%4 = tail call i32 @mem_block_footer_btag(%struct.mem_block* %0)
%5 = tail call i32 @mem_btag_set_allocated(i32 %4)
ret void
}
char *strfind(const char *s, char c) {
  while (*s != '\0') {
    if (*s == c) {
      break;
    }
    s++;
  }
  return (char *)s;
}


x86 assembly (clang, -O0):
<strfind>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1147 <strfind+0x47>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
movsbl -0x9(%rbp),%ecx
cmp    %ecx,%eax
jne    1136 <strfind+0x36>
jmp    1147 <strfind+0x47>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    110e <strfind+0xe>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strfind>:
mov    %rdi,%rax
add    $0xffffffffffffffff,%rax
nopw   0x0(%rax,%rax,1)
movzbl 0x1(%rax),%ecx
add    $0x1,%rax
test   %cl,%cl
je     1121 <strfind+0x21>
cmp    %sil,%cl
jne    1110 <strfind+0x10>
ret

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

LLVM IR (-O2):
define i8* @strfind(i8* %0, i8 signext %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i8* [ %0, %2 ], [ %9, %3 ]
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 0
%7 = icmp eq i8 %5, %1
%8 = or i1 %6, %7
%9 = getelementptr inbounds i8, i8* %4, i64 1
br i1 %8, label %10, label %3
10: ; preds = %3
ret i8* %4
}