xunge/DecIR huggingface dataset:
/* Variables and functions */
scalar_t__ mock(char *);
char *cf_s_pinbound(char *s) { return (char *)mock(s); }


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

x86 assembly (clang, -O2):
<cf_s_pinbound>:
jmp    1030 <mock@plt>

LLVM IR (-O0):
define i8* @cf_s_pinbound(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i64 @mock(i8* %3)
%5 = inttoptr i64 %4 to i8*
ret i8* %5
}

LLVM IR (-O2):
define i8* @cf_s_pinbound(i8* %0) {
%2 = tail call i64 @mock(i8* %0)
%3 = inttoptr i64 %2 to i8*
ret i8* %3
}
void pcre2modif_front_pattern_modif_rear() {}


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

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

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

LLVM IR (-O2):
define void @pcre2modif_front_pattern_modif_rear() {
ret void
}
/* Type definitions */
typedef union U {
  int dummy;
} U;
struct R {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ abort();
scalar_t__ bar(struct R *, struct R *);
scalar_t__ foo(union U *, union U *);
int main() {
  int a[3];
  if (foo((union U *)&a[0], (union U *)&a[0]) != 0)
    abort();
  if (bar((struct R *)&a[1], (struct R *)&a[0]) != 0)
    abort();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x10(%rbp),%rdi
lea    -0x10(%rbp),%rsi
call   1050 <foo@plt>
cmp    $0x0,%rax
je     115d <main+0x2d>
mov    $0x0,%al
call   1030 <abort@plt>
lea    -0x10(%rbp),%rdi
add    $0x4,%rdi
lea    -0x10(%rbp),%rsi
call   1040 <bar@plt>
cmp    $0x0,%rax
je     117f <main+0x4f>
mov    $0x0,%al
call   1030 <abort@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xc(%rsp),%rdi
mov    %rdi,%rsi
call   1050 <foo@plt>
test   %rax,%rax
jne    1161 <main+0x31>
lea    0x10(%rsp),%rdi
lea    0xc(%rsp),%rsi
call   1040 <bar@plt>
test   %rax,%rax
jne    1161 <main+0x31>
xor    %eax,%eax
add    $0x18,%rsp
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
%union.U = type { i32 }
%struct.R = type { i32 }
define i32 @main() {
%1 = alloca i32
%2 = alloca [3 x i32]
store i32 0, i32* %1
%3 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 0
%4 = bitcast i32* %3 to %union.U*
%5 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 0
%6 = bitcast i32* %5 to %union.U*
%7 = call i64 @foo(%union.U* %4, %union.U* %6)
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %0
%10 = call i32 (...) @abort()
unreachable
11: ; preds = %0
%12 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 1
%13 = bitcast i32* %12 to %struct.R*
%14 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 0
%15 = bitcast i32* %14 to %struct.R*
%16 = call i64 @bar(%struct.R* %13, %struct.R* %15)
%17 = icmp ne i64 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %11
%19 = call i32 (...) @abort()
unreachable
20: ; preds = %11
ret i32 0
}

LLVM IR (-O2):
%union.U = type { i32 }
%struct.R = type { i32 }
define i32 @main() {
%1 = alloca [3 x i32]
%2 = bitcast [3 x i32]* %1 to i8*
%3 = bitcast [3 x i32]* %1 to %union.U*
%4 = call i64 @foo(%union.U* %3, %union.U* %3)
%5 = icmp eq i64 %4, 0
br i1 %5, label %8, label %6
6: ; preds = %0
%7 = call i32 (...) @abort()
unreachable
8: ; preds = %0
%9 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 1
%10 = bitcast i32* %9 to %struct.R*
%11 = bitcast [3 x i32]* %1 to %struct.R*
%12 = call i64 @bar(%struct.R* %10, %struct.R* %11)
%13 = icmp eq i64 %12, 0
br i1 %13, label %16, label %14
14: ; preds = %8
%15 = call i32 (...) @abort()
unreachable
16: ; preds = %8
ret i32 0
}
int fun759() { return 759; }


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

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

LLVM IR (-O0):
define i32 @fun759() {
ret i32 759
}

LLVM IR (-O2):
define i32 @fun759() {
ret i32 759
}
void foo187() {}


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

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

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

LLVM IR (-O2):
define void @foo187() {
ret void
}
/* Type definitions */
struct sockaddr_in {
  int /*<<< orphan*/ sin_addr;
};
struct sockaddr {
  int dummy;
};
typedef int /*<<< orphan*/ client;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int kaccept(int, struct sockaddr *, int *);
int /*<<< orphan*/ stderr;
int socket_server_wait(int sd) {
  int nsd, clientlen;
  struct sockaddr_in client;
  unsigned char *p;
  clientlen = sizeof(client);
  fprintf(stderr, "wait for client...\n");
  nsd = kaccept(sd, (struct sockaddr *)&client, &clientlen);
  p = (unsigned char *)&client.sin_addr;
  return nsd;
}


x86 assembly (clang, -O0):
<socket_server_wait>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x4,-0xc(%rbp)
mov    0x2ea7(%rip),%rax
mov    (%rax),%edi
lea    0xebe(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x4(%rbp),%edi
lea    -0x10(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1040 <kaccept@plt>
mov    %eax,-0x8(%rbp)
lea    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<socket_server_wait>:
push   %rbx
sub    $0x10,%rsp
mov    %edi,%ebx
movl   $0x4,0x4(%rsp)
mov    0x2eaa(%rip),%rax
mov    (%rax),%edi
lea    0xec1(%rip),%rsi
call   1030 <fprintf@plt>
lea    0x8(%rsp),%rsi
lea    0x4(%rsp),%rdx
mov    %ebx,%edi
call   1040 <kaccept@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.sockaddr_in = type { i32 }
%struct.sockaddr = type { i32 }
@stderr = global i32 0
@.str = [20 x i8] c"wait for client...\0A\00"
define i32 @socket_server_wait(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca %struct.sockaddr_in
%6 = alloca i8*
store i32 %0, i32* %2
store i32 4, i32* %4
%7 = load i32, i32* @stderr
%8 = call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%9 = load i32, i32* %2
%10 = bitcast %struct.sockaddr_in* %5 to %struct.sockaddr*
%11 = call i32 @kaccept(i32 %9, %struct.sockaddr* %10, i32* %4)
store i32 %11, i32* %3
%12 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %5, i32 0, i32 0
%13 = bitcast i32* %12 to i8*
store i8* %13, i8** %6
%14 = load i32, i32* %3
ret i32 %14
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32 }
%struct.sockaddr = type { i32 }
@stderr = global i32 0
@.str = [20 x i8] c"wait for client...\0A\00"
define i32 @socket_server_wait(i32 %0) {
%2 = alloca i32
%3 = alloca %struct.sockaddr_in
%4 = bitcast i32* %2 to i8*
%5 = bitcast %struct.sockaddr_in* %3 to i8*
store i32 4, i32* %2
%6 = load i32, i32* @stderr
%7 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%8 = bitcast %struct.sockaddr_in* %3 to %struct.sockaddr*
%9 = call i32 @kaccept(i32 %0, %struct.sockaddr* %8, i32* %2)
ret i32 %9
}
/* Variables and functions */
scalar_t__ getParLong(long *);
int /*<<< orphan*/ sleep(unsigned int);
void IF_sleep(void) {
  long t;
  if (getParLong(&t))
    sleep((unsigned int)t);
}


x86 assembly (clang, -O0):
<IF_sleep>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x8(%rbp),%rdi
call   1030 <getParLong@plt>
cmp    $0x0,%rax
je     1146 <IF_sleep+0x26>
mov    -0x8(%rbp),%rax
mov    %eax,%edi
call   1040 <sleep@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<IF_sleep>:
push   %rax
mov    %rsp,%rdi
call   1030 <getParLong@plt>
test   %rax,%rax
je     1136 <IF_sleep+0x16>
mov    (%rsp),%edi
call   1040 <sleep@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @IF_sleep() {
%1 = alloca i64
%2 = call i64 @getParLong(i64* %1)
%3 = icmp ne i64 %2, 0
br i1 %3, label %4, label %8
4: ; preds = %0
%5 = load i64, i64* %1
%6 = trunc i64 %5 to i32
%7 = call i32 @sleep(i32 %6)
br label %8
8: ; preds = %4, %0
ret void
}

LLVM IR (-O2):
define void @IF_sleep() {
%1 = alloca i64
%2 = bitcast i64* %1 to i8*
%3 = call i64 @getParLong(i64* %1)
%4 = icmp eq i64 %3, 0
br i1 %4, label %9, label %5
5: ; preds = %0
%6 = load i64, i64* %1
%7 = trunc i64 %6 to i32
%8 = call i32 @sleep(i32 %7)
br label %9
9: ; preds = %5, %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int main() {
  typedef enum { red, green, blue } Color;
  Color pants = green;
  switch (pants) {
  case red:
    printf("red pants are hip\n");
    break;
  case green:
    printf("green pants are weird\n");
    break;
  default:
    printf("yet another color\n");
  }
  printf("pants = %d\n", pants);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
test   %eax,%eax
je     114a <main+0x3a>
jmp    1139 <main+0x29>
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
je     115d <main+0x4d>
jmp    1170 <main+0x60>
lea    0xeaf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    117e <main+0x6e>
lea    0xeaf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    117e <main+0x6e>
lea    0xeb3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
lea    0xeb5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [19 x i8] c"red pants are hip\0A\00"
@.str.1 = [23 x i8] c"green pants are weird\0A\00"
@.str.2 = [19 x i8] c"yet another color\0A\00"
@.str.3 = [12 x i8] c"pants = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 1, i32* %2
%3 = load i32, i32* %2
switch i32 %3, label %8 [
i32 0, label %4
i32 1, label %6
]
4: ; preds = %0
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
br label %10
6: ; preds = %0
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
br label %10
8: ; preds = %0
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
br label %10
10: ; preds = %8, %6, %4
%11 = load i32, i32* %2
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i32 %11)
%13 = load i32, i32* %1
ret i32 %13
}

LLVM IR (-O2):
@.str.3 = [12 x i8] c"pants = %d\0A\00"
@str = [22 x i8] c"green pants are weird\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i32 1)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ uint16_t;
typedef int /*<<< orphan*/ ret;

/* Variables and functions */
int /*<<< orphan*/ memcpy(int /*<<< orphan*/ *, int /*<<< orphan*/ *, int);
uint16_t load_u16(uint8_t *buf) {
  uint16_t ret;
  memcpy(&ret, buf, sizeof(ret));
  return ret;
}


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

x86 assembly (clang, -O2):
<load_u16>:
push   %rax
mov    %rdi,%rsi
lea    0x4(%rsp),%rdi
mov    $0x4,%edx
call   1030 <memcpy@plt>
mov    0x4(%rsp),%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @load_u16(i32* %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = call i32 @memcpy(i32* %2, i32* %0, i32 4)
%5 = load i32, i32* %2
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ test_obs_x264_parse_options();
int main() {
  test_obs_x264_parse_options();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @test_obs_x264_parse_options()
ret i32 0
}
extern void flush_tlb_pgtables(struct mm_struct *mm, unsigned long start,
                               unsigned long end) {}


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

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

LLVM IR (-O0):
%struct.mm_struct = type opaque
define void @flush_tlb_pgtables(%struct.mm_struct* %0, i64 %1, i64 %2) {
%4 = alloca %struct.mm_struct*
%5 = alloca i64
%6 = alloca i64
store %struct.mm_struct* %0, %struct.mm_struct** %4
store i64 %1, i64* %5
store i64 %2, i64* %6
ret void
}

LLVM IR (-O2):
%struct.mm_struct = type opaque
define void @flush_tlb_pgtables(%struct.mm_struct* nocapture %0, i64 %1, i64 %2) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
int /*<<< orphan*/ htobe16(int /*<<< orphan*/);
uint16_t jet_htobe16(uint16_t host_endian_16bits) {
  return htobe16(host_endian_16bits);
}


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

x86 assembly (clang, -O2):
<jet_htobe16>:
jmp    1030 <htobe16@plt>

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

LLVM IR (-O2):
define i32 @jet_htobe16(i32 %0) {
%2 = tail call i32 @htobe16(i32 %0)
ret i32 %2
}
int main(void) { return (10 >= 20) + (20 >= 20) + (30 >= 20); }


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

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 2
}
/* Type definitions */
struct cec_msg {
  int len;
  int *msg;
};
typedef int __u8;

/* Variables and functions */
void cec_ops_vendor_command(const struct cec_msg *msg, __u8 *size,
                            const __u8 **vendor_cmd) {
  *size = msg->len - 2;
  if (*size > 14)
    *size = 14;
  *vendor_cmd = msg->msg + 2;
}


x86 assembly (clang, -O0):
<cec_ops_vendor_command>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%ecx
sub    $0x2,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
cmpl   $0xe,(%rax)
jle    1136 <cec_ops_vendor_command+0x36>
mov    -0x10(%rbp),%rax
movl   $0xe,(%rax)
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rcx
add    $0x8,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<cec_ops_vendor_command>:
mov    (%rdi),%eax
lea    -0x2(%rax),%ecx
cmp    $0x11,%eax
mov    $0xe,%eax
cmovl  %ecx,%eax
mov    %eax,(%rsi)
mov    0x8(%rdi),%rax
add    $0x8,%rax
mov    %rax,(%rdx)
ret

LLVM IR (-O0):
%struct.cec_msg = type { i32, i32* }
define void @cec_ops_vendor_command(%struct.cec_msg* %0, i32* %1, i32** %2) {
%4 = alloca %struct.cec_msg*
%5 = alloca i32*
%6 = alloca i32**
store %struct.cec_msg* %0, %struct.cec_msg** %4
store i32* %1, i32** %5
store i32** %2, i32*** %6
%7 = load %struct.cec_msg*, %struct.cec_msg** %4
%8 = getelementptr inbounds %struct.cec_msg, %struct.cec_msg* %7, i32 0, i32 0
%9 = load i32, i32* %8
%10 = sub nsw i32 %9, 2
%11 = load i32*, i32** %5
store i32 %10, i32* %11
%12 = load i32*, i32** %5
%13 = load i32, i32* %12
%14 = icmp sgt i32 %13, 14
br i1 %14, label %15, label %17
15: ; preds = %3
%16 = load i32*, i32** %5
store i32 14, i32* %16
br label %17
17: ; preds = %15, %3
%18 = load %struct.cec_msg*, %struct.cec_msg** %4
%19 = getelementptr inbounds %struct.cec_msg, %struct.cec_msg* %18, i32 0, i32 1
%20 = load i32*, i32** %19
%21 = getelementptr inbounds i32, i32* %20, i64 2
%22 = load i32**, i32*** %6
store i32* %21, i32** %22
ret void
}

LLVM IR (-O2):
%struct.cec_msg = type { i32, i32* }
define void @cec_ops_vendor_command(%struct.cec_msg* nocapture %0, i32* nocapture writeonly %1, i32** nocapture writeonly %2) {
%4 = getelementptr inbounds %struct.cec_msg, %struct.cec_msg* %0, i64 0, i32 0
%5 = load i32, i32* %4
%6 = add nsw i32 %5, -2
%7 = icmp sgt i32 %5, 16
%8 = select i1 %7, i32 14, i32 %6
store i32 %8, i32* %1
%9 = getelementptr inbounds %struct.cec_msg, %struct.cec_msg* %0, i64 0, i32 1
%10 = load i32*, i32** %9
%11 = getelementptr inbounds i32, i32* %10, i64 2
store i32* %11, i32** %2
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;
typedef int /*<<< orphan*/ int32_t;

/* Variables and functions */
int /*<<< orphan*/ __hsail_firstbit_u32(int /*<<< orphan*/);
uint32_t __hsail_firstbit_s32(int32_t src0) {
  uint32_t converted = src0 >= 0 ? src0 : ~src0;
  return __hsail_firstbit_u32(converted);
}


x86 assembly (clang, -O0):
<__hsail_firstbit_s32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jl     1130 <__hsail_firstbit_s32+0x20>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1139 <__hsail_firstbit_s32+0x29>
mov    -0x4(%rbp),%eax
xor    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <__hsail_firstbit_u32@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__hsail_firstbit_s32>:
mov    %edi,%eax
sar    $0x1f,%eax
xor    %eax,%edi
jmp    1030 <__hsail_firstbit_u32@plt>

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

LLVM IR (-O2):
define i32 @__hsail_firstbit_s32(i32 %0) {
%2 = ashr i32 %0, 31
%3 = xor i32 %2, %0
%4 = tail call i32 @__hsail_firstbit_u32(i32 %3)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
double ZeroArg() {
  printf("i'm a function without arguments.\n");
  return 123;
}


x86 assembly (clang, -O0):
<ZeroArg>:
push   %rbp
mov    %rsp,%rbp
lea    0xeed(%rip),%rdi
call   1030 <printf@plt>
movsd  0xed8(%rip),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<ZeroArg>:
push   %rax
lea    0xef0(%rip),%rdi
call   1030 <puts@plt>
movsd  0xedb(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
@.str = [35 x i8] c"i'm a function without arguments.\0A\00"
define double @ZeroArg() {
%1 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
ret double 1.230000e+02
}

LLVM IR (-O2):
@str = [34 x i8] c"i'm a function without arguments.\00"
define double @ZeroArg() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str, i64 0, i64 0))
ret double 1.230000e+02
}
/* Variables and functions */
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char);
int /*<<< orphan*/ stdout;
void twiddle(void) {
  static int t = -1;
  printf("%c\b", "|/-\\"[(++t) & 3]);
  fflush(stdout);
}


x86 assembly (clang, -O0):
<twiddle>:
push   %rbp
mov    %rsp,%rbp
mov    0x2f06(%rip),%eax
add    $0x1,%eax
mov    %eax,0x2efd(%rip)
and    $0x3,%eax
movslq %eax,%rcx
lea    0xec0(%rip),%rdi
lea    0xebd(%rip),%rax
movsbl (%rax,%rcx,1),%esi
call   1030 <printf@plt>
mov    0x2e89(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<twiddle>:
push   %rax
mov    0x2f09(%rip),%eax
add    $0x1,%eax
mov    %eax,0x2f00(%rip)
and    $0x3,%eax
lea    0xeca(%rip),%rcx
movsbl (%rax,%rcx,1),%esi
lea    0xebb(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e8f(%rip),%rax
mov    (%rax),%edi
pop    %rax
jmp    1040 <fflush@plt>

LLVM IR (-O0):
@twiddle.t = internal global i32 -1
@.str = [4 x i8] c"%c\08\00"
@.str.1 = [5 x i8] c"|/-\\\00"
@stdout = global i32 0
define void @twiddle() {
%1 = load i32, i32* @twiddle.t
%2 = add nsw i32 %1, 1
store i32 %2, i32* @twiddle.t
%3 = and i32 %2, 3
%4 = sext i32 %3 to i64
%5 = getelementptr inbounds [5 x i8], [5 x i8]* @.str.1, i64 0, i64 %4
%6 = load i8, i8* %5
%7 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8 signext %6)
%8 = load i32, i32* @stdout
%9 = call i32 @fflush(i32 %8)
ret void
}

LLVM IR (-O2):
@twiddle.t = internal unnamed_addr global i32 -1
@.str = [4 x i8] c"%c\08\00"
@.str.1 = [5 x i8] c"|/-\\\00"
@stdout = global i32 0
define void @twiddle() {
%1 = load i32, i32* @twiddle.t
%2 = add nsw i32 %1, 1
store i32 %2, i32* @twiddle.t
%3 = and i32 %2, 3
%4 = zext i32 %3 to i64
%5 = getelementptr inbounds [5 x i8], [5 x i8]* @.str.1, i64 0, i64 %4
%6 = load i8, i8* %5
%7 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8 signext %6)
%8 = load i32, i32* @stdout
%9 = tail call i32 @fflush(i32 %8)
ret void
}
void turnRight() {}


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

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

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

LLVM IR (-O2):
define void @turnRight() {
ret void
}
void ff_hevc_put_hevc_pel_pixels8_10_sse4() {}


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

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

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

LLVM IR (-O2):
define void @ff_hevc_put_hevc_pel_pixels8_10_sse4() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void procedimento() { printf("Ola, mundo! Eu sou um procedimento!\n"); }


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

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

LLVM IR (-O0):
@.str = [37 x i8] c"Ola, mundo! Eu sou um procedimento!\0A\00"
define void @procedimento() {
%1 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [36 x i8] c"Ola, mundo! Eu sou um procedimento!\00"
define void @procedimento() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ assert(void *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, size_t, char const *);
void YieldUrlConnectionIndexCallback(const char *url, size_t index,
                                     void *context) {
  assert(url);
  assert(index);
  assert(context);
  FILE *output_file = (FILE *)context;
  fprintf(output_file, "%-6lu %s\n", index, url);
}


x86 assembly (clang, -O0):
<YieldUrlConnectionIndexCallback>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <assert@plt>
mov    -0x10(%rbp),%rdi
call   1030 <assert@plt>
mov    -0x18(%rbp),%rdi
call   1030 <assert@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x8(%rbp),%rcx
lea    0xe96(%rip),%rsi
call   1040 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<YieldUrlConnectionIndexCallback>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%rbx
mov    %rsi,%r14
mov    %rdi,%r15
call   1030 <assert@plt>
mov    %r14,%rdi
call   1030 <assert@plt>
mov    %rbx,%rdi
call   1030 <assert@plt>
lea    0xeb6(%rip),%rsi
mov    %rbx,%rdi
mov    %r14,%rdx
mov    %r15,%rcx
pop    %rbx
pop    %r14
pop    %r15
jmp    1040 <fprintf@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"%-6lu %s\0A\00"
define void @YieldUrlConnectionIndexCallback(i8* %0, i64 %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i8*
%7 = alloca i32*
store i8* %0, i8** %4
store i64 %1, i64* %5
store i8* %2, i8** %6
%8 = load i8*, i8** %4
%9 = call i32 @assert(i8* %8)
%10 = load i64, i64* %5
%11 = inttoptr i64 %10 to i8*
%12 = call i32 @assert(i8* %11)
%13 = load i8*, i8** %6
%14 = call i32 @assert(i8* %13)
%15 = load i8*, i8** %6
%16 = bitcast i8* %15 to i32*
store i32* %16, i32** %7
%17 = load i32*, i32** %7
%18 = load i64, i64* %5
%19 = load i8*, i8** %4
%20 = call i32 @fprintf(i32* %17, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i64 %18, i8* %19)
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"%-6lu %s\0A\00"
define void @YieldUrlConnectionIndexCallback(i8* %0, i64 %1, i8* %2) {
%4 = tail call i32 @assert(i8* %0)
%5 = inttoptr i64 %1 to i8*
%6 = tail call i32 @assert(i8* %5)
%7 = tail call i32 @assert(i8* %2)
%8 = bitcast i8* %2 to i32*
%9 = tail call i32 @fprintf(i32* %8, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i64 %1, i8* %0)
ret void
}
long __syscall0(long n) {
  unsigned long __ret;
  __asm__ __volatile__("call *%%gs:16" : "=a"(__ret) : "a"(n) : "memory");
  return __ret;
}


x86 assembly (clang, -O0):
<__syscall0>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
call   *%gs:0x10
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<__syscall0>:
mov    %rdi,%rax
call   *%gs:0x10
ret

LLVM IR (-O0):
define i64 @__syscall0(i64 %0) {
%2 = alloca i64
%3 = alloca i64
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = call i64 asm sideeffect "call *%gs:16", "={ax},{ax},~{memory},~{dirflag},~{fpsr},~{flags}"(i64 %4)
store i64 %5, i64* %3
%6 = load i64, i64* %3
ret i64 %6
}

LLVM IR (-O2):
define i64 @__syscall0(i64 %0) {
%2 = tail call i64 asm sideeffect "call *%gs:16", "={ax},{ax},~{memory},~{dirflag},~{fpsr},~{flags}"(i64 %0)
ret i64 %2
}
double ls_costN_nm4_sign(double x) { return x < 0 ? -1 : x > 0 ? 1 : x; }


x86 assembly (clang, -O0):
<ls_costN_nm4_sign>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x8(%rbp),%xmm0
jbe    1129 <ls_costN_nm4_sign+0x29>
movsd  0xee9(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    1161 <ls_costN_nm4_sign+0x61>
movsd  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    114d <ls_costN_nm4_sign+0x4d>
movsd  0xebd(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    1157 <ls_costN_nm4_sign+0x57>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<ls_costN_nm4_sign>:
xorpd  %xmm1,%xmm1
xorpd  %xmm2,%xmm2
cmpltsd %xmm0,%xmm2
movsd  0xeeb(%rip),%xmm3
andpd  %xmm2,%xmm3
andnpd %xmm0,%xmm2
orpd   %xmm3,%xmm2
cmpltsd %xmm1,%xmm0
movapd %xmm0,%xmm1
andnpd %xmm2,%xmm1
movsd  0xed2(%rip),%xmm2
andpd  %xmm2,%xmm0
orpd   %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @ls_costN_nm4_sign(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fcmp olt double %3, 0.000000e+00
br i1 %4, label %5, label %6
5: ; preds = %1
br label %14
6: ; preds = %1
%7 = load double, double* %2
%8 = fcmp ogt double %7, 0.000000e+00
br i1 %8, label %9, label %10
9: ; preds = %6
br label %12
10: ; preds = %6
%11 = load double, double* %2
br label %12
12: ; preds = %10, %9
%13 = phi double [ 1.000000e+00, %9 ], [ %11, %10 ]
br label %14
14: ; preds = %12, %5
%15 = phi double [ -1.000000e+00, %5 ], [ %13, %12 ]
ret double %15
}

LLVM IR (-O2):
define double @ls_costN_nm4_sign(double %0) {
%2 = fcmp olt double %0, 0.000000e+00
%3 = fcmp ogt double %0, 0.000000e+00
%4 = select i1 %3, double 1.000000e+00, double %0
%5 = select i1 %2, double -1.000000e+00, double %4
ret double %5
}
double z_lerpf(double const a, double const b, double const t) {
  return (1.0 - t) * a + t * b;
}


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

x86 assembly (clang, -O2):
<z_lerpf>:
movsd  0xef8(%rip),%xmm3
subsd  %xmm2,%xmm3
mulsd  %xmm2,%xmm1
mulsd  %xmm3,%xmm0
addsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @z_lerpf(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
%7 = load double, double* %6
%8 = fsub double 1.000000e+00, %7
%9 = load double, double* %4
%10 = load double, double* %6
%11 = load double, double* %5
%12 = fmul double %10, %11
%13 = call double @llvm.fmuladd.f64(double %8, double %9, double %12)
ret double %13
}

LLVM IR (-O2):
define double @z_lerpf(double %0, double %1, double %2) {
%4 = fsub double 1.000000e+00, %2
%5 = fmul double %1, %2
%6 = tail call double @llvm.fmuladd.f64(double %4, double %0, double %5)
ret double %6
}
/* Type definitions */
struct Cyc_Lexing_lexbuf {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ Cyc_block_string_rec(struct Cyc_Lexing_lexbuf *, int);
int Cyc_block_string(struct Cyc_Lexing_lexbuf *lexbuf) {
  return ({ Cyc_block_string_rec(lexbuf, 17); });
}


x86 assembly (clang, -O0):
<Cyc_block_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x11,%esi
call   1030 <Cyc_block_string_rec@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Cyc_block_string>:
mov    $0x11,%esi
jmp    1030 <Cyc_block_string_rec@plt>

LLVM IR (-O0):
%struct.Cyc_Lexing_lexbuf = type { i32 }
define i32 @Cyc_block_string(%struct.Cyc_Lexing_lexbuf* %0) {
%2 = alloca %struct.Cyc_Lexing_lexbuf*
%3 = alloca i32
store %struct.Cyc_Lexing_lexbuf* %0, %struct.Cyc_Lexing_lexbuf** %2
%4 = load %struct.Cyc_Lexing_lexbuf*, %struct.Cyc_Lexing_lexbuf** %2
%5 = call i32 @Cyc_block_string_rec(%struct.Cyc_Lexing_lexbuf* %4, i32 17)
store i32 %5, i32* %3
%6 = load i32, i32* %3
ret i32 %6
}

LLVM IR (-O2):
%struct.Cyc_Lexing_lexbuf = type { i32 }
define i32 @Cyc_block_string(%struct.Cyc_Lexing_lexbuf* %0) {
%2 = tail call i32 @Cyc_block_string_rec(%struct.Cyc_Lexing_lexbuf* %0, i32 17)
ret i32 %2
}
/* Type definitions */
typedef int int_least32_t;

/* Variables and functions */
int foo();
int_least32_t __attribute__((no)) bar(void) {
  int_least32_t c = 1;
  c |= 4294967295 ^ (foo() | 4073709551608);
  return c;
}


x86 assembly (clang, -O0):
<bar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x1,-0x4(%rbp)
mov    $0x0,%al
call   1030 <foo@plt>
movslq %eax,%rcx
movabs $0x3b47c02bff8,%rax
or     %rax,%rcx
movabs $0xffffffff,%rax
xor    %rax,%rcx
movslq -0x4(%rbp),%rax
or     %rcx,%rax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bar>:
push   %rax
xor    %eax,%eax
call   1030 <foo@plt>
or     $0x7c02bff9,%eax
xor    $0xfffffffe,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @bar() {
%1 = alloca i32
store i32 1, i32* %1
%2 = call i32 (...) @foo()
%3 = sext i32 %2 to i64
%4 = or i64 %3, 4073709551608
%5 = xor i64 4294967295, %4
%6 = load i32, i32* %1
%7 = sext i32 %6 to i64
%8 = or i64 %7, %5
%9 = trunc i64 %8 to i32
store i32 %9, i32* %1
%10 = load i32, i32* %1
ret i32 %10
}

LLVM IR (-O2):
define i32 @bar() {
%1 = tail call i32 (...) @foo()
%2 = or i32 %1, 2080555001
%3 = xor i32 %2, -2
ret i32 %3
}
/* Type definitions */
struct SN_env {
  int dummy;
};

/* Variables and functions */
struct SN_env *SN_create_env(int /*<<< orphan*/, int, int);
extern struct SN_env *dutch_ISO_8859_1_create_env(void) {
  return SN_create_env(0, 2, 1);
}


x86 assembly (clang, -O0):
<dutch_ISO_8859_1_create_env>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
mov    $0x2,%esi
mov    $0x1,%edx
call   1030 <SN_create_env@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<dutch_ISO_8859_1_create_env>:
xor    %edi,%edi
mov    $0x2,%esi
mov    $0x1,%edx
jmp    1030 <SN_create_env@plt>

LLVM IR (-O0):
%struct.SN_env = type { i32 }
define %struct.SN_env* @dutch_ISO_8859_1_create_env() {
%1 = call %struct.SN_env* @SN_create_env(i32 0, i32 2, i32 1)
ret %struct.SN_env* %1
}

LLVM IR (-O2):
%struct.SN_env = type { i32 }
define %struct.SN_env* @dutch_ISO_8859_1_create_env() {
%1 = tail call %struct.SN_env* @SN_create_env(i32 0, i32 2, i32 1)
ret %struct.SN_env* %1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ say_bye();
int /*<<< orphan*/ say_hello(char *, int);
int main() {
  printf("this is a c application.\n");
  say_hello("jack", 4);
  say_bye();
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xecd(%rip),%rdi
call   1030 <puts@plt>
lea    0xebc(%rip),%rdi
mov    $0x4,%esi
call   1050 <say_hello@plt>
xor    %eax,%eax
call   1040 <say_bye@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [26 x i8] c"this is a c application.\0A\00"
@.str.1 = [5 x i8] c"jack\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @say_hello(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 4)
%4 = call i32 (...) @say_bye()
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [5 x i8] c"jack\00"
@str = [25 x i8] c"this is a c application.\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @say_hello(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 4)
%3 = tail call i32 (...) @say_bye()
ret i32 0
}
/* Variables and functions */
scalar_t__ CallBack2(int, void *, void *);
int Variable(const char *varName, int varType) {
  return (int)CallBack2(45, (void *)varName, (void *)varType);
}


x86 assembly (clang, -O0):
<Variable>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rsi
movslq -0xc(%rbp),%rdx
mov    $0x2d,%edi
call   1030 <CallBack2@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Variable>:
mov    %rdi,%rax
movslq %esi,%rdx
mov    $0x2d,%edi
mov    %rax,%rsi
jmp    1030 <CallBack2@plt>

LLVM IR (-O0):
define i32 @Variable(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i8*, i8** %3
%6 = load i32, i32* %4
%7 = sext i32 %6 to i64
%8 = inttoptr i64 %7 to i8*
%9 = call i64 @CallBack2(i32 45, i8* %5, i8* %8)
%10 = trunc i64 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @Variable(i8* %0, i32 %1) {
%3 = sext i32 %1 to i64
%4 = inttoptr i64 %3 to i8*
%5 = tail call i64 @CallBack2(i32 45, i8* %0, i8* %4)
%6 = trunc i64 %5 to i32
ret i32 %6
}
int test(int *p) {
  return ({
    int x = *p;
    int y = 1;
    x + y;
  });
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
movl   $0x1,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @test(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = add nsw i32 %2, 1
ret i32 %3
}
/* Variables and functions */
int strlen(char const *);
const char *string_back(const char *str, int max) {
  int length;
  length = strlen(str);
  if (length < max) {
    return str;
  } else {
    return &str[length - max];
  }
}


x86 assembly (clang, -O0):
<string_back>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1144 <string_back+0x34>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1158 <string_back+0x48>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%ecx
sub    -0x14(%rbp),%ecx
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<string_back>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
call   1030 <strlen@plt>
xor    %ecx,%ecx
sub    %ebp,%eax
cmovl  %ecx,%eax
add    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i8* @string_back(i8* %0, i32 %1) {
%3 = tail call i32 @strlen(i8* %0)
%4 = icmp slt i32 %3, %1
%5 = sub nsw i32 %3, %1
%6 = select i1 %4, i32 0, i32 %5
%7 = zext i32 %6 to i64
%8 = getelementptr i8, i8* %0, i64 %7
ret i8* %8
}
void clipit8(float f, unsigned char *a) {
  f /= 256.0;
  f += 128.0;
  if (f > 254.5)
    *a = 255;
  else if (f < 0.5)
    *a = 0;
  else
    *a = f;
}


x86 assembly (clang, -O0):
<clipit8>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
mov    %rdi,-0x10(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xef2(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xecc(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xea6(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1170 <clipit8+0x70>
mov    -0x10(%rbp),%rax
movb   $0xff,(%rax)
jmp    11a9 <clipit8+0xa9>
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe97(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    1197 <clipit8+0x97>
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
jmp    11a4 <clipit8+0xa4>
cvttss2si -0x4(%rbp),%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
jmp    11a9 <clipit8+0xa9>
pop    %rbp
ret

x86 assembly (clang, -O2):
<clipit8>:
mulss  0xef8(%rip),%xmm0
addss  0xef4(%rip),%xmm0
mov    $0xff,%al
ucomiss 0xeef(%rip),%xmm0
ja     1131 <clipit8+0x31>
movss  0xee9(%rip),%xmm1
ucomiss %xmm0,%xmm1
jbe    112d <clipit8+0x2d>
xor    %eax,%eax
mov    %al,(%rdi)
ret
cvttss2si %xmm0,%eax
mov    %al,(%rdi)
ret

LLVM IR (-O0):
define void @clipit8(float %0, i8* %1) {
%3 = alloca float
%4 = alloca i8*
store float %0, float* %3
store i8* %1, i8** %4
%5 = load float, float* %3
%6 = fpext float %5 to double
%7 = fdiv double %6, 2.560000e+02
%8 = fptrunc double %7 to float
store float %8, float* %3
%9 = load float, float* %3
%10 = fpext float %9 to double
%11 = fadd double %10, 1.280000e+02
%12 = fptrunc double %11 to float
store float %12, float* %3
%13 = load float, float* %3
%14 = fpext float %13 to double
%15 = fcmp ogt double %14, 2.545000e+02
br i1 %15, label %16, label %18
16: ; preds = %2
%17 = load i8*, i8** %4
store i8 -1, i8* %17
br label %29
18: ; preds = %2
%19 = load float, float* %3
%20 = fpext float %19 to double
%21 = fcmp olt double %20, 5.000000e-01
br i1 %21, label %22, label %24
22: ; preds = %18
%23 = load i8*, i8** %4
store i8 0, i8* %23
br label %28
24: ; preds = %18
%25 = load float, float* %3
%26 = fptoui float %25 to i8
%27 = load i8*, i8** %4
store i8 %26, i8* %27
br label %28
28: ; preds = %24, %22
br label %29
29: ; preds = %28, %16
ret void
}

LLVM IR (-O2):
define void @clipit8(float %0, i8* nocapture writeonly %1) {
%3 = fmul float %0, 3.906250e-03
%4 = fadd float %3, 1.280000e+02
%5 = fcmp ogt float %4, 2.545000e+02
br i1 %5, label %10, label %6
6: ; preds = %2
%7 = fcmp olt float %4, 5.000000e-01
br i1 %7, label %10, label %8
8: ; preds = %6
%9 = fptoui float %4 to i8
br label %10
10: ; preds = %6, %2, %8
%11 = phi i8 [ %9, %8 ], [ -1, %2 ], [ 0, %6 ]
store i8 %11, i8* %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void print(int a[], int len) {
  int i;
  for (i = 0; i < len; i++)
    printf("%d ", *(a + i));
  printf("\n");
}


x86 assembly (clang, -O0):
<print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1159 <print+0x49>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <print+0x16>
lea    0xea4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    1157 <print+0x37>
mov    %rdi,%r15
mov    %esi,%r12d
lea    0xec7(%rip),%r14
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    (%r15,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1140 <print+0x20>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d \00"
define void @print(i32* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %11, %6 ]
%8 = getelementptr inbounds i32, i32* %0, i64 %7
%9 = load i32, i32* %8
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = add nuw nsw i64 %7, 1
%12 = icmp eq i64 %11, %5
br i1 %12, label %13, label %6
13: ; preds = %6, %2
%14 = tail call i32 @putchar(i32 10)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ sscanf(char *, char *, float *);
float PRT_getFloat(char opt[128]) {
  float ret;
  sscanf(opt, "%f", &ret);
  return ret;
}


x86 assembly (clang, -O0):
<PRT_getFloat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xed9(%rip),%rsi
lea    -0xc(%rbp),%rdx
call   1030 <sscanf@plt>
movss  -0xc(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PRT_getFloat>:
push   %rax
lea    0xee8(%rip),%rsi
lea    0x4(%rsp),%rdx
call   1030 <sscanf@plt>
movss  0x4(%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%f\00"
define float @PRT_getFloat(i8* %0) {
%2 = alloca i8*
%3 = alloca float
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @sscanf(i8* %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %3)
%6 = load float, float* %3
ret float %6
}

LLVM IR (-O2):
@.str = [3 x i8] c"%f\00"
define float @PRT_getFloat(i8* nocapture %0) {
%2 = alloca float
%3 = bitcast float* %2 to i8*
%4 = call i32 @sscanf(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %2)
%5 = load float, float* %2
ret float %5
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
int usage(int rc) {
  fprintf(stderr, "Usage: pgrep [-Vchilnsvx] pattern [file] ...\n");
  return rc;
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2ebe(%rip),%rax
mov    (%rax),%edi
lea    0xed5(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<usage>:
push   %rbx
mov    %edi,%ebx
mov    0x2ec6(%rip),%rax
mov    (%rax),%edi
lea    0xedd(%rip),%rsi
call   1030 <fprintf@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [46 x i8] c"Usage: pgrep [-Vchilnsvx] pattern [file] ...\0A\00"
define i32 @usage(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* @stderr
%4 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
%5 = load i32, i32* %2
ret i32 %5
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [46 x i8] c"Usage: pgrep [-Vchilnsvx] pattern [file] ...\0A\00"
define i32 @usage(i32 returned %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
ret i32 %0
}
/* Variables and functions */
int /*<<< orphan*/ HelloFunc();
int main() {
  HelloFunc();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @HelloFunc()
ret i32 0
}