xunge/DecIR huggingface dataset:
/* Type definitions */
typedef scalar_t__ pthread_t;

/* Variables and functions */
int pthread_equal(pthread_t t1, pthread_t t2) { return (t1 == t2); }


x86 assembly (clang, -O0):
<pthread_equal>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<pthread_equal>:
xor    %eax,%eax
cmp    %rsi,%rdi
sete   %al
ret

LLVM IR (-O0):
define i32 @pthread_equal(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 = icmp eq i64 %5, %6
%8 = zext i1 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @pthread_equal(i64 %0, i64 %1) {
%3 = icmp eq i64 %0, %1
%4 = zext i1 %3 to i32
ret i32 %4
}
void sigar_getline_windowchanged() {}


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

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

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

LLVM IR (-O2):
define void @sigar_getline_windowchanged() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int const, int const, int);
int main() {
  const int N = 3;
  const int K = 4;
  int sum = 0;
  for (int i = 0; i < N; i++)
    sum += K + i;
  printf("N=%i K=%i sum=%i\n", N, K, sum);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x3,-0x8(%rbp)
movl   $0x4,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x3,-0x14(%rbp)
jge    115f <main+0x4f>
mov    -0x14(%rbp),%eax
add    $0x4,%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    113b <main+0x2b>
mov    -0x10(%rbp),%ecx
lea    0xe97(%rip),%rdi
mov    $0x3,%esi
mov    $0x4,%edx
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [18 x i8] c"N=%i K=%i sum=%i\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 3, i32 4, i32 15)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
exxit() { exit(0); }


x86 assembly (clang, -O0):
<exxit>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1030 <exit@plt>

x86 assembly (clang, -O2):
<exxit>:
push   %rax
xor    %edi,%edi
call   1030 <exit@plt>

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

LLVM IR (-O2):
define i32 @exxit() {
%1 = tail call i32 @exit(i32 0)
unreachable
}
int funbreak(int i) {
  i = i * 2;
  i = i + 10;
  return i;
}


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

x86 assembly (clang, -O2):
<funbreak>:
lea    (%rdi,%rdi,1),%eax
add    $0xa,%eax
ret

LLVM IR (-O0):
define i32 @funbreak(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = mul nsw i32 %3, 2
store i32 %4, i32* %2
%5 = load i32, i32* %2
%6 = add nsw i32 %5, 10
store i32 %6, i32* %2
%7 = load i32, i32* %2
ret i32 %7
}

LLVM IR (-O2):
define i32 @funbreak(i32 %0) {
%2 = shl nsw i32 %0, 1
%3 = add nsw i32 %2, 10
ret i32 %3
}
/* Type definitions */
struct wl_surface {
  int dummy;
};
struct wl_proxy {
  int dummy;
};
struct wl_buffer {
  int dummy;
};
typedef int /*<<< orphan*/ int32_t;

/* Variables and functions */
int /*<<< orphan*/ wl_proxy_marshal(struct wl_proxy *, int, struct wl_buffer *,
                                    int /*<<< orphan*/, int /*<<< orphan*/);
void wl_surface_attach(struct wl_surface *wl_surface, struct wl_buffer *buffer,
                       int32_t x, int32_t y) {
  wl_proxy_marshal((struct wl_proxy *)wl_surface, 1, buffer, x, y);
}


x86 assembly (clang, -O0):
<wl_surface_attach>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%r8d
mov    $0x1,%esi
call   1030 <wl_proxy_marshal@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wl_surface_attach>:
mov    %ecx,%r8d
mov    %edx,%ecx
mov    %rsi,%rdx
mov    $0x1,%esi
jmp    1030 <wl_proxy_marshal@plt>

LLVM IR (-O0):
%struct.wl_surface = type { i32 }
%struct.wl_buffer = type { i32 }
%struct.wl_proxy = type { i32 }
define void @wl_surface_attach(%struct.wl_surface* %0, %struct.wl_buffer* %1, i32 %2, i32 %3) {
%5 = alloca %struct.wl_surface*
%6 = alloca %struct.wl_buffer*
%7 = alloca i32
%8 = alloca i32
store %struct.wl_surface* %0, %struct.wl_surface** %5
store %struct.wl_buffer* %1, %struct.wl_buffer** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load %struct.wl_surface*, %struct.wl_surface** %5
%10 = bitcast %struct.wl_surface* %9 to %struct.wl_proxy*
%11 = load %struct.wl_buffer*, %struct.wl_buffer** %6
%12 = load i32, i32* %7
%13 = load i32, i32* %8
%14 = call i32 @wl_proxy_marshal(%struct.wl_proxy* %10, i32 1, %struct.wl_buffer* %11, i32 %12, i32 %13)
ret void
}

LLVM IR (-O2):
%struct.wl_surface = type { i32 }
%struct.wl_buffer = type { i32 }
%struct.wl_proxy = type { i32 }
define void @wl_surface_attach(%struct.wl_surface* %0, %struct.wl_buffer* %1, i32 %2, i32 %3) {
%5 = bitcast %struct.wl_surface* %0 to %struct.wl_proxy*
%6 = tail call i32 @wl_proxy_marshal(%struct.wl_proxy* %5, i32 1, %struct.wl_buffer* %1, i32 %2, i32 %3)
ret void
}
/* Variables and functions */
void *extn_findsymbol(const char *name) { return NULL; }


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

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

LLVM IR (-O0):
define i8* @extn_findsymbol(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
ret i8* null
}

LLVM IR (-O2):
define noalias i8* @extn_findsymbol(i8* nocapture readnone %0) {
ret i8* null
}
void handle_events() { int i = 0; }


x86 assembly (clang, -O0):
<handle_events>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @handle_events() {
ret void
}
unsigned short int f46(unsigned short int x, unsigned long int y) {
  return (x >> y) | (x << ((-y) & (8 * sizeof(unsigned short) - 1)));
}


x86 assembly (clang, -O0):
<f46>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    %rsi,-0x10(%rbp)
movzwl -0x2(%rbp),%eax
mov    -0x10(%rbp),%rcx
sar    %cl,%eax
movzwl -0x2(%rbp),%edx
xor    %ecx,%ecx
sub    -0x10(%rbp),%rcx
and    $0xf,%rcx
shl    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
movzwl %ax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f46>:
mov    %rsi,%rcx
mov    %edi,%eax
shr    %cl,%eax
neg    %cl
and    $0xf,%cl
shl    %cl,%edi
or     %edi,%eax
ret

LLVM IR (-O0):
define zeroext i16 @f46(i16 zeroext %0, i64 %1) {
%3 = alloca i16
%4 = alloca i64
store i16 %0, i16* %3
store i64 %1, i64* %4
%5 = load i16, i16* %3
%6 = zext i16 %5 to i32
%7 = load i64, i64* %4
%8 = trunc i64 %7 to i32
%9 = ashr i32 %6, %8
%10 = load i16, i16* %3
%11 = zext i16 %10 to i32
%12 = load i64, i64* %4
%13 = sub i64 0, %12
%14 = and i64 %13, 15
%15 = trunc i64 %14 to i32
%16 = shl i32 %11, %15
%17 = or i32 %9, %16
%18 = trunc i32 %17 to i16
ret i16 %18
}

LLVM IR (-O2):
define zeroext i16 @f46(i16 zeroext %0, i64 %1) {
%3 = zext i16 %0 to i32
%4 = trunc i64 %1 to i32
%5 = lshr i32 %3, %4
%6 = sub i32 0, %4
%7 = and i32 %6, 15
%8 = shl nuw nsw i32 %3, %7
%9 = or i32 %8, %5
%10 = trunc i32 %9 to i16
ret i16 %10
}
/* Type definitions */
typedef scalar_t__ int32_t;

/* Variables and functions */
int32_t minimum_int32(int32_t a, int32_t b) { return (a < b) ? a : b; }


x86 assembly (clang, -O0):
<minimum_int32>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
jge    1127 <minimum_int32+0x27>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    112f <minimum_int32+0x2f>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<minimum_int32>:
mov    %rsi,%rax
cmp    %rsi,%rdi
cmovl  %rdi,%rax
ret

LLVM IR (-O0):
define i64 @minimum_int32(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 = icmp slt i64 %5, %6
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load i64, i64* %3
br label %12
10: ; preds = %2
%11 = load i64, i64* %4
br label %12
12: ; preds = %10, %8
%13 = phi i64 [ %9, %8 ], [ %11, %10 ]
ret i64 %13
}

LLVM IR (-O2):
define i64 @minimum_int32(i64 %0, i64 %1) {
%3 = icmp slt i64 %0, %1
%4 = select i1 %3, i64 %0, i64 %1
ret i64 %4
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
void freeXmlNormalizedString(char *s) { free(s); }


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

x86 assembly (clang, -O2):
<freeXmlNormalizedString>:
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @freeXmlNormalizedString(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
short swap_linear(short pcm_val) {
  struct lohibyte {
    unsigned char lb, hb;
  };
  union {
    struct lohibyte b;
    short i;
  } exchange;
  unsigned char c;
  exchange.i = pcm_val;
  c = exchange.b.hb;
  exchange.b.hb = exchange.b.lb;
  exchange.b.lb = c;
  return (exchange.i);
}


x86 assembly (clang, -O0):
<swap_linear>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    -0x2(%rbp),%ax
mov    %ax,-0x8(%rbp)
mov    -0x7(%rbp),%al
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%al
mov    %al,-0x7(%rbp)
mov    -0x9(%rbp),%al
mov    %al,-0x8(%rbp)
movswl -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<swap_linear>:
mov    %edi,%eax
rol    $0x8,%ax
ret

LLVM IR (-O0):
%union.anon = type { i16 }
%struct.lohibyte = type { i8, i8 }
define signext i16 @swap_linear(i16 signext %0) {
%2 = alloca i16
%3 = alloca %union.anon
%4 = alloca i8
store i16 %0, i16* %2
%5 = load i16, i16* %2
%6 = bitcast %union.anon* %3 to i16*
store i16 %5, i16* %6
%7 = bitcast %union.anon* %3 to %struct.lohibyte*
%8 = getelementptr inbounds %struct.lohibyte, %struct.lohibyte* %7, i32 0, i32 1
%9 = load i8, i8* %8
store i8 %9, i8* %4
%10 = bitcast %union.anon* %3 to %struct.lohibyte*
%11 = getelementptr inbounds %struct.lohibyte, %struct.lohibyte* %10, i32 0, i32 0
%12 = load i8, i8* %11
%13 = bitcast %union.anon* %3 to %struct.lohibyte*
%14 = getelementptr inbounds %struct.lohibyte, %struct.lohibyte* %13, i32 0, i32 1
store i8 %12, i8* %14
%15 = load i8, i8* %4
%16 = bitcast %union.anon* %3 to %struct.lohibyte*
%17 = getelementptr inbounds %struct.lohibyte, %struct.lohibyte* %16, i32 0, i32 0
store i8 %15, i8* %17
%18 = bitcast %union.anon* %3 to i16*
%19 = load i16, i16* %18
ret i16 %19
}

LLVM IR (-O2):
define signext i16 @swap_linear(i16 signext %0) {
%2 = tail call i16 @llvm.bswap.i16(i16 %0)
ret i16 %2
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
void *malloc(size_t);
int /*<<< orphan*/ stderr;
void *g2_malloc(size_t size) {
  void *rv;
  if ((rv = malloc(size)) == NULL) {
    fprintf(stderr, "g2_malloc: Can not allocate memory\n");
    exit(-1);
  }
  return rv;
}


x86 assembly (clang, -O0):
<g2_malloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
jne    1172 <g2_malloc+0x42>
mov    0x2e86(%rip),%rax
mov    (%rax),%edi
lea    0xe9d(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<g2_malloc>:
push   %rax
call   1040 <malloc@plt>
test   %rax,%rax
je     113d <g2_malloc+0xd>
pop    %rcx
ret
mov    0x2e9c(%rip),%rax
mov    (%rax),%edi
lea    0xeb3(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [36 x i8] c"g2_malloc: Can not allocate memory\0A\00"
define i8* @g2_malloc(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = call i8* @malloc(i64 %4)
store i8* %5, i8** %3
%6 = icmp eq i8* %5, null
br i1 %6, label %7, label %11
7: ; preds = %1
%8 = load i32, i32* @stderr
%9 = call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @exit(i32 -1)
unreachable
11: ; preds = %1
%12 = load i8*, i8** %3
ret i8* %12
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [36 x i8] c"g2_malloc: Can not allocate memory\0A\00"
define noalias i8* @g2_malloc(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @exit(i32 -1)
unreachable
8: ; preds = %1
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ assert(int /*<<< orphan*/);
int /*<<< orphan*/ free(int *);
int /*<<< orphan*/ func_fail(int *);
int /*<<< orphan*/ func_ok(int *);
int *malloc(int);
int *realloc(int *, int);
int main(void) {
  int *arr = malloc(3 * sizeof(int));
  assert(arr != NULL);
  arr = realloc(arr, 10 * sizeof(int));
  assert(arr != NULL);
  func_ok(arr);
  func_fail(arr);
  free(arr);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0xc,%edi
call   1050 <malloc@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x8(%rbp),%rdi
mov    $0x28,%esi
call   1070 <realloc@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x8(%rbp),%rdi
call   1060 <func_ok@plt>
mov    -0x8(%rbp),%rdi
call   1080 <func_fail@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0xc,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
xor    %edi,%edi
test   %rax,%rax
setne  %dil
call   1040 <assert@plt>
mov    %rbx,%rdi
mov    $0x28,%esi
call   1070 <realloc@plt>
mov    %rax,%rbx
xor    %edi,%edi
test   %rax,%rax
setne  %dil
call   1040 <assert@plt>
mov    %rbx,%rdi
call   1060 <func_ok@plt>
mov    %rbx,%rdi
call   1080 <func_fail@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32*
%2 = call i32* @malloc(i32 12)
store i32* %2, i32** %1
%3 = load i32*, i32** %1
%4 = icmp ne i32* %3, null
%5 = zext i1 %4 to i32
%6 = call i32 @assert(i32 %5)
%7 = load i32*, i32** %1
%8 = call i32* @realloc(i32* %7, i32 40)
store i32* %8, i32** %1
%9 = load i32*, i32** %1
%10 = icmp ne i32* %9, null
%11 = zext i1 %10 to i32
%12 = call i32 @assert(i32 %11)
%13 = load i32*, i32** %1
%14 = call i32 @func_ok(i32* %13)
%15 = load i32*, i32** %1
%16 = call i32 @func_fail(i32* %15)
%17 = load i32*, i32** %1
%18 = call i32 @free(i32* %17)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32* @malloc(i32 12)
%2 = icmp ne i32* %1, null
%3 = zext i1 %2 to i32
%4 = tail call i32 @assert(i32 %3)
%5 = tail call i32* @realloc(i32* %1, i32 40)
%6 = icmp ne i32* %5, null
%7 = zext i1 %6 to i32
%8 = tail call i32 @assert(i32 %7)
%9 = tail call i32 @func_ok(i32* %5)
%10 = tail call i32 @func_fail(i32* %5)
%11 = tail call i32 @free(i32* %5)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, unsigned int);
int main(void) {
  int x = 3147483649;
  unsigned int y = 3147483649;
  printf("signed value: %i\n", x);
  printf("unsigned value: %u\n", y);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xbb9aca01,-0x8(%rbp)
movl   $0xbb9aca01,-0xc(%rbp)
mov    -0x8(%rbp),%esi
lea    0xec9(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%esi
lea    0xecc(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [18 x i8] c"signed value: %i\0A\00"
@.str.1 = [20 x i8] c"unsigned value: %u\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 -1147483647, i32* %2
store i32 -1147483647, i32* %3
%4 = load i32, i32* %2
%5 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = load i32, i32* %3
%7 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i32 %6)
ret i32 0
}

LLVM IR (-O2):
@.str = [18 x i8] c"signed value: %i\0A\00"
@.str.1 = [20 x i8] c"unsigned value: %u\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 -1147483647)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i32 -1147483647)
ret i32 0
}
int main(void) {
  int failed = 0;
  return failed;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int /*<<< orphan*/);
main(int a, char **b) {
  while (*b[1])
    printf("%c ", *b[1]++);
}


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)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
cmpb   $0x0,(%rax)
je     115e <main+0x4e>
mov    -0x10(%rbp),%rcx
mov    0x8(%rcx),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,0x8(%rcx)
movsbl (%rax),%esi
lea    0xeac(%rip),%rdi
call   1030 <printf@plt>
jmp    1126 <main+0x16>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    0x8(%rsi),%rax
cmpb   $0x0,(%rax)
je     114c <main+0x3c>
mov    %rsi,%rbx
lea    0xed9(%rip),%r14
nopw   0x0(%rax,%rax,1)
lea    0x1(%rax),%rcx
mov    %rcx,0x8(%rbx)
movsbl (%rax),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
mov    0x8(%rbx),%rax
cmpb   $0x0,(%rax)
jne    1130 <main+0x20>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%c \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
br label %6
6: ; preds = %12, %2
%7 = load i8**, i8*** %5
%8 = getelementptr inbounds i8*, i8** %7, i64 1
%9 = load i8*, i8** %8
%10 = load i8, i8* %9
%11 = icmp ne i8 %10, 0
br i1 %11, label %12, label %20
12: ; preds = %6
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 1
%15 = load i8*, i8** %14
%16 = getelementptr inbounds i8, i8* %15, i32 1
store i8* %16, i8** %14
%17 = load i8, i8* %15
%18 = sext i8 %17 to i32
%19 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %18)
br label %6
20: ; preds = %6
%21 = load i32, i32* %3
ret i32 %21
}

LLVM IR (-O2):
@.str = [4 x i8] c"%c \00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 0
br i1 %6, label %16, label %7
7: ; preds = %2, %7
%8 = phi i8* [ %13, %7 ], [ %4, %2 ]
%9 = getelementptr inbounds i8, i8* %8, i64 1
store i8* %9, i8** %3
%10 = load i8, i8* %8
%11 = sext i8 %10 to i32
%12 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = load i8*, i8** %3
%14 = load i8, i8* %13
%15 = icmp eq i8 %14, 0
br i1 %15, label %16, label %7
16: ; preds = %7, %2
ret i32 0
}
/* Variables and functions */
int getpid();
int /*<<< orphan*/ printf(char *, int);
int main() {
  printf("pid:%d\n", getpid());
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [8 x i8] c"pid:%d\0A\00"
define i32 @main() {
%1 = tail call i32 (...) @getpid()
%2 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}
/* Variables and functions */
unsigned long pow(int, int);
unsigned long square(int s) {
  if (s < 1 || s > 64)
    return 0;
  return pow(2, s - 1);
}


x86 assembly (clang, -O0):
<square>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0xc(%rbp)
cmpl   $0x1,-0xc(%rbp)
jl     112f <square+0x1f>
cmpl   $0x40,-0xc(%rbp)
jle    113c <square+0x2c>
movq   $0x0,-0x8(%rbp)
jmp    1150 <square+0x40>
mov    -0xc(%rbp),%esi
sub    $0x1,%esi
mov    $0x2,%edi
call   1030 <pow@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<square>:
mov    %edi,%esi
lea    -0x41(%rsi),%eax
cmp    $0xffffffc0,%eax
jae    111d <square+0xd>
xor    %eax,%eax
ret
add    $0xffffffff,%esi
mov    $0x2,%edi
jmp    1030 <pow@plt>

LLVM IR (-O0):
define i64 @square(i32 %0) {
%2 = alloca i64
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp slt i32 %4, 1
br i1 %5, label %9, label %6
6: ; preds = %1
%7 = load i32, i32* %3
%8 = icmp sgt i32 %7, 64
br i1 %8, label %9, label %10
9: ; preds = %6, %1
store i64 0, i64* %2
br label %14
10: ; preds = %6
%11 = load i32, i32* %3
%12 = sub nsw i32 %11, 1
%13 = call i64 @pow(i32 2, i32 %12)
store i64 %13, i64* %2
br label %14
14: ; preds = %10, %9
%15 = load i64, i64* %2
ret i64 %15
}

LLVM IR (-O2):
define i64 @square(i32 %0) {
%2 = add i32 %0, -65
%3 = icmp ult i32 %2, -64
br i1 %3, label %7, label %4
4: ; preds = %1
%5 = add nsw i32 %0, -1
%6 = tail call i64 @pow(i32 2, i32 %5)
br label %7
7: ; preds = %1, %4
%8 = phi i64 [ %6, %4 ], [ 0, %1 ]
ret i64 %8
}
/* Variables and functions */
int /*<<< orphan*/ con_flush();
int /*<<< orphan*/ con_newline();
void DisplayEnd(void) {
  con_newline();
  con_flush();
}


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

x86 assembly (clang, -O2):
<DisplayEnd>:
push   %rax
xor    %eax,%eax
call   1040 <con_newline@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <con_flush@plt>

LLVM IR (-O0):
define void @DisplayEnd() {
%1 = call i32 (...) @con_newline()
%2 = call i32 (...) @con_flush()
ret void
}

LLVM IR (-O2):
define void @DisplayEnd() {
%1 = tail call i32 (...) @con_newline()
%2 = tail call i32 (...) @con_flush()
ret void
}
const char *librtaAbout_MiniNotice(void) {
  return "Copyright (c) 2017 Cisco and/or its affiliates.\n";
}


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

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

LLVM IR (-O0):
@.str = [49 x i8] c"Copyright (c) 2017 Cisco and/or its affiliates.\0A\00"
define i8* @librtaAbout_MiniNotice() {
ret i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [49 x i8] c"Copyright (c) 2017 Cisco and/or its affiliates.\0A\00"
define i8* @librtaAbout_MiniNotice() {
ret i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0)
}
void rop3_240_1_0(unsigned char *D, unsigned char S, unsigned char T) {
  *D = (T & (~S)) | (*D & S);
}


x86 assembly (clang, -O0):
<rop3_240_1_0>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %sil,%cl
mov    %rdi,-0x8(%rbp)
mov    %cl,-0x9(%rbp)
mov    %al,-0xa(%rbp)
movzbl -0xa(%rbp),%eax
movzbl -0x9(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl (%rcx),%ecx
movzbl -0x9(%rbp),%edx
and    %edx,%ecx
or     %ecx,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<rop3_240_1_0>:
mov    (%rdi),%al
xor    %dl,%al
and    %sil,%al
xor    %dl,%al
mov    %al,(%rdi)
ret

LLVM IR (-O0):
define void @rop3_240_1_0(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* %6
%8 = zext i8 %7 to i32
%9 = load i8, i8* %5
%10 = zext i8 %9 to i32
%11 = xor i32 %10, -1
%12 = and i32 %8, %11
%13 = load i8*, i8** %4
%14 = load i8, i8* %13
%15 = zext i8 %14 to i32
%16 = load i8, i8* %5
%17 = zext i8 %16 to i32
%18 = and i32 %15, %17
%19 = or i32 %12, %18
%20 = trunc i32 %19 to i8
%21 = load i8*, i8** %4
store i8 %20, i8* %21
ret void
}

LLVM IR (-O2):
define void @rop3_240_1_0(i8* nocapture %0, i8 zeroext %1, i8 zeroext %2) {
%4 = xor i8 %1, -1
%5 = and i8 %4, %2
%6 = load i8, i8* %0
%7 = and i8 %6, %1
%8 = or i8 %7, %5
store i8 %8, i8* %0
ret void
}
void lqgbpsCounter(void *clientObject __attribute__((unused)),
                   float distanceSquared __attribute__((unused)),
                   void *clientQueryState) {
  (*(int *)clientQueryState)++;
}


x86 assembly (clang, -O0):
<lqgbpsCounter>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<lqgbpsCounter>:
addl   $0x1,(%rsi)
ret

LLVM IR (-O0):
define void @lqgbpsCounter(i8* %0, float %1, i8* %2) {
%4 = alloca i8*
%5 = alloca float
%6 = alloca i8*
store i8* %0, i8** %4
store float %1, float* %5
store i8* %2, i8** %6
%7 = load i8*, i8** %6
%8 = bitcast i8* %7 to i32*
%9 = load i32, i32* %8
%10 = add nsw i32 %9, 1
store i32 %10, i32* %8
ret void
}

LLVM IR (-O2):
define void @lqgbpsCounter(i8* nocapture readnone %0, float %1, i8* nocapture %2) {
%4 = bitcast i8* %2 to i32*
%5 = load i32, i32* %4
%6 = add nsw i32 %5, 1
store i32 %6, i32* %4
ret void
}
/* Variables and functions */
scalar_t__ ENOENT;
scalar_t__ errno;
scalar_t__ mount(char *, char *, char *, int /*<<< orphan*/,
                 int /*<<< orphan*/);
int main() {
  if (mount("/dev/non-existant-device", "/mnt", "ext2", 0, 0)) {
    if (errno != ENOENT) {
      return 1;
    }
    return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
lea    0xeec(%rip),%rsi
lea    0xeea(%rip),%rdx
xor    %r8d,%r8d
mov    %r8d,%ecx
call   1030 <mount@plt>
cmp    $0x0,%rax
je     117b <main+0x6b>
mov    0x2e90(%rip),%rax
mov    (%rax),%rax
mov    0x2e76(%rip),%rcx
cmp    (%rcx),%rax
je     116f <main+0x5f>
movl   $0x1,-0x4(%rbp)
jmp    1182 <main+0x72>
movl   $0x0,-0x4(%rbp)
jmp    1182 <main+0x72>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
lea    0xefa(%rip),%rsi
lea    0xef8(%rip),%rdx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1030 <mount@plt>
test   %rax,%rax
sete   %al
mov    0x2ea3(%rip),%rcx
mov    (%rcx),%rcx
mov    0x2e89(%rip),%rdx
cmp    (%rdx),%rcx
setne  %cl
or     %al,%cl
movzbl %cl,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [25 x i8] c"/dev/non-existant-device\00"
@.str.1 = [5 x i8] c"/mnt\00"
@.str.2 = [5 x i8] c"ext2\00"
@errno = global i64 0
@ENOENT = global i64 0
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i64 @mount(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 0, i32 0)
%3 = icmp ne i64 %2, 0
br i1 %3, label %4, label %10
4: ; preds = %0
%5 = load i64, i64* @errno
%6 = load i64, i64* @ENOENT
%7 = icmp ne i64 %5, %6
br i1 %7, label %8, label %9
8: ; preds = %4
store i32 1, i32* %1
br label %11
9: ; preds = %4
store i32 0, i32* %1
br label %11
10: ; preds = %0
store i32 1, i32* %1
br label %11
11: ; preds = %10, %9, %8
%12 = load i32, i32* %1
ret i32 %12
}

LLVM IR (-O2):
@.str = [25 x i8] c"/dev/non-existant-device\00"
@.str.1 = [5 x i8] c"/mnt\00"
@.str.2 = [5 x i8] c"ext2\00"
@errno = global i64 0
@ENOENT = global i64 0
define i32 @main() {
%1 = tail call i64 @mount(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 0, i32 0)
%2 = icmp eq i64 %1, 0
%3 = load i64, i64* @errno
%4 = load i64, i64* @ENOENT
%5 = icmp ne i64 %3, %4
%6 = select i1 %2, i1 true, i1 %5
%7 = zext i1 %6 to i32
ret i32 %7
}
void val_delete_cart(void *v) { (void)v; }


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

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

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

LLVM IR (-O2):
define void @val_delete_cart(i8* nocapture %0) {
ret void
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int /*<<< orphan*/ ASSERT(int);
int /*<<< orphan*/ _HibernateWriteComplete();
void HibernateRTCTrimSet(uint32_t ui32Trim) {
  ASSERT(ui32Trim < 0x10000);
  (*((volatile uint32_t *)(0x400FC024))) = ui32Trim;
  _HibernateWriteComplete();
}


x86 assembly (clang, -O0):
<HibernateRTCTrimSet>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x10000,-0x4(%rbp)
setl   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <ASSERT@plt>
mov    -0x4(%rbp),%ecx
mov    $0x400fc024,%eax
mov    %ecx,(%rax)
mov    $0x0,%al
call   1030 <_HibernateWriteComplete@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<HibernateRTCTrimSet>:
push   %rbx
mov    %edi,%ebx
xor    %edi,%edi
cmp    $0x10000,%ebx
setl   %dil
call   1040 <ASSERT@plt>
mov    %ebx,0x400fc024
xor    %eax,%eax
pop    %rbx
jmp    1030 <_HibernateWriteComplete@plt>

LLVM IR (-O0):
define void @HibernateRTCTrimSet(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp slt i32 %3, 65536
%5 = zext i1 %4 to i32
%6 = call i32 @ASSERT(i32 %5)
%7 = load i32, i32* %2
store volatile i32 %7, i32* inttoptr (i64 1074774052 to i32*)
%8 = call i32 (...) @_HibernateWriteComplete()
ret void
}

LLVM IR (-O2):
define void @HibernateRTCTrimSet(i32 %0) {
%2 = icmp slt i32 %0, 65536
%3 = zext i1 %2 to i32
%4 = tail call i32 @ASSERT(i32 %3)
store volatile i32 %0, i32* inttoptr (i64 1074774052 to i32*)
%5 = tail call i32 (...) @_HibernateWriteComplete()
ret void
}
int shell_run(struct device *dev) { return 0; }


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

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

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

LLVM IR (-O2):
%struct.device = type opaque
define i32 @shell_run(%struct.device* nocapture readnone %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ _IO(int, int);
scalar_t__ ioctl(int, int /*<<< orphan*/, int *);
int blkdev_is_misaligned(int fd) {
  int aligned;
  if (ioctl(fd, _IO(0x12, 122), &aligned) < 0)
    return 0;
  return aligned != 0 ? 1 : 0;
}


x86 assembly (clang, -O0):
<blkdev_is_misaligned>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    $0x12,%edi
mov    $0x7a,%esi
call   1030 <_IO@plt>
mov    -0x10(%rbp),%edi
mov    %eax,%esi
lea    -0xc(%rbp),%rdx
call   1040 <ioctl@plt>
cmp    $0x0,%rax
jge    1164 <blkdev_is_misaligned+0x44>
movl   $0x0,-0x4(%rbp)
jmp    1177 <blkdev_is_misaligned+0x57>
mov    -0xc(%rbp),%edx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<blkdev_is_misaligned>:
push   %rbx
sub    $0x10,%rsp
mov    %edi,%ebx
mov    $0x12,%edi
mov    $0x7a,%esi
call   1030 <_IO@plt>
lea    0xc(%rsp),%rdx
mov    %ebx,%edi
mov    %eax,%esi
call   1040 <ioctl@plt>
test   %rax,%rax
setns  %al
cmpl   $0x0,0xc(%rsp)
setne  %cl
and    %al,%cl
movzbl %cl,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @blkdev_is_misaligned(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
%5 = load i32, i32* %3
%6 = call i32 @_IO(i32 18, i32 122)
%7 = call i64 @ioctl(i32 %5, i32 %6, i32* %4)
%8 = icmp slt i64 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %1
store i32 0, i32* %2
br label %15
10: ; preds = %1
%11 = load i32, i32* %4
%12 = icmp ne i32 %11, 0
%13 = zext i1 %12 to i64
%14 = select i1 %12, i32 1, i32 0
store i32 %14, i32* %2
br label %15
15: ; preds = %10, %9
%16 = load i32, i32* %2
ret i32 %16
}

LLVM IR (-O2):
define i32 @blkdev_is_misaligned(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = tail call i32 @_IO(i32 18, i32 122)
%5 = call i64 @ioctl(i32 %0, i32 %4, i32* %2)
%6 = icmp sgt i64 %5, -1
%7 = load i32, i32* %2
%8 = icmp ne i32 %7, 0
%9 = select i1 %6, i1 %8, i1 false
%10 = zext i1 %9 to i32
ret i32 %10
}
/* Type definitions */
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
int /*<<< orphan*/ picint_common(int /*<<< orphan*/, int);
void picintlevel(uint16_t num) { picint_common(num, 1); }


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

x86 assembly (clang, -O2):
<picintlevel>:
mov    $0x1,%esi
jmp    1030 <picint_common@plt>

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

LLVM IR (-O2):
define void @picintlevel(i32 %0) {
%2 = tail call i32 @picint_common(i32 %0, i32 1)
ret void
}
/* Variables and functions */
int atoi(char *);
int /*<<< orphan*/ bar(int);
int /*<<< orphan*/ foo(int);
int main(int argc, char *argv[]) {
  int n = 5;
  if (argc > 1)
    n = atoi(argv[1]);
  foo(n);
  bar(n);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x5,-0x14(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    1167 <main+0x37>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
call   1040 <foo@plt>
mov    -0x14(%rbp),%edi
call   1030 <bar@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x5,%ebx
cmp    $0x2,%edi
jl     1146 <main+0x16>
mov    0x8(%rsi),%rdi
call   1050 <atoi@plt>
mov    %eax,%ebx
mov    %ebx,%edi
call   1040 <foo@plt>
mov    %ebx,%edi
call   1030 <bar@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 5, i32* %6
%7 = load i32, i32* %4
%8 = icmp sgt i32 %7, 1
br i1 %8, label %9, label %14
9: ; preds = %2
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 1
%12 = load i8*, i8** %11
%13 = call i32 @atoi(i8* %12)
store i32 %13, i32* %6
br label %14
14: ; preds = %9, %2
%15 = load i32, i32* %6
%16 = call i32 @foo(i32 %15)
%17 = load i32, i32* %6
%18 = call i32 @bar(i32 %17)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32 @atoi(i8* %6)
br label %8
8: ; preds = %4, %2
%9 = phi i32 [ %7, %4 ], [ 5, %2 ]
%10 = tail call i32 @foo(i32 %9)
%11 = tail call i32 @bar(i32 %9)
ret i32 0
}
float *vec3_one(float *result) {
  result[0] = 1.0f;
  result[1] = 1.0f;
  result[2] = 1.0f;
  return result;
}


x86 assembly (clang, -O0):
<vec3_one>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movss  0xeec(%rip),%xmm0
movss  %xmm0,(%rax)
mov    -0x8(%rbp),%rax
movss  0xedc(%rip),%xmm0
movss  %xmm0,0x4(%rax)
mov    -0x8(%rbp),%rax
movss  0xecb(%rip),%xmm0
movss  %xmm0,0x8(%rax)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<vec3_one>:
mov    %rdi,%rax
movabs $0x3f8000003f800000,%rcx
mov    %rcx,(%rdi)
movl   $0x3f800000,0x8(%rdi)
ret

LLVM IR (-O0):
define float* @vec3_one(float* %0) {
%2 = alloca float*
store float* %0, float** %2
%3 = load float*, float** %2
%4 = getelementptr inbounds float, float* %3, i64 0
store float 1.000000e+00, float* %4
%5 = load float*, float** %2
%6 = getelementptr inbounds float, float* %5, i64 1
store float 1.000000e+00, float* %6
%7 = load float*, float** %2
%8 = getelementptr inbounds float, float* %7, i64 2
store float 1.000000e+00, float* %8
%9 = load float*, float** %2
ret float* %9
}

LLVM IR (-O2):
define float* @vec3_one(float* returned writeonly %0) {
store float 1.000000e+00, float* %0
%2 = getelementptr inbounds float, float* %0, i64 1
store float 1.000000e+00, float* %2
%3 = getelementptr inbounds float, float* %0, i64 2
store float 1.000000e+00, float* %3
ret float* %0
}
void _M2_StrLib_finish(__attribute__((unused)) int argc,
                       __attribute__((unused)) char *argv[]) {}


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

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

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

LLVM IR (-O2):
define void @_M2_StrLib_finish(i32 %0, i8** nocapture %1) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int listen(int, int);
int /*<<< orphan*/ perror(char *);
void Listen(int listenfd, int listenQ) {
  if (listen(listenfd, listenQ) == -1) {
    perror("listen");
    exit(1);
  }
}


x86 assembly (clang, -O0):
<Listen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <listen@plt>
cmp    $0xffffffff,%eax
jne    1168 <Listen+0x38>
lea    0xea7(%rip),%rdi
call   1040 <perror@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Listen>:
push   %rax
call   1030 <listen@plt>
cmp    $0xffffffff,%eax
je     113d <Listen+0xd>
pop    %rax
ret
lea    0xebc(%rip),%rdi
call   1040 <perror@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"listen\00"
define void @Listen(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = call i32 @listen(i32 %5, i32 %6)
%8 = icmp eq i32 %7, -1
br i1 %8, label %9, label %12
9: ; preds = %2
%10 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @exit(i32 1)
unreachable
12: ; preds = %2
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"listen\00"
define void @Listen(i32 %0, i32 %1) {
%3 = tail call i32 @listen(i32 %0, i32 %1)
%4 = icmp eq i32 %3, -1
br i1 %4, label %5, label %8
5: ; preds = %2
%6 = tail call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @exit(i32 1)
unreachable
8: ; preds = %2
ret void
}
/* Type definitions */
typedef int uint8_t;
typedef int int32_t;

/* Variables and functions */
int32_t char_to_int16(uint8_t *c) {
  int32_t ret = 0;
  ret = c[0];
  ret |= c[1] << 8;
  return ret;
}


x86 assembly (clang, -O0):
<char_to_int16>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%eax
shl    $0x8,%eax
or     -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<char_to_int16>:
mov    0x4(%rdi),%eax
shl    $0x8,%eax
or     (%rdi),%eax
ret

LLVM IR (-O0):
define i32 @char_to_int16(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
store i32 0, i32* %3
%4 = load i32*, i32** %2
%5 = getelementptr inbounds i32, i32* %4, i64 0
%6 = load i32, i32* %5
store i32 %6, i32* %3
%7 = load i32*, i32** %2
%8 = getelementptr inbounds i32, i32* %7, i64 1
%9 = load i32, i32* %8
%10 = shl i32 %9, 8
%11 = load i32, i32* %3
%12 = or i32 %11, %10
store i32 %12, i32* %3
%13 = load i32, i32* %3
ret i32 %13
}

LLVM IR (-O2):
define i32 @char_to_int16(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = getelementptr inbounds i32, i32* %0, i64 1
%4 = load i32, i32* %3
%5 = shl i32 %4, 8
%6 = or i32 %5, %2
ret i32 %6
}
int f2(int x) {
  x &= 0xff;
  x += 0x5400;
  x |= 0x4400;
  return x;
}


x86 assembly (clang, -O0):
<f2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xff,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x5400,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
or     $0x4400,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f2>:
movzbl %dil,%eax
or     $0x5400,%eax
ret

LLVM IR (-O0):
define i32 @f2(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 255
store i32 %4, i32* %2
%5 = load i32, i32* %2
%6 = add nsw i32 %5, 21504
store i32 %6, i32* %2
%7 = load i32, i32* %2
%8 = or i32 %7, 17408
store i32 %8, i32* %2
%9 = load i32, i32* %2
ret i32 %9
}

LLVM IR (-O2):
define i32 @f2(i32 %0) {
%2 = and i32 %0, 255
%3 = or i32 %2, 21504
ret i32 %3
}
int mark_count() { return 38; }


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

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

LLVM IR (-O0):
define i32 @mark_count() {
ret i32 38
}

LLVM IR (-O2):
define i32 @mark_count() {
ret i32 38
}
/* Variables and functions */
int /*<<< orphan*/ mem_list_add(void *);
void *m_freelater(void *ptr) {
  if (ptr != NULL)
    mem_list_add(ptr);
  return ptr;
}


x86 assembly (clang, -O0):
<m_freelater>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1130 <m_freelater+0x20>
mov    -0x8(%rbp),%rdi
call   1030 <mem_list_add@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<m_freelater>:
push   %rbx
mov    %rdi,%rbx
test   %rdi,%rdi
je     1121 <m_freelater+0x11>
mov    %rbx,%rdi
call   1030 <mem_list_add@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @m_freelater(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = icmp ne i8* %3, null
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i8*, i8** %2
%7 = call i32 @mem_list_add(i8* %6)
br label %8
8: ; preds = %5, %1
%9 = load i8*, i8** %2
ret i8* %9
}

LLVM IR (-O2):
define i8* @m_freelater(i8* returned %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @mem_list_add(i8* %0)
br label %5
5: ; preds = %3, %1
ret i8* %0
}
/* Variables and functions */
float frexp(float, int *);
float Float_frexp(float x, int *exponent) { return frexp(x, exponent); }


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

x86 assembly (clang, -O2):
<Float_frexp>:
jmp    1030 <frexp@plt>

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

LLVM IR (-O2):
define float @Float_frexp(float %0, i32* nocapture %1) {
%3 = tail call float @frexp(float %0, i32* %1)
ret float %3
}
int sq(int a) {
  int i;
  for (i = 0; (i + 1) * (i + 1) <= a; i++)
    ;
  return i;
}


x86 assembly (clang, -O0):
<sq>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    -0x8(%rbp),%ecx
add    $0x1,%ecx
imul   %ecx,%eax
cmp    -0x4(%rbp),%eax
jg     1139 <sq+0x39>
jmp    112b <sq+0x2b>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    110e <sq+0xe>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sq>:
mov    $0xffffffff,%eax
cs nopw 0x0(%rax,%rax,1)
nop
lea    0x2(%rax),%ecx
imul   %ecx,%ecx
add    $0x1,%eax
cmp    %edi,%ecx
jle    1110 <sq+0x10>
ret

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

LLVM IR (-O2):
define i32 @sq(i32 %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i32 [ 0, %1 ], [ %4, %2 ]
%4 = add nuw nsw i32 %3, 1
%5 = mul nsw i32 %4, %4
%6 = icmp sgt i32 %5, %0
br i1 %6, label %7, label %2
7: ; preds = %2
ret i32 %3
}