xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ putchar(int /*<<< orphan*/);
void prints(char *s) {
  while (*s)
    putchar(*s++);
}


x86 assembly (clang, -O0):
<prints>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1145 <prints+0x35>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%edi
call   1030 <putchar@plt>
jmp    111c <prints+0xc>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @prints(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
br label %3
3: ; preds = %7, %1
%4 = load i8*, i8** %2
%5 = load i8, i8* %4
%6 = icmp ne i8 %5, 0
br i1 %6, label %7, label %13
7: ; preds = %3
%8 = load i8*, i8** %2
%9 = getelementptr inbounds i8, i8* %8, i32 1
store i8* %9, i8** %2
%10 = load i8, i8* %8
%11 = sext i8 %10 to i32
%12 = call i32 @putchar(i32 %11)
br label %3
13: ; preds = %3
ret void
}

LLVM IR (-O2):
define void @prints(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 i8 [ %10, %4 ], [ %2, %1 ]
%6 = phi i8* [ %7, %4 ], [ %0, %1 ]
%7 = getelementptr inbounds i8, i8* %6, i64 1
%8 = sext i8 %5 to i32
%9 = tail call i32 @putchar(i32 %8)
%10 = load i8, i8* %7
%11 = icmp eq i8 %10, 0
br i1 %11, label %12, label %4
12: ; preds = %4, %1
ret void
}
/* Type definitions */
struct stack_t {
  int dummy;
};

/* Variables and functions */
int stack_resize(struct stack_t *, size_t);
int fstack_resize(struct stack_t *stack, size_t size) {
  return stack_resize(stack, size);
}


x86 assembly (clang, -O0):
<fstack_resize>:
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 <stack_resize@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fstack_resize>:
jmp    1030 <stack_resize@plt>

LLVM IR (-O0):
%struct.stack_t = type { i32 }
define i32 @fstack_resize(%struct.stack_t* %0, i64 %1) {
%3 = alloca %struct.stack_t*
%4 = alloca i64
store %struct.stack_t* %0, %struct.stack_t** %3
store i64 %1, i64* %4
%5 = load %struct.stack_t*, %struct.stack_t** %3
%6 = load i64, i64* %4
%7 = call i32 @stack_resize(%struct.stack_t* %5, i64 %6)
ret i32 %7
}

LLVM IR (-O2):
%struct.stack_t = type { i32 }
define i32 @fstack_resize(%struct.stack_t* %0, i64 %1) {
%3 = tail call i32 @stack_resize(%struct.stack_t* %0, i64 %1)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ error(char *, int);
void mem_error(int src) {
  if (src == 1)
    error("hit node limit", (-7));
  else
    error("hit vector limit", (-7));
}


x86 assembly (clang, -O0):
<mem_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x1,-0x4(%rbp)
jne    113b <mem_error+0x2b>
lea    0xed4(%rip),%rdi
mov    $0xfffffff9,%esi
call   1030 <error@plt>
jmp    114c <mem_error+0x3c>
lea    0xecd(%rip),%rdi
mov    $0xfffffff9,%esi
call   1030 <error@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mem_error>:
cmp    $0x1,%edi
lea    0xee6(%rip),%rax
lea    0xeee(%rip),%rdi
cmove  %rax,%rdi
mov    $0xfffffff9,%esi
jmp    1030 <error@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"hit node limit\00"
@.str.1 = [17 x i8] c"hit vector limit\00"
define void @mem_error(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp eq i32 %3, 1
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = call i32 @error(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 -7)
br label %9
7: ; preds = %1
%8 = call i32 @error(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 -7)
br label %9
9: ; preds = %7, %5
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"hit node limit\00"
@.str.1 = [17 x i8] c"hit vector limit\00"
define void @mem_error(i32 %0) {
%2 = icmp eq i32 %0, 1
%3 = select i1 %2, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0)
%4 = tail call i32 @error(i8* %3, i32 -7)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
void thread_request_reschedule() { exit(1); }


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

x86 assembly (clang, -O2):
<thread_request_reschedule>:
push   %rax
mov    $0x1,%edi
call   1030 <exit@plt>

LLVM IR (-O0):
define void @thread_request_reschedule() {
%1 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
define void @thread_request_reschedule() {
%1 = tail call i32 @exit(i32 1)
unreachable
}
int ft_islower(int c) { return (c > 96 && c < 123); }


x86 assembly (clang, -O0):
<ft_islower>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
cmpl   $0x60,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jle    1120 <ft_islower+0x20>
cmpl   $0x7b,-0x4(%rbp)
setl   %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_islower>:
add    $0xffffff9f,%edi
xor    %eax,%eax
cmp    $0x1a,%edi
setb   %al
ret

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

LLVM IR (-O2):
define i32 @ft_islower(i32 %0) {
%2 = add i32 %0, -97
%3 = icmp ult i32 %2, 26
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
unsigned char decode_e(unsigned int, unsigned int, int);
unsigned char i25_decode1(unsigned char enc, unsigned e, unsigned s) {
  unsigned char E = decode_e(e, s, 45);
  if (E > 7)
    return (0xff);
  enc <<= 1;
  if (E > 2)
    enc |= 1;
  return (enc);
}


x86 assembly (clang, -O0):
<i25_decode1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x2(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    $0x2d,%edx
call   1030 <decode_e@plt>
mov    %al,-0xd(%rbp)
movzbl -0xd(%rbp),%eax
cmp    $0x7,%eax
jle    114d <i25_decode1+0x3d>
movb   $0xff,-0x1(%rbp)
jmp    1174 <i25_decode1+0x64>
movzbl -0x2(%rbp),%eax
shl    $0x1,%eax
mov    %al,-0x2(%rbp)
movzbl -0xd(%rbp),%eax
cmp    $0x2,%eax
jle    116e <i25_decode1+0x5e>
movzbl -0x2(%rbp),%eax
or     $0x1,%eax
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<i25_decode1>:
push   %rbx
mov    %edi,%ebx
mov    %esi,%edi
mov    %edx,%esi
mov    $0x2d,%edx
call   1030 <decode_e@plt>
add    %bl,%bl
cmp    $0x3,%al
setae  %cl
or     %bl,%cl
cmp    $0x8,%al
movzbl %cl,%ecx
mov    $0xff,%eax
cmovb  %ecx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define zeroext i8 @i25_decode1(i8 zeroext %0, i32 %1, i32 %2) {
%4 = alloca i8
%5 = alloca i8
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8
store i8 %0, i8* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
%9 = load i32, i32* %6
%10 = load i32, i32* %7
%11 = call zeroext i8 @decode_e(i32 %9, i32 %10, i32 45)
store i8 %11, i8* %8
%12 = load i8, i8* %8
%13 = zext i8 %12 to i32
%14 = icmp sgt i32 %13, 7
br i1 %14, label %15, label %16
15: ; preds = %3
store i8 -1, i8* %4
br label %31
16: ; preds = %3
%17 = load i8, i8* %5
%18 = zext i8 %17 to i32
%19 = shl i32 %18, 1
%20 = trunc i32 %19 to i8
store i8 %20, i8* %5
%21 = load i8, i8* %8
%22 = zext i8 %21 to i32
%23 = icmp sgt i32 %22, 2
br i1 %23, label %24, label %29
24: ; preds = %16
%25 = load i8, i8* %5
%26 = zext i8 %25 to i32
%27 = or i32 %26, 1
%28 = trunc i32 %27 to i8
store i8 %28, i8* %5
br label %29
29: ; preds = %24, %16
%30 = load i8, i8* %5
store i8 %30, i8* %4
br label %31
31: ; preds = %29, %15
%32 = load i8, i8* %4
ret i8 %32
}

LLVM IR (-O2):
define zeroext i8 @i25_decode1(i8 zeroext %0, i32 %1, i32 %2) {
%4 = tail call zeroext i8 @decode_e(i32 %1, i32 %2, i32 45)
%5 = icmp ugt i8 %4, 7
%6 = shl i8 %0, 1
%7 = icmp ugt i8 %4, 2
%8 = zext i1 %7 to i8
%9 = or i8 %6, %8
%10 = select i1 %5, i8 -1, i8 %9
ret i8 %10
}
int isSectionImage(unsigned long type) {
  if (type == 0x600)
    return 1;
  if (type == 0x601)
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<isSectionImage>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
cmpq   $0x600,-0x10(%rbp)
jne    1122 <isSectionImage+0x22>
movl   $0x1,-0x4(%rbp)
jmp    1143 <isSectionImage+0x43>
cmpq   $0x601,-0x10(%rbp)
jne    113c <isSectionImage+0x3c>
movl   $0x1,-0x4(%rbp)
jmp    1143 <isSectionImage+0x43>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isSectionImage>:
and    $0xfffffffffffffffe,%rdi
xor    %eax,%eax
cmp    $0x600,%rdi
sete   %al
ret

LLVM IR (-O0):
define i32 @isSectionImage(i64 %0) {
%2 = alloca i32
%3 = alloca i64
store i64 %0, i64* %3
%4 = load i64, i64* %3
%5 = icmp eq i64 %4, 1536
br i1 %5, label %6, label %7
6: ; preds = %1
store i32 1, i32* %2
br label %12
7: ; preds = %1
%8 = load i64, i64* %3
%9 = icmp eq i64 %8, 1537
br i1 %9, label %10, label %11
10: ; preds = %7
store i32 1, i32* %2
br label %12
11: ; preds = %7
store i32 0, i32* %2
br label %12
12: ; preds = %11, %10, %6
%13 = load i32, i32* %2
ret i32 %13
}

LLVM IR (-O2):
define i32 @isSectionImage(i64 %0) {
%2 = and i64 %0, -2
%3 = icmp eq i64 %2, 1536
%4 = zext i1 %3 to i32
ret i32 %4
}
int emac2_amacid_set(unsigned int dev_id, union emac2_amacid_u *value) {
  return 1;
}


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

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

LLVM IR (-O0):
%union.emac2_amacid_u = type opaque
define i32 @emac2_amacid_set(i32 %0, %union.emac2_amacid_u* %1) {
%3 = alloca i32
%4 = alloca %union.emac2_amacid_u*
store i32 %0, i32* %3
store %union.emac2_amacid_u* %1, %union.emac2_amacid_u** %4
ret i32 1
}

LLVM IR (-O2):
%union.emac2_amacid_u = type opaque
define i32 @emac2_amacid_set(i32 %0, %union.emac2_amacid_u* nocapture readnone %1) {
ret i32 1
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ ntohl(int /*<<< orphan*/);
void ntohd(double *x) {
  uint32_t *ovl = (uint32_t *)x;
  uint32_t tmp;
  tmp = ovl[0];
  ovl[0] = ntohl(ovl[1]);
  ovl[1] = ntohl(tmp);
}


x86 assembly (clang, -O0):
<ntohd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%edi
call   1030 <ntohl@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x14(%rbp),%edi
call   1030 <ntohl@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x4(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ntohd>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    (%rdi),%ebp
mov    0x4(%rdi),%edi
call   1030 <ntohl@plt>
mov    %eax,(%rbx)
mov    %ebp,%edi
call   1030 <ntohl@plt>
mov    %eax,0x4(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define void @ntohd(double* %0) {
%2 = alloca double*
%3 = alloca i32*
%4 = alloca i32
store double* %0, double** %2
%5 = load double*, double** %2
%6 = bitcast double* %5 to i32*
store i32* %6, i32** %3
%7 = load i32*, i32** %3
%8 = getelementptr inbounds i32, i32* %7, i64 0
%9 = load i32, i32* %8
store i32 %9, i32* %4
%10 = load i32*, i32** %3
%11 = getelementptr inbounds i32, i32* %10, i64 1
%12 = load i32, i32* %11
%13 = call i32 @ntohl(i32 %12)
%14 = load i32*, i32** %3
%15 = getelementptr inbounds i32, i32* %14, i64 0
store i32 %13, i32* %15
%16 = load i32, i32* %4
%17 = call i32 @ntohl(i32 %16)
%18 = load i32*, i32** %3
%19 = getelementptr inbounds i32, i32* %18, i64 1
store i32 %17, i32* %19
ret void
}

LLVM IR (-O2):
define void @ntohd(double* nocapture %0) {
%2 = bitcast double* %0 to i32*
%3 = load i32, i32* %2
%4 = getelementptr inbounds i32, i32* %2, i64 1
%5 = load i32, i32* %4
%6 = tail call i32 @ntohl(i32 %5)
store i32 %6, i32* %2
%7 = tail call i32 @ntohl(i32 %3)
store i32 %7, i32* %4
ret void
}
/* Type definitions */
struct winsize {
  int ws_col;
};

/* Variables and functions */
int /*<<< orphan*/ TIOCGWINSZ;
scalar_t__ ioctl(int /*<<< orphan*/, int /*<<< orphan*/, struct winsize *);
int t_getwidth() {
  struct winsize ts;
  if (ioctl(0, TIOCGWINSZ, &ts))
    return -1;
  return ts.ws_col;
}


x86 assembly (clang, -O0):
<t_getwidth>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2eb9(%rip),%rax
mov    (%rax),%esi
xor    %edi,%edi
lea    -0x8(%rbp),%rdx
call   1030 <ioctl@plt>
cmp    $0x0,%rax
je     1142 <t_getwidth+0x32>
movl   $0xffffffff,-0x4(%rbp)
jmp    1148 <t_getwidth+0x38>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_getwidth>:
push   %rax
mov    0x2ec0(%rip),%rax
mov    (%rax),%esi
mov    %rsp,%rdx
xor    %edi,%edi
call   1030 <ioctl@plt>
neg    %rax
sbb    %eax,%eax
or     (%rsp),%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.winsize = type { i32 }
@TIOCGWINSZ = global i32 0
define i32 @t_getwidth() {
%1 = alloca i32
%2 = alloca %struct.winsize
%3 = load i32, i32* @TIOCGWINSZ
%4 = call i64 @ioctl(i32 0, i32 %3, %struct.winsize* %2)
%5 = icmp ne i64 %4, 0
br i1 %5, label %6, label %7
6: ; preds = %0
store i32 -1, i32* %1
br label %10
7: ; preds = %0
%8 = getelementptr inbounds %struct.winsize, %struct.winsize* %2, i32 0, i32 0
%9 = load i32, i32* %8
store i32 %9, i32* %1
br label %10
10: ; preds = %7, %6
%11 = load i32, i32* %1
ret i32 %11
}

LLVM IR (-O2):
%struct.winsize = type { i32 }
@TIOCGWINSZ = global i32 0
define i32 @t_getwidth() {
%1 = alloca %struct.winsize
%2 = bitcast %struct.winsize* %1 to i8*
%3 = load i32, i32* @TIOCGWINSZ
%4 = call i64 @ioctl(i32 0, i32 %3, %struct.winsize* %1)
%5 = icmp eq i64 %4, 0
%6 = getelementptr inbounds %struct.winsize, %struct.winsize* %1, i64 0, i32 0
%7 = load i32, i32* %6
%8 = select i1 %5, i32 %7, i32 -1
ret i32 %8
}
/* Variables and functions */
int strcmp(char const *, char const *);
int cmp_responder_key(const void *key1, const void *key2) {
  return strcmp((const char *)key1, (const char *)key2);
}


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

x86 assembly (clang, -O2):
<cmp_responder_key>:
jmp    1030 <strcmp@plt>

LLVM IR (-O0):
define i32 @cmp_responder_key(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 i32 @strcmp(i8* %5, i8* %6)
ret i32 %7
}

LLVM IR (-O2):
define i32 @cmp_responder_key(i8* nocapture %0, i8* nocapture %1) {
%3 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
ret i32 %3
}
unsigned char AdjustAscii(unsigned char a) {
  if (a <= 0x5a) {
    if (a >= 0x41)
      return a - 0x41 + 0xc;
    if (a == 0x20)
      return 0;
    return a - 0x30 + 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<AdjustAscii>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x2(%rbp)
movzbl -0x2(%rbp),%eax
cmp    $0x5a,%eax
jg     115e <AdjustAscii+0x5e>
movzbl -0x2(%rbp),%eax
cmp    $0x41,%eax
jl     1136 <AdjustAscii+0x36>
movzbl -0x2(%rbp),%eax
sub    $0x41,%eax
add    $0xc,%eax
mov    %al,-0x1(%rbp)
jmp    1162 <AdjustAscii+0x62>
movzbl -0x2(%rbp),%eax
cmp    $0x20,%eax
jne    114c <AdjustAscii+0x4c>
movb   $0x0,-0x1(%rbp)
jmp    1162 <AdjustAscii+0x62>
movzbl -0x2(%rbp),%eax
sub    $0x30,%eax
add    $0x1,%eax
mov    %al,-0x1(%rbp)
jmp    1162 <AdjustAscii+0x62>
movb   $0x0,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<AdjustAscii>:
mov    %edi,%eax
cmp    $0x5a,%al
ja     110d <AdjustAscii+0xd>
cmp    $0x41,%al
jb     1110 <AdjustAscii+0x10>
add    $0xcb,%al
ret
xor    %eax,%eax
ret
lea    -0x2f(%rax),%ecx
xor    %edx,%edx
cmp    $0x20,%al
movzbl %cl,%eax
cmove  %edx,%eax
ret

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

LLVM IR (-O2):
define zeroext i8 @AdjustAscii(i8 zeroext %0) {
%2 = icmp ult i8 %0, 91
br i1 %2, label %3, label %11
3: ; preds = %1
%4 = icmp ugt i8 %0, 64
br i1 %4, label %5, label %7
5: ; preds = %3
%6 = add nsw i8 %0, -53
br label %11
7: ; preds = %3
%8 = icmp eq i8 %0, 32
%9 = add nsw i8 %0, -47
%10 = select i1 %8, i8 0, i8 %9
br label %11
11: ; preds = %7, %1, %5
%12 = phi i8 [ %6, %5 ], [ 0, %1 ], [ %10, %7 ]
ret i8 %12
}
int array_bad() {
  int a[10];
  for (int i = 0; i < 5; i++) {
    a[i] = 0;
  }
  return a[9];
}


x86 assembly (clang, -O0):
<array_bad>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x34(%rbp)
cmpl   $0x5,-0x34(%rbp)
jge    112f <array_bad+0x2f>
movslq -0x34(%rbp),%rax
movl   $0x0,-0x30(%rbp,%rax,4)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    110b <array_bad+0xb>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @array_bad() {
%1 = alloca [10 x i32]
%2 = alloca i32
store i32 0, i32* %2
br label %3
3: ; preds = %10, %0
%4 = load i32, i32* %2
%5 = icmp slt i32 %4, 5
br i1 %5, label %6, label %13
6: ; preds = %3
%7 = load i32, i32* %2
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 %8
store i32 0, i32* %9
br label %10
10: ; preds = %6
%11 = load i32, i32* %2
%12 = add nsw i32 %11, 1
store i32 %12, i32* %2
br label %3
13: ; preds = %3
%14 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 9
%15 = load i32, i32* %14
ret i32 %15
}

LLVM IR (-O2):
define i32 @array_bad() {
ret i32 undef
}
const char *Mark_Description(void) {
  return "The `Mark` class can be overridden to customize the behaviour of the "
         "Cello Garbage Collector on encountering a given type. By default the "
         "allocated memory for a structure is scanned for pointers to other "
         "Cello "
         "objects, but if a type does its own memory allocation it may store "
         "pointers to Cello objects in other locations."
         "\n\n"
         "If this is the case the `Mark` class can be overridden and the "
         "callback "
         "function `f` must be called on all pointers which might be Cello "
         "objects "
         "which are managed by the class. Alternately the `mark` function can "
         "be "
         "called on any sub object to start a chain of recursive marking.";
}


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

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

LLVM IR (-O0):
@.str = [604 x i8] c"The `Mark` class can be overridden to customize the behaviour of the Cello Garbage Collector on encountering a given type. By default the allocated memory for a structure is scanned for pointers to other Cello objects, but if a type does its own memory allocation it may store pointers to Cello objects in other locations.\0A\0AIf this is the case the `Mark` class can be overridden and the callback function `f` must be called on all pointers which might be Cello objects which are managed by the class. Alternately the `mark` function can be called on any sub object to start a chain of recursive marking.\00"
define i8* @Mark_Description() {
ret i8* getelementptr inbounds ([604 x i8], [604 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [604 x i8] c"The `Mark` class can be overridden to customize the behaviour of the Cello Garbage Collector on encountering a given type. By default the allocated memory for a structure is scanned for pointers to other Cello objects, but if a type does its own memory allocation it may store pointers to Cello objects in other locations.\0A\0AIf this is the case the `Mark` class can be overridden and the callback function `f` must be called on all pointers which might be Cello objects which are managed by the class. Alternately the `mark` function can be called on any sub object to start a chain of recursive marking.\00"
define i8* @Mark_Description() {
ret i8* getelementptr inbounds ([604 x i8], [604 x i8]* @.str, i64 0, i64 0)
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char const *);
void print_usage(FILE *fp, const char *arg0) {
  fprintf(fp,
          "Usage: %s [options] file1 file2...\n"
          "Options:\n"
          " -b     Ignore blank lines\n"
          " -s     Ignore whitespace altogether\n"
          " -t     Trim whitespace from ends of lines\n"
          " -n     Normalize LCS lengths\n"
          " -h     Print this message\n"
          " -v     Print the version\n",
          arg0);
}


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

x86 assembly (clang, -O2):
<print_usage>:
mov    %rsi,%rdx
lea    0xee6(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@.str = [235 x i8] c"Usage: %s [options] file1 file2...\0AOptions:\0A -b Ignore blank lines\0A -s Ignore whitespace altogether\0A -t Trim whitespace from ends of lines\0A -n Normalize LCS lengths\0A -h Print this message\0A -v Print the version\0A\00"
define void @print_usage(i32* %0, i8* %1) {
%3 = alloca i32*
%4 = alloca i8*
store i32* %0, i32** %3
store i8* %1, i8** %4
%5 = load i32*, i32** %3
%6 = load i8*, i8** %4
%7 = call i32 @fprintf(i32* %5, i8* getelementptr inbounds ([235 x i8], [235 x i8]* @.str, i64 0, i64 0), i8* %6)
ret void
}

LLVM IR (-O2):
@.str = [235 x i8] c"Usage: %s [options] file1 file2...\0AOptions:\0A -b Ignore blank lines\0A -s Ignore whitespace altogether\0A -t Trim whitespace from ends of lines\0A -n Normalize LCS lengths\0A -h Print this message\0A -v Print the version\0A\00"
define void @print_usage(i32* nocapture %0, i8* %1) {
%3 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([235 x i8], [235 x i8]* @.str, i64 0, i64 0), i8* %1)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ SEEK_END;
int /*<<< orphan*/ SEEK_SET;
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, long, int /*<<< orphan*/);
int ftell(int /*<<< orphan*/ *);
int getSize(FILE *fp) {
  fseek(fp, 0L, SEEK_END);
  int sz = ftell(fp);
  fseek(fp, 0L, SEEK_SET);
  return sz;
}


x86 assembly (clang, -O0):
<getSize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2eb1(%rip),%rax
mov    (%rax),%edx
xor    %eax,%eax
mov    %eax,%esi
call   1040 <fseek@plt>
mov    -0x8(%rbp),%rdi
call   1030 <ftell@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2e7f(%rip),%rax
mov    (%rax),%edx
xor    %eax,%eax
mov    %eax,%esi
call   1040 <fseek@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getSize>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    0x2ebb(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1040 <fseek@plt>
mov    %rbx,%rdi
call   1030 <ftell@plt>
mov    %eax,%ebp
mov    0x2e91(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1040 <fseek@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
define i32 @getSize(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
%4 = load i32*, i32** %2
%5 = load i32, i32* @SEEK_END
%6 = call i32 @fseek(i32* %4, i64 0, i32 %5)
%7 = load i32*, i32** %2
%8 = call i32 @ftell(i32* %7)
store i32 %8, i32* %3
%9 = load i32*, i32** %2
%10 = load i32, i32* @SEEK_SET
%11 = call i32 @fseek(i32* %9, i64 0, i32 %10)
%12 = load i32, i32* %3
ret i32 %12
}

LLVM IR (-O2):
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
define i32 @getSize(i32* nocapture %0) {
%2 = load i32, i32* @SEEK_END
%3 = tail call i32 @fseek(i32* %0, i64 0, i32 %2)
%4 = tail call i32 @ftell(i32* %0)
%5 = load i32, i32* @SEEK_SET
%6 = tail call i32 @fseek(i32* %0, i64 0, i32 %5)
ret i32 %4
}
int complex(int a, int b) {
  while (a < 30) {
    while (b < a) {
      if (b > 5)
        b = b * 3;
      else
        b = b + 2;
      if (b >= 10 && b <= 12)
        a = a + 10;
      else
        a = a + 1;
    }
    a = a + 2;
    b = b - 10;
  }
  return 1;
}


x86 assembly (clang, -O0):
<complex>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x1e,-0x4(%rbp)
jge    118b <complex+0x8b>
jmp    1119 <complex+0x19>
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1174 <complex+0x74>
cmpl   $0x5,-0x8(%rbp)
jle    113b <complex+0x3b>
imul   $0x3,-0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    1144 <complex+0x44>
mov    -0x8(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jl     1166 <complex+0x66>
cmpl   $0xc,-0x8(%rbp)
jg     1166 <complex+0x66>
mov    -0x4(%rbp),%eax
add    $0xa,%eax
mov    %eax,-0x4(%rbp)
jmp    116f <complex+0x6f>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1119 <complex+0x19>
mov    -0x4(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
sub    $0xa,%eax
mov    %eax,-0x8(%rbp)
jmp    110a <complex+0xa>
mov    $0x1,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @complex(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
br label %5
5: ; preds = %35, %2
%6 = load i32, i32* %3
%7 = icmp slt i32 %6, 30
br i1 %7, label %8, label %40
8: ; preds = %5
br label %9
9: ; preds = %34, %8
%10 = load i32, i32* %4
%11 = load i32, i32* %3
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %35
13: ; preds = %9
%14 = load i32, i32* %4
%15 = icmp sgt i32 %14, 5
br i1 %15, label %16, label %19
16: ; preds = %13
%17 = load i32, i32* %4
%18 = mul nsw i32 %17, 3
store i32 %18, i32* %4
br label %22
19: ; preds = %13
%20 = load i32, i32* %4
%21 = add nsw i32 %20, 2
store i32 %21, i32* %4
br label %22
22: ; preds = %19, %16
%23 = load i32, i32* %4
%24 = icmp sge i32 %23, 10
br i1 %24, label %25, label %31
25: ; preds = %22
%26 = load i32, i32* %4
%27 = icmp sle i32 %26, 12
br i1 %27, label %28, label %31
28: ; preds = %25
%29 = load i32, i32* %3
%30 = add nsw i32 %29, 10
store i32 %30, i32* %3
br label %34
31: ; preds = %25, %22
%32 = load i32, i32* %3
%33 = add nsw i32 %32, 1
store i32 %33, i32* %3
br label %34
34: ; preds = %31, %28
br label %9
35: ; preds = %9
%36 = load i32, i32* %3
%37 = add nsw i32 %36, 2
store i32 %37, i32* %3
%38 = load i32, i32* %4
%39 = sub nsw i32 %38, 10
store i32 %39, i32* %4
br label %5
40: ; preds = %5
ret i32 1
}

LLVM IR (-O2):
define i32 @complex(i32 %0, i32 %1) {
ret i32 1
}
foo(bufp) char *bufp;
{
  int x = 80;
  return (*bufp++ = x ? 'a' : 'b');
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x50,-0xc(%rbp)
mov    -0xc(%rbp),%edx
mov    $0x62,%eax
mov    $0x61,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
mov    -0x8(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
mov    %al,(%rcx)
movsbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
movb   $0x61,(%rdi)
mov    $0x61,%eax
ret

LLVM IR (-O0):
define i32 @foo(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 80, i32* %3
%4 = load i32, i32* %3
%5 = icmp ne i32 %4, 0
%6 = zext i1 %5 to i64
%7 = select i1 %5, i32 97, i32 98
%8 = trunc i32 %7 to i8
%9 = load i8*, i8** %2
%10 = getelementptr inbounds i8, i8* %9, i32 1
store i8* %10, i8** %2
store i8 %8, i8* %9
%11 = sext i8 %8 to i32
ret i32 %11
}

LLVM IR (-O2):
define i32 @foo(i8* nocapture writeonly %0) {
store i8 97, i8* %0
ret i32 97
}
/* Variables and functions */
int /*<<< orphan*/ pthread_self();
int /*<<< orphan*/ pthread_setname_np(int /*<<< orphan*/, char *);
void threadname(char *name) { pthread_setname_np(pthread_self(), name); }


x86 assembly (clang, -O0):
<threadname>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1040 <pthread_self@plt>
mov    %eax,%edi
mov    -0x8(%rbp),%rsi
call   1030 <pthread_setname_np@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<threadname>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1040 <pthread_self@plt>
mov    %eax,%edi
mov    %rbx,%rsi
pop    %rbx
jmp    1030 <pthread_setname_np@plt>

LLVM IR (-O0):
define void @threadname(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 (...) @pthread_self()
%4 = load i8*, i8** %2
%5 = call i32 @pthread_setname_np(i32 %3, i8* %4)
ret void
}

LLVM IR (-O2):
define void @threadname(i8* %0) {
%2 = tail call i32 (...) @pthread_self()
%3 = tail call i32 @pthread_setname_np(i32 %2, i8* %0)
ret void
}
void setTimer(unsigned long value) {}


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

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

LLVM IR (-O0):
define void @setTimer(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
ret void
}

LLVM IR (-O2):
define void @setTimer(i64 %0) {
ret void
}
void asm_set_bit(int nr, volatile unsigned long *addr) {
  __asm__("btsl %1,%0" : "=m"((*(volatile long *)addr)) : "Ir"(nr));
}


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

x86 assembly (clang, -O2):
<asm_set_bit>:
bts    %edi,(%rsi)
ret

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

LLVM IR (-O2):
define void @asm_set_bit(i32 %0, i64* %1) {
tail call void asm "btsl $1,$0", "=*m,Ir,~{dirflag},~{fpsr},~{flags}"(i64* elementtype(i64) %1, i32 %0)
ret void
}
void put_filp(void) { nsc_assert(0, __func__); }


x86 assembly (clang, -O0):
<put_filp>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
lea    0xee3(%rip),%rsi
mov    $0x0,%al
call   1030 <nsc_assert@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<put_filp>:
lea    0xee9(%rip),%rsi
xor    %edi,%edi
xor    %eax,%eax
jmp    1030 <nsc_assert@plt>

LLVM IR (-O0):
@__func__.put_filp = [9 x i8] c"put_filp\00"
define void @put_filp() {
%1 = call i32 (i32, i8*, ...) bitcast (i32 (...)* @nsc_assert to i32 (i32, i8*, ...)*)(i32 0, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @__func__.put_filp, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@__func__.put_filp = [9 x i8] c"put_filp\00"
define void @put_filp() {
%1 = tail call i32 (i32, i8*, ...) bitcast (i32 (...)* @nsc_assert to i32 (i32, i8*, ...)*)(i32 0, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @__func__.put_filp, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uid_t;
struct passwd {
  int dummy;
};

/* Variables and functions */
struct passwd *getpwuid(uid_t uid) {
  ;
  return NULL;
}


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

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

LLVM IR (-O0):
%struct.passwd = type { i32 }
define %struct.passwd* @getpwuid(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
ret %struct.passwd* null
}

LLVM IR (-O2):
%struct.passwd = type { i32 }
define noalias %struct.passwd* @getpwuid(i32 %0) {
ret %struct.passwd* null
}
/* Variables and functions */
int chdir(int /*<<< orphan*/);
int /*<<< orphan*/ get_queuedir(char const *);
int /*<<< orphan*/ perror(int /*<<< orphan*/);
int goto_queue(const char *queue) {
  if (chdir(get_queuedir(queue)) == -1) {
    perror(get_queuedir(queue));
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<goto_queue>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <get_queuedir@plt>
mov    %eax,%edi
call   1030 <chdir@plt>
cmp    $0xffffffff,%eax
jne    1171 <goto_queue+0x41>
mov    -0x10(%rbp),%rdi
call   1040 <get_queuedir@plt>
mov    %eax,%edi
call   1050 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    1178 <goto_queue+0x48>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<goto_queue>:
push   %rbx
mov    %rdi,%rbx
call   1040 <get_queuedir@plt>
mov    %eax,%edi
call   1030 <chdir@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0xffffffff,%ecx
je     114b <goto_queue+0x1b>
pop    %rbx
ret
mov    %rbx,%rdi
call   1040 <get_queuedir@plt>
mov    %eax,%edi
call   1050 <perror@plt>
mov    $0x1,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @goto_queue(i8* %0) {
%2 = tail call i32 @get_queuedir(i8* %0)
%3 = tail call i32 @chdir(i32 %2)
%4 = icmp eq i32 %3, -1
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = tail call i32 @get_queuedir(i8* %0)
%7 = tail call i32 @perror(i32 %6)
br label %8
8: ; preds = %1, %5
%9 = phi i32 [ 1, %5 ], [ 0, %1 ]
ret i32 %9
}
void XtProcessLock() {}


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

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

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

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

/* Variables and functions */
int __get_unaligned_le32(int /*<<< orphan*/ const *);
uint64_t __get_unaligned_le64(const uint8_t *p) {
  return (uint64_t)__get_unaligned_le32(p + 4) << 32 | __get_unaligned_le32(p);
}


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

x86 assembly (clang, -O2):
<__get_unaligned_le64>:
push   %rbx
mov    %rdi,%rbx
add    $0x10,%rdi
call   1030 <__get_unaligned_le32@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <__get_unaligned_le32@plt>

LLVM IR (-O0):
define i32 @__get_unaligned_le64(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = getelementptr inbounds i32, i32* %3, i64 4
%5 = call i32 @__get_unaligned_le32(i32* %4)
%6 = shl i32 %5, 32
%7 = load i32*, i32** %2
%8 = call i32 @__get_unaligned_le32(i32* %7)
%9 = or i32 %6, %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @__get_unaligned_le64(i32* %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 4
%3 = tail call i32 @__get_unaligned_le32(i32* %2)
%4 = tail call i32 @__get_unaligned_le32(i32* %0)
ret i32 poison
}
int ishex(ch)
char ch;
{
  return (isdigit(ch) || ((ch >= 'a') && (ch <= 'f')) ||
          ((ch >= 'A') && (ch <= 'F')));
}


x86 assembly (clang, -O0):
<ishex>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edi
call   1030 <isdigit@plt>
mov    %eax,%ecx
mov    $0x1,%al
cmp    $0x0,%ecx
mov    %al,-0x2(%rbp)
jne    117b <ishex+0x6b>
movsbl -0x1(%rbp),%eax
cmp    $0x61,%eax
jl     1156 <ishex+0x46>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x66,%ecx
mov    %al,-0x2(%rbp)
jle    117b <ishex+0x6b>
movsbl -0x1(%rbp),%ecx
xor    %eax,%eax
cmp    $0x41,%ecx
mov    %al,-0x3(%rbp)
jl     1175 <ishex+0x65>
movsbl -0x1(%rbp),%eax
cmp    $0x46,%eax
setle  %al
mov    %al,-0x3(%rbp)
mov    -0x3(%rbp),%al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ishex>:
movsbl %dil,%eax
add    $0xffffffd0,%eax
cmp    $0xa,%eax
setb   %al
and    $0xffffffdf,%edi
shl    $0x18,%edi
add    $0xbfffffff,%edi
cmp    $0x6ffffff,%edi
setb   %cl
or     %al,%cl
movzbl %cl,%eax
ret

LLVM IR (-O0):
define i32 @ishex(i32 %0) {
%2 = alloca i8
%3 = trunc i32 %0 to i8
store i8 %3, i8* %2
%4 = load i8, i8* %2
%5 = sext i8 %4 to i32
%6 = call i32 @isdigit(i32 %5)
%7 = icmp ne i32 %6, 0
br i1 %7, label %26, label %8
8: ; preds = %1
%9 = load i8, i8* %2
%10 = sext i8 %9 to i32
%11 = icmp sge i32 %10, 97
br i1 %11, label %12, label %16
12: ; preds = %8
%13 = load i8, i8* %2
%14 = sext i8 %13 to i32
%15 = icmp sle i32 %14, 102
br i1 %15, label %26, label %16
16: ; preds = %12, %8
%17 = load i8, i8* %2
%18 = sext i8 %17 to i32
%19 = icmp sge i32 %18, 65
br i1 %19, label %20, label %24
20: ; preds = %16
%21 = load i8, i8* %2
%22 = sext i8 %21 to i32
%23 = icmp sle i32 %22, 70
br label %24
24: ; preds = %20, %16
%25 = phi i1 [ false, %16 ], [ %23, %20 ]
br label %26
26: ; preds = %24, %12, %1
%27 = phi i1 [ true, %12 ], [ true, %1 ], [ %25, %24 ]
%28 = zext i1 %27 to i32
ret i32 %28
}

LLVM IR (-O2):
define i32 @ishex(i32 %0) {
%2 = shl i32 %0, 24
%3 = ashr exact i32 %2, 24
%4 = add nsw i32 %3, -48
%5 = icmp ult i32 %4, 10
%6 = and i32 %2, -553648128
%7 = add i32 %6, -1073741825
%8 = icmp ult i32 %7, 117440511
%9 = or i1 %8, %5
%10 = zext i1 %9 to i32
ret i32 %10
}
/* Variables and functions */
void *dllcalloc(size_t, size_t);
void *__wrap_calloc(size_t num, size_t size) { return dllcalloc(num, size); }


x86 assembly (clang, -O0):
<__wrap_calloc>:
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 <dllcalloc@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__wrap_calloc>:
jmp    1030 <dllcalloc@plt>

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

LLVM IR (-O2):
define i8* @__wrap_calloc(i64 %0, i64 %1) {
%3 = tail call i8* @dllcalloc(i64 %0, i64 %1)
ret i8* %3
}
/* Variables and functions */
int f();
int g();
int main() {
  if (f() != 1 || g() != 2 || f() != 3)
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <f@plt>
cmp    $0x1,%eax
jne    115f <main+0x3f>
mov    $0x0,%al
call   1040 <g@plt>
cmp    $0x2,%eax
jne    115f <main+0x3f>
mov    $0x0,%al
call   1030 <f@plt>
cmp    $0x3,%eax
je     116b <main+0x4b>
movl   $0x1,-0x4(%rbp)
jmp    1172 <main+0x52>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1030 <f@plt>
mov    $0x1,%ebx
cmp    $0x1,%eax
jne    114d <main+0x2d>
xor    %eax,%eax
call   1040 <g@plt>
cmp    $0x2,%eax
jne    114d <main+0x2d>
xor    %eax,%eax
call   1030 <f@plt>
xor    %ebx,%ebx
cmp    $0x3,%eax
setne  %bl
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @f()
%3 = icmp ne i32 %2, 1
br i1 %3, label %10, label %4
4: ; preds = %0
%5 = call i32 (...) @g()
%6 = icmp ne i32 %5, 2
br i1 %6, label %10, label %7
7: ; preds = %4
%8 = call i32 (...) @f()
%9 = icmp ne i32 %8, 3
br i1 %9, label %10, label %11
10: ; preds = %7, %4, %0
store i32 1, i32* %1
br label %12
11: ; preds = %7
store i32 0, i32* %1
br label %12
12: ; preds = %11, %10
%13 = load i32, i32* %1
ret i32 %13
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @f()
%2 = icmp eq i32 %1, 1
br i1 %2, label %3, label %10
3: ; preds = %0
%4 = tail call i32 (...) @g()
%5 = icmp eq i32 %4, 2
br i1 %5, label %6, label %10
6: ; preds = %3
%7 = tail call i32 (...) @f()
%8 = icmp ne i32 %7, 3
%9 = zext i1 %8 to i32
br label %10
10: ; preds = %6, %0, %3
%11 = phi i32 [ 1, %3 ], [ 1, %0 ], [ %9, %6 ]
ret i32 %11
}
void null(int n) {
  (void)n;
  return;
}


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

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

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

LLVM IR (-O2):
define void @null(i32 %0) {
ret void
}
float i2f(int a) { return (int)a; }


x86 assembly (clang, -O0):
<i2f>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cvtsi2ssl -0x4(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<i2f>:
cvtsi2ss %edi,%xmm0
ret

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

LLVM IR (-O2):
define float @i2f(i32 %0) {
%2 = sitofp i32 %0 to float
ret float %2
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
int bandwidth_measure_free(void *band) {
  free(band);
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @bandwidth_measure_free(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ perror(char *);
scalar_t__ walk_dir(char *, int, long double *);
long double walk_dir_size(char *dname, int spec) {
  long double sizebuffer = 0;
  if (walk_dir(dname, spec, &sizebuffer)) {
    perror("Failed to walk directory.");
    exit(1);
  }
  return sizebuffer;
}


x86 assembly (clang, -O0):
<walk_dir_size>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
fldz
fstpt  -0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
lea    -0x20(%rbp),%rdx
call   1030 <walk_dir@plt>
cmp    $0x0,%rax
je     1174 <walk_dir_size+0x44>
lea    0xe9b(%rip),%rdi
call   1040 <perror@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
fldt   -0x20(%rbp)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<walk_dir_size>:
sub    $0x18,%rsp
fldz
fstpt  (%rsp)
mov    %rsp,%rdx
call   1030 <walk_dir@plt>
test   %rax,%rax
jne    114e <walk_dir_size+0x1e>
fldt   (%rsp)
add    $0x18,%rsp
ret
lea    0xeab(%rip),%rdi
call   1040 <perror@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [26 x i8] c"Failed to walk directory.\00"
define x86_fp80 @walk_dir_size(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca x86_fp80
store i8* %0, i8** %3
store i32 %1, i32* %4
store x86_fp80 0xK00000000000000000000, x86_fp80* %5
%6 = load i8*, i8** %3
%7 = load i32, i32* %4
%8 = call i64 @walk_dir(i8* %6, i32 %7, x86_fp80* %5)
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %13
10: ; preds = %2
%11 = call i32 @perror(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%12 = call i32 @exit(i32 1)
unreachable
13: ; preds = %2
%14 = load x86_fp80, x86_fp80* %5
ret x86_fp80 %14
}

LLVM IR (-O2):
@.str = [26 x i8] c"Failed to walk directory.\00"
define x86_fp80 @walk_dir_size(i8* %0, i32 %1) {
%3 = alloca x86_fp80
%4 = bitcast x86_fp80* %3 to i8*
store x86_fp80 0xK00000000000000000000, x86_fp80* %3
%5 = call i64 @walk_dir(i8* %0, i32 %1, x86_fp80* %3)
%6 = icmp eq i64 %5, 0
br i1 %6, label %10, label %7
7: ; preds = %2
%8 = call i32 @perror(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @exit(i32 1)
unreachable
10: ; preds = %2
%11 = load x86_fp80, x86_fp80* %3
ret x86_fp80 %11
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ match(char const);
void matchStr(char const *str) {
  assert(str != 0);
  for (; *str != '\0'; ++str)
    match(*str);
}


x86 assembly (clang, -O0):
<matchStr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     116b <matchStr+0x4b>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1040 <match@plt>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    113e <matchStr+0x1e>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<matchStr>:
push   %rbx
mov    %rdi,%rbx
xor    %edi,%edi
test   %rbx,%rbx
setne  %dil
call   1030 <assert@plt>
mov    (%rbx),%al
test   %al,%al
je     1153 <matchStr+0x33>
add    $0x1,%rbx
nopl   0x0(%rax)
movsbl %al,%edi
call   1040 <match@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1140 <matchStr+0x20>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @matchStr(i8* %0) {
%2 = icmp ne i8* %0, null
%3 = zext i1 %2 to i32
%4 = tail call i32 @assert(i32 %3)
%5 = load i8, i8* %0
%6 = icmp eq i8 %5, 0
br i1 %6, label %14, label %7
7: ; preds = %1, %7
%8 = phi i8 [ %12, %7 ], [ %5, %1 ]
%9 = phi i8* [ %11, %7 ], [ %0, %1 ]
%10 = tail call i32 @match(i8 signext %8)
%11 = getelementptr inbounds i8, i8* %9, i64 1
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %7
14: ; preds = %7, %1
ret void
}